Merge remote-tracking branch 'origin/develop' into develop-entv
This commit is contained in:
@@ -130,7 +130,7 @@ ccodedot11_encode (unsigned int numbytes,
|
||||
*outPtr++ = (out>>1)&1;
|
||||
|
||||
#ifdef DEBUG_CCODE
|
||||
printf("%d: %u -> %d (%u)\n",dummy,state,out,ccodedot11_table[state]);
|
||||
printf("%u: %u -> %d (%u)\n",dummy,state,out,ccodedot11_table[state]);
|
||||
dummy+=2;
|
||||
#endif //DEBUG_CCODE
|
||||
bit_index=(bit_index==0)?1:0;
|
||||
|
||||
@@ -88,17 +88,17 @@ uint32_t crcbit (uint8_t * inputptr, int32_t octetlen, uint32_t poly)
|
||||
|
||||
// Reference 38.212 V15.1.1 Section 5.1 (36-212 v8.6.0 , pp 8-9)
|
||||
// The highest degree is set by default
|
||||
// 1000 0110 0100 1100 1111 1011 D^24 + D^23 + D^18 + D^17 + D^14 + D^11 + D^10 + D^7 + D^6 + D^5 + D^4 + D^3 + D + 1
|
||||
// 1000 0110 0100 1100 1111 1011 D^24 + D^23 + D^18 + D^17 + D^14 + D^11 + D^10 + D^7 + D^6 + D^5 + D^4 + D^3 + D + 1
|
||||
static const uint32_t poly24a = 0x864cfb00;
|
||||
// 1000 0000 0000 0000 0110 0011 D^24 + D^23 + D^6 + D^5 + D + 1
|
||||
// 1000 0000 0000 0000 0110 0011 D^24 + D^23 + D^6 + D^5 + D + 1
|
||||
static const uint32_t poly24b = 0x80006300;
|
||||
// 0001 0000 0010 0001 D^16 + D^12 + D^5 + 1
|
||||
// 0001 0000 0010 0001 D^16 + D^12 + D^5 + 1
|
||||
static const uint32_t poly16 = 0x10210000;
|
||||
// 1000 0000 1111 D^12 + D^11 + D^3 + D^2 + D + 1
|
||||
// 1000 0000 1111 D^12 + D^11 + D^3 + D^2 + D + 1
|
||||
static const uint32_t poly12 = 0x80F00000;
|
||||
// 1001 1011 D^8 + D^7 + D^4 + D^3 + D + 1
|
||||
// 1001 1011 D^8 + D^7 + D^4 + D^3 + D + 1
|
||||
static const uint32_t poly8 = 0x9B000000;
|
||||
|
||||
|
||||
void crcTableInit (void)
|
||||
{
|
||||
uint8_t c = 0;
|
||||
|
||||
@@ -236,7 +236,7 @@ void sub_block_deinterleaving_cc(uint32_t D,int8_t *d,int8_t *w) {
|
||||
ND = Kpi - D;
|
||||
#ifdef RM_DEBUG2
|
||||
printf("sub_block_interleaving_cc : D = %d (%d), d %p, w %p\n",D,D*3,d,w);
|
||||
printf("RCC = %d, Kpi=%d, ND=%ld\n",RCC,Kpi,ND);
|
||||
printf("RCC = %d, Kpi=%d, ND=%ld\n",RCC,Kpi,(long)ND);
|
||||
#endif
|
||||
ND3 = ND*3;
|
||||
k=0;
|
||||
@@ -253,7 +253,8 @@ void sub_block_deinterleaving_cc(uint32_t D,int8_t *d,int8_t *w) {
|
||||
d[index3-ND3+1] = w[Kpi+k];
|
||||
d[index3-ND3+2] = w[(Kpi<<1)+k];
|
||||
#ifdef RM_DEBUG2
|
||||
printf("row %d, index %d k %d index3-ND3 %ld w(%d,%d,%d)\n",row,index,k,index3-ND3,w[k],w[Kpi+k],w[(Kpi<<1)+k]);
|
||||
printf("row %d, index %d k %d index3-ND3 %ld w(%d,%d,%d)\n",
|
||||
row,index,k,(long)(index3-ND3),w[k],w[Kpi+k],w[(Kpi<<1)+k]);
|
||||
#endif
|
||||
index3+=96;
|
||||
index+=32;
|
||||
@@ -453,7 +454,6 @@ uint32_t lte_rate_matching_turbo(uint32_t RTC,
|
||||
int threed =0;
|
||||
uint32_t nulled=0;
|
||||
static unsigned char *counter_buffer[MAX_NUM_DLSCH_SEGMENTS][4];
|
||||
FILE *counter_fd;
|
||||
char fname[512];
|
||||
#endif
|
||||
|
||||
@@ -476,7 +476,6 @@ uint32_t lte_rate_matching_turbo(uint32_t RTC,
|
||||
} else if(rvidx==3) {
|
||||
sprintf(fname, "mcs%d_rate_matching_RB_%d.txt", m, nb_rb);
|
||||
// sprintf(fname,"mcs0_rate_matching_RB_6.txt");
|
||||
counter_fd = fopen(fname,"w");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -59,6 +59,7 @@ int lte_segmentation(unsigned char *input_buffer,
|
||||
}
|
||||
|
||||
if ((*C)>MAX_NUM_DLSCH_SEGMENTS) {
|
||||
printf("%d\n",*(int*)0);
|
||||
LOG_E(PHY,"lte_segmentation.c: too many segments %d, B %d, L %d, Bprime %d\n",*C,B,L,Bprime);
|
||||
return(-1);
|
||||
}
|
||||
@@ -124,7 +125,8 @@ int lte_segmentation(unsigned char *input_buffer,
|
||||
Bprime,*Cplus,*Kplus,*Cminus,*Kminus);
|
||||
*F = ((*Cplus)*(*Kplus) + (*Cminus)*(*Kminus) - (Bprime));
|
||||
#ifdef DEBUG_SEGMENTATION
|
||||
printf("C %u, Cplus %u, Cminus %u, Kplus %u, Kminus %u, Bprime_bytes %u, Bprime %u, F %u\n",*C,*Cplus,*Cminus,*Kplus,*Kminus,Bprime>>3,Bprime,*F);
|
||||
printf("C %u, Cplus %u, Cminus %u, Kplus %u, Kminus %u, Bprime_bytes %u, Bprime %u, F %u\n",
|
||||
*C,*Cplus,*Cminus,*Kplus,*Kminus,Bprime>>3,Bprime,*F);
|
||||
#endif
|
||||
|
||||
if ((input_buffer) && (output_buffers)) {
|
||||
|
||||
@@ -83,4 +83,4 @@ void free_lte_top(void) {
|
||||
|
||||
|
||||
/*
|
||||
@}*/
|
||||
* @}*/
|
||||
|
||||
@@ -975,3 +975,4 @@ void install_schedule_handlers(IF_Module_t *if_inst)
|
||||
if_inst->PHY_config_req = phy_config_request;
|
||||
if_inst->schedule_response = schedule_response;
|
||||
}
|
||||
|
||||
|
||||
+230
-331
@@ -34,19 +34,17 @@
|
||||
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
|
||||
#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
void init_7_5KHz(void);
|
||||
|
||||
uint8_t dmrs1_tab_ue[8] = {0,2,3,4,6,8,9,10};
|
||||
extern uint8_t nfapi_mode;
|
||||
|
||||
|
||||
void phy_config_sib1_ue(module_id_t Mod_id,int CC_id,
|
||||
uint8_t eNB_id,
|
||||
LTE_TDD_Config_t *tdd_Config,
|
||||
uint8_t SIwindowsize,
|
||||
uint16_t SIperiod)
|
||||
{
|
||||
|
||||
uint16_t SIperiod) {
|
||||
LTE_DL_FRAME_PARMS *fp = &PHY_vars_UE_g[Mod_id][CC_id]->frame_parms;
|
||||
|
||||
if (tdd_Config) {
|
||||
@@ -64,44 +62,29 @@ void phy_config_sib2_ue(module_id_t Mod_id,int CC_id,
|
||||
LTE_ARFCN_ValueEUTRA_t *ul_CarrierFreq,
|
||||
long *ul_Bandwidth,
|
||||
LTE_AdditionalSpectrumEmission_t *additionalSpectrumEmission,
|
||||
struct LTE_MBSFN_SubframeConfigList *mbsfn_SubframeConfigList)
|
||||
{
|
||||
|
||||
struct LTE_MBSFN_SubframeConfigList *mbsfn_SubframeConfigList) {
|
||||
PHY_VARS_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||
LTE_DL_FRAME_PARMS *fp = &ue->frame_parms;
|
||||
int i;
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_CONFIG_SIB2, VCD_FUNCTION_IN);
|
||||
|
||||
LOG_I(PHY,"[UE%d] Applying radioResourceConfigCommon from eNB%d\n",Mod_id,eNB_id);
|
||||
|
||||
fp->prach_config_common.rootSequenceIndex =radioResourceConfigCommon->prach_Config.rootSequenceIndex;
|
||||
|
||||
fp->prach_config_common.prach_Config_enabled=1;
|
||||
fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex =radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_ConfigIndex;
|
||||
fp->prach_config_common.prach_ConfigInfo.highSpeedFlag =radioResourceConfigCommon->prach_Config.prach_ConfigInfo.highSpeedFlag;
|
||||
fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig =radioResourceConfigCommon->prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig;
|
||||
fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset =radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_FreqOffset;
|
||||
|
||||
compute_prach_seq(fp->prach_config_common.rootSequenceIndex,
|
||||
fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
|
||||
fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
|
||||
fp->prach_config_common.prach_ConfigInfo.highSpeedFlag,
|
||||
fp->frame_type,ue->X_u);
|
||||
|
||||
|
||||
|
||||
fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
|
||||
fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
|
||||
fp->prach_config_common.prach_ConfigInfo.highSpeedFlag,
|
||||
fp->frame_type,ue->X_u);
|
||||
fp->pucch_config_common.deltaPUCCH_Shift = 1+radioResourceConfigCommon->pucch_ConfigCommon.deltaPUCCH_Shift;
|
||||
fp->pucch_config_common.nRB_CQI = radioResourceConfigCommon->pucch_ConfigCommon.nRB_CQI;
|
||||
fp->pucch_config_common.nCS_AN = radioResourceConfigCommon->pucch_ConfigCommon.nCS_AN;
|
||||
fp->pucch_config_common.n1PUCCH_AN = radioResourceConfigCommon->pucch_ConfigCommon.n1PUCCH_AN;
|
||||
|
||||
|
||||
|
||||
fp->pdsch_config_common.referenceSignalPower = radioResourceConfigCommon->pdsch_ConfigCommon.referenceSignalPower;
|
||||
fp->pdsch_config_common.p_b = radioResourceConfigCommon->pdsch_ConfigCommon.p_b;
|
||||
|
||||
|
||||
fp->pusch_config_common.n_SB = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.n_SB;
|
||||
fp->pusch_config_common.hoppingMode = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode;
|
||||
fp->pusch_config_common.pusch_HoppingOffset = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset;
|
||||
@@ -110,8 +93,6 @@ void phy_config_sib2_ue(module_id_t Mod_id,int CC_id,
|
||||
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH;
|
||||
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled;
|
||||
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift = dmrs1_tab_ue[radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift];
|
||||
|
||||
|
||||
init_ul_hopping(fp);
|
||||
fp->soundingrs_ul_config_common.enabled_flag = 0;
|
||||
|
||||
@@ -127,8 +108,6 @@ void phy_config_sib2_ue(module_id_t Mod_id,int CC_id,
|
||||
fp->soundingrs_ul_config_common.srs_MaxUpPts = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
fp->ul_power_control_config_common.p0_NominalPUSCH = radioResourceConfigCommon->uplinkPowerControlCommon.p0_NominalPUSCH;
|
||||
fp->ul_power_control_config_common.alpha = radioResourceConfigCommon->uplinkPowerControlCommon.alpha;
|
||||
fp->ul_power_control_config_common.p0_NominalPUCCH = radioResourceConfigCommon->uplinkPowerControlCommon.p0_NominalPUCCH;
|
||||
@@ -138,16 +117,11 @@ void phy_config_sib2_ue(module_id_t Mod_id,int CC_id,
|
||||
fp->ul_power_control_config_common.deltaF_PUCCH_Format2 = radioResourceConfigCommon->uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2;
|
||||
fp->ul_power_control_config_common.deltaF_PUCCH_Format2a = radioResourceConfigCommon->uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2a;
|
||||
fp->ul_power_control_config_common.deltaF_PUCCH_Format2b = radioResourceConfigCommon->uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2b;
|
||||
|
||||
fp->maxHARQ_Msg3Tx = radioResourceConfigCommon->rach_ConfigCommon.maxHARQ_Msg3Tx;
|
||||
|
||||
// Now configure some of the Physical Channels
|
||||
|
||||
// PUCCH
|
||||
init_ncs_cell(fp,ue->ncs_cell);
|
||||
|
||||
init_ul_hopping(fp);
|
||||
|
||||
// PCH
|
||||
init_ue_paging_info(ue,radioResourceConfigCommon->pcch_Config.defaultPagingCycle,radioResourceConfigCommon->pcch_Config.nB);
|
||||
|
||||
@@ -171,7 +145,6 @@ void phy_config_sib2_ue(module_id_t Mod_id,int CC_id,
|
||||
mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[2]|
|
||||
(mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[1]<<8)|
|
||||
(mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0]<<16);
|
||||
|
||||
LOG_I(PHY, "[CONFIG] LTE_MBSFN_SubframeConfig[%d] pattern is %x\n", i,
|
||||
fp->MBSFN_config[i].mbsfn_SubframeConfig);
|
||||
}
|
||||
@@ -179,16 +152,11 @@ void phy_config_sib2_ue(module_id_t Mod_id,int CC_id,
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_CONFIG_SIB2, VCD_FUNCTION_OUT);
|
||||
|
||||
}
|
||||
|
||||
void phy_config_sib13_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,int mbsfn_Area_idx,
|
||||
long mbsfn_AreaId_r9)
|
||||
{
|
||||
|
||||
long mbsfn_AreaId_r9) {
|
||||
LTE_DL_FRAME_PARMS *fp = &PHY_vars_UE_g[Mod_id][CC_id]->frame_parms;
|
||||
|
||||
|
||||
LOG_I(PHY,"[UE%d] Applying MBSFN_Area_id %ld for index %d\n",Mod_id,mbsfn_AreaId_r9,mbsfn_Area_idx);
|
||||
|
||||
if (mbsfn_Area_idx == 0) {
|
||||
@@ -224,9 +192,7 @@ void phy_config_sib1_fembms_ue(module_id_t Mod_id,int CC_id,
|
||||
/*
|
||||
* Configures UE MAC and PHY with radioResourceCommon received in mobilityControlInfo IE during Handover
|
||||
*/
|
||||
void phy_config_afterHO_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_id, LTE_MobilityControlInfo_t *mobilityControlInfo, uint8_t ho_failed)
|
||||
{
|
||||
|
||||
void phy_config_afterHO_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_id, LTE_MobilityControlInfo_t *mobilityControlInfo, uint8_t ho_failed) {
|
||||
if(mobilityControlInfo!=NULL) {
|
||||
LTE_RadioResourceConfigCommon_t *radioResourceConfigCommon = &mobilityControlInfo->radioResourceConfigCommon;
|
||||
LOG_I(PHY,"radioResourceConfigCommon %p\n", radioResourceConfigCommon);
|
||||
@@ -235,44 +201,35 @@ void phy_config_afterHO_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_id, LTE_
|
||||
sizeof(LTE_DL_FRAME_PARMS));
|
||||
PHY_vars_UE_g[Mod_id][CC_id]->ho_triggered = 1;
|
||||
//PHY_vars_UE_g[UE_id]->UE_mode[0] = PRACH;
|
||||
|
||||
LTE_DL_FRAME_PARMS *fp = &PHY_vars_UE_g[Mod_id][CC_id]->frame_parms;
|
||||
// int N_ZC;
|
||||
// uint8_t prach_fmt;
|
||||
// int u;
|
||||
|
||||
LOG_I(PHY,"[UE%d] Handover triggered: Applying radioResourceConfigCommon from eNB %d\n",
|
||||
Mod_id,eNB_id);
|
||||
|
||||
fp->prach_config_common.rootSequenceIndex =radioResourceConfigCommon->prach_Config.rootSequenceIndex;
|
||||
fp->prach_config_common.prach_Config_enabled=1;
|
||||
fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex =radioResourceConfigCommon->prach_Config.prach_ConfigInfo->prach_ConfigIndex;
|
||||
fp->prach_config_common.prach_ConfigInfo.highSpeedFlag =radioResourceConfigCommon->prach_Config.prach_ConfigInfo->highSpeedFlag;
|
||||
fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig =radioResourceConfigCommon->prach_Config.prach_ConfigInfo->zeroCorrelationZoneConfig;
|
||||
fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset =radioResourceConfigCommon->prach_Config.prach_ConfigInfo->prach_FreqOffset;
|
||||
|
||||
// prach_fmt = get_prach_fmt(radioResourceConfigCommon->prach_Config.prach_ConfigInfo->prach_ConfigIndex,fp->frame_type);
|
||||
// N_ZC = (prach_fmt <4)?839:139;
|
||||
// u = (prach_fmt < 4) ? prach_root_sequence_map0_3[fp->prach_config_common.rootSequenceIndex] :
|
||||
// prach_root_sequence_map4[fp->prach_config_common.rootSequenceIndex];
|
||||
|
||||
//compute_prach_seq(u,N_ZC, PHY_vars_UE_g[Mod_id]->X_u);
|
||||
compute_prach_seq(PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.rootSequenceIndex,
|
||||
PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
|
||||
PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
|
||||
PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag,
|
||||
PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
|
||||
PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
|
||||
PHY_vars_UE_g[Mod_id][CC_id]->frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag,
|
||||
fp->frame_type,
|
||||
PHY_vars_UE_g[Mod_id][CC_id]->X_u);
|
||||
|
||||
|
||||
fp->pucch_config_common.deltaPUCCH_Shift = 1+radioResourceConfigCommon->pucch_ConfigCommon->deltaPUCCH_Shift;
|
||||
fp->pucch_config_common.nRB_CQI = radioResourceConfigCommon->pucch_ConfigCommon->nRB_CQI;
|
||||
fp->pucch_config_common.nCS_AN = radioResourceConfigCommon->pucch_ConfigCommon->nCS_AN;
|
||||
fp->pucch_config_common.n1PUCCH_AN = radioResourceConfigCommon->pucch_ConfigCommon->n1PUCCH_AN;
|
||||
fp->pdsch_config_common.referenceSignalPower = radioResourceConfigCommon->pdsch_ConfigCommon->referenceSignalPower;
|
||||
fp->pdsch_config_common.p_b = radioResourceConfigCommon->pdsch_ConfigCommon->p_b;
|
||||
|
||||
|
||||
fp->pusch_config_common.n_SB = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.n_SB;
|
||||
fp->pusch_config_common.hoppingMode = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode;
|
||||
fp->pusch_config_common.pusch_HoppingOffset = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset;
|
||||
@@ -281,7 +238,6 @@ void phy_config_afterHO_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_id, LTE_
|
||||
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH;
|
||||
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled;
|
||||
fp->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift;
|
||||
|
||||
init_ul_hopping(fp);
|
||||
fp->soundingrs_ul_config_common.enabled_flag = 0;
|
||||
|
||||
@@ -306,7 +262,6 @@ void phy_config_afterHO_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_id, LTE_
|
||||
fp->ul_power_control_config_common.deltaF_PUCCH_Format2 = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format2;
|
||||
fp->ul_power_control_config_common.deltaF_PUCCH_Format2a = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format2a;
|
||||
fp->ul_power_control_config_common.deltaF_PUCCH_Format2b = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format2b;
|
||||
|
||||
fp->maxHARQ_Msg3Tx = radioResourceConfigCommon->rach_ConfigCommon->maxHARQ_Msg3Tx;
|
||||
|
||||
// Now configure some of the Physical Channels
|
||||
@@ -324,20 +279,14 @@ void phy_config_afterHO_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_id, LTE_
|
||||
//Target CellId
|
||||
fp->Nid_cell = mobilityControlInfo->targetPhysCellId;
|
||||
fp->nushift = fp->Nid_cell%6;
|
||||
|
||||
// PUCCH
|
||||
init_ncs_cell(fp,PHY_vars_UE_g[Mod_id][CC_id]->ncs_cell);
|
||||
|
||||
init_ul_hopping(fp);
|
||||
|
||||
// RNTI
|
||||
|
||||
|
||||
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[0][eNB_id]->crnti = mobilityControlInfo->newUE_Identity.buf[0]|(mobilityControlInfo->newUE_Identity.buf[1]<<8);
|
||||
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[1][eNB_id]->crnti = mobilityControlInfo->newUE_Identity.buf[0]|(mobilityControlInfo->newUE_Identity.buf[1]<<8);
|
||||
|
||||
LOG_I(PHY,"SET C-RNTI %x %x\n",PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[0][eNB_id]->crnti,
|
||||
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[1][eNB_id]->crnti);
|
||||
PHY_vars_UE_g[Mod_id][CC_id]->pdcch_vars[1][eNB_id]->crnti);
|
||||
}
|
||||
|
||||
if(ho_failed) {
|
||||
@@ -347,12 +296,9 @@ void phy_config_afterHO_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_id, LTE_
|
||||
}
|
||||
}
|
||||
|
||||
void phy_config_meas_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,uint8_t n_adj_cells,unsigned int *adj_cell_id)
|
||||
{
|
||||
|
||||
void phy_config_meas_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,uint8_t n_adj_cells,unsigned int *adj_cell_id) {
|
||||
PHY_MEASUREMENTS *phy_meas = &PHY_vars_UE_g[Mod_id][CC_id]->measurements;
|
||||
int i;
|
||||
|
||||
LOG_I(PHY,"Configuring inter-cell measurements for %d cells, ids: \n",n_adj_cells);
|
||||
|
||||
for (i=0; i<n_adj_cells; i++) {
|
||||
@@ -361,25 +307,20 @@ void phy_config_meas_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,uint8
|
||||
}
|
||||
|
||||
phy_meas->n_adj_cells = n_adj_cells;
|
||||
memcpy((void*)phy_meas->adj_cell_id,(void *)adj_cell_id,n_adj_cells*sizeof(unsigned int));
|
||||
|
||||
memcpy((void *)phy_meas->adj_cell_id,(void *)adj_cell_id,n_adj_cells*sizeof(unsigned int));
|
||||
}
|
||||
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
|
||||
void phy_config_dedicated_scell_ue(uint8_t Mod_id,
|
||||
uint8_t eNB_index,
|
||||
LTE_SCellToAddMod_r10_t *sCellToAddMod_r10,
|
||||
int CC_id)
|
||||
{
|
||||
|
||||
int CC_id) {
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void phy_config_harq_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
uint16_t max_harq_tx )
|
||||
{
|
||||
|
||||
uint16_t max_harq_tx ) {
|
||||
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||
phy_vars_ue->ulsch[eNB_id]->Mlimit = max_harq_tx;
|
||||
}
|
||||
@@ -387,12 +328,9 @@ void phy_config_harq_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
extern uint16_t beta_cqi[16];
|
||||
|
||||
void phy_config_dedicated_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
struct LTE_PhysicalConfigDedicated *physicalConfigDedicated )
|
||||
{
|
||||
|
||||
struct LTE_PhysicalConfigDedicated *physicalConfigDedicated ) {
|
||||
static uint8_t first_dedicated_configuration = 0;
|
||||
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
|
||||
|
||||
phy_vars_ue->total_TBS[eNB_id]=0;
|
||||
phy_vars_ue->total_TBS_last[eNB_id]=0;
|
||||
phy_vars_ue->bitrate[eNB_id]=0;
|
||||
@@ -402,7 +340,6 @@ void phy_config_dedicated_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
phy_vars_ue->dlsch_received[eNB_id]=0;
|
||||
phy_vars_ue->dlsch_received_last[eNB_id]=0;
|
||||
phy_vars_ue->dlsch_fer[eNB_id]=0;
|
||||
|
||||
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex = -1;
|
||||
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex = -1;
|
||||
|
||||
@@ -438,18 +375,14 @@ void phy_config_dedicated_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_ACK_Index = physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_ACK_Index;
|
||||
phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_RI_Index = physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_RI_Index;
|
||||
phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_CQI_Index = physicalConfigDedicated->pusch_ConfigDedicated->betaOffset_CQI_Index;
|
||||
|
||||
|
||||
LOG_D(PHY,"pusch_config_dedicated.betaOffset_ACK_Index %d\n",phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_ACK_Index);
|
||||
LOG_D(PHY,"pusch_config_dedicated.betaOffset_RI_Index %d\n",phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_RI_Index);
|
||||
LOG_D(PHY,"pusch_config_dedicated.betaOffset_CQI_Index %d => %d)\n",phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_CQI_Index,beta_cqi[phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_CQI_Index]);
|
||||
LOG_D(PHY,"pusch_config_dedicated.betaOffset_CQI_Index %d => %d)\n",phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_CQI_Index,
|
||||
beta_cqi[phy_vars_ue->pusch_config_dedicated[eNB_id].betaOffset_CQI_Index]);
|
||||
LOG_D(PHY,"\n");
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (physicalConfigDedicated->uplinkPowerControlDedicated) {
|
||||
|
||||
phy_vars_ue->ul_power_control_dedicated[eNB_id].p0_UE_PUSCH = physicalConfigDedicated->uplinkPowerControlDedicated->p0_UE_PUSCH;
|
||||
phy_vars_ue->ul_power_control_dedicated[eNB_id].deltaMCS_Enabled= physicalConfigDedicated->uplinkPowerControlDedicated->deltaMCS_Enabled;
|
||||
phy_vars_ue->ul_power_control_dedicated[eNB_id].accumulationEnabled= physicalConfigDedicated->uplinkPowerControlDedicated->accumulationEnabled;
|
||||
@@ -468,32 +401,40 @@ void phy_config_dedicated_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
if (physicalConfigDedicated->antennaInfo) {
|
||||
phy_vars_ue->transmission_mode[eNB_id] = 1+(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode);
|
||||
LOG_I(PHY,"Transmission Mode %d\n",phy_vars_ue->transmission_mode[eNB_id]);
|
||||
|
||||
switch(physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode) {
|
||||
case LTE_AntennaInfoDedicated__transmissionMode_tm1:
|
||||
phy_vars_ue->transmission_mode[eNB_id] = 1;
|
||||
break;
|
||||
case LTE_AntennaInfoDedicated__transmissionMode_tm2:
|
||||
phy_vars_ue->transmission_mode[eNB_id] = 2;
|
||||
break;
|
||||
case LTE_AntennaInfoDedicated__transmissionMode_tm3:
|
||||
phy_vars_ue->transmission_mode[eNB_id] = 3;
|
||||
break;
|
||||
case LTE_AntennaInfoDedicated__transmissionMode_tm4:
|
||||
phy_vars_ue->transmission_mode[eNB_id] = 4;
|
||||
break;
|
||||
case LTE_AntennaInfoDedicated__transmissionMode_tm5:
|
||||
phy_vars_ue->transmission_mode[eNB_id] = 5;
|
||||
break;
|
||||
case LTE_AntennaInfoDedicated__transmissionMode_tm6:
|
||||
phy_vars_ue->transmission_mode[eNB_id] = 6;
|
||||
break;
|
||||
case LTE_AntennaInfoDedicated__transmissionMode_tm7:
|
||||
lte_gold_ue_spec_port5(phy_vars_ue->lte_gold_uespec_port5_table, phy_vars_ue->frame_parms.Nid_cell, phy_vars_ue->pdcch_vars[0][eNB_id]->crnti);
|
||||
phy_vars_ue->transmission_mode[eNB_id] = 7;
|
||||
break;
|
||||
default:
|
||||
LOG_E(PHY,"Unknown transmission mode!\n");
|
||||
break;
|
||||
case LTE_AntennaInfoDedicated__transmissionMode_tm1:
|
||||
phy_vars_ue->transmission_mode[eNB_id] = 1;
|
||||
break;
|
||||
|
||||
case LTE_AntennaInfoDedicated__transmissionMode_tm2:
|
||||
phy_vars_ue->transmission_mode[eNB_id] = 2;
|
||||
break;
|
||||
|
||||
case LTE_AntennaInfoDedicated__transmissionMode_tm3:
|
||||
phy_vars_ue->transmission_mode[eNB_id] = 3;
|
||||
break;
|
||||
|
||||
case LTE_AntennaInfoDedicated__transmissionMode_tm4:
|
||||
phy_vars_ue->transmission_mode[eNB_id] = 4;
|
||||
break;
|
||||
|
||||
case LTE_AntennaInfoDedicated__transmissionMode_tm5:
|
||||
phy_vars_ue->transmission_mode[eNB_id] = 5;
|
||||
break;
|
||||
|
||||
case LTE_AntennaInfoDedicated__transmissionMode_tm6:
|
||||
phy_vars_ue->transmission_mode[eNB_id] = 6;
|
||||
break;
|
||||
|
||||
case LTE_AntennaInfoDedicated__transmissionMode_tm7:
|
||||
lte_gold_ue_spec_port5(phy_vars_ue->lte_gold_uespec_port5_table, phy_vars_ue->frame_parms.Nid_cell, phy_vars_ue->pdcch_vars[0][eNB_id]->crnti);
|
||||
phy_vars_ue->transmission_mode[eNB_id] = 7;
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_E(PHY,"Unknown transmission mode!\n");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
LOG_D(PHY,"[UE %d] Received NULL physicalConfigDedicated->antennaInfo from eNB %d\n",Mod_id, eNB_id);
|
||||
@@ -504,19 +445,17 @@ void phy_config_dedicated_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
phy_vars_ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex = physicalConfigDedicated->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex;
|
||||
phy_vars_ue->scheduling_request_config[eNB_id].sr_ConfigIndex=physicalConfigDedicated->schedulingRequestConfig->choice.setup.sr_ConfigIndex;
|
||||
phy_vars_ue->scheduling_request_config[eNB_id].dsr_TransMax=physicalConfigDedicated->schedulingRequestConfig->choice.setup.dsr_TransMax;
|
||||
|
||||
LOG_D(PHY,"scheduling_request_config.sr_PUCCH_ResourceIndex %d\n",phy_vars_ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex);
|
||||
LOG_D(PHY,"scheduling_request_config.sr_ConfigIndex %d\n",phy_vars_ue->scheduling_request_config[eNB_id].sr_ConfigIndex);
|
||||
LOG_D(PHY,"scheduling_request_config.dsr_TransMax %d\n",phy_vars_ue->scheduling_request_config[eNB_id].dsr_TransMax);
|
||||
}
|
||||
|
||||
LOG_D(PHY,"------------------------------------------------------------\n");
|
||||
|
||||
}
|
||||
|
||||
if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated) {
|
||||
|
||||
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srsConfigDedicatedSetup = 0;
|
||||
|
||||
if (physicalConfigDedicated->soundingRS_UL_ConfigDedicated->present == LTE_SoundingRS_UL_ConfigDedicated_PR_setup) {
|
||||
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srsConfigDedicatedSetup = 1;
|
||||
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].duration = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.duration;
|
||||
@@ -526,34 +465,32 @@ void phy_config_dedicated_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srs_ConfigIndex = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex;
|
||||
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srs_HoppingBandwidth = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth;
|
||||
phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].transmissionComb = physicalConfigDedicated->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb;
|
||||
|
||||
|
||||
LOG_D(PHY,"soundingrs_ul_config_dedicated.srs_ConfigIndex %d\n",phy_vars_ue->soundingrs_ul_config_dedicated[eNB_id].srs_ConfigIndex);
|
||||
}
|
||||
|
||||
LOG_D(PHY,"------------------------------------------------------------\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (physicalConfigDedicated->cqi_ReportConfig) {
|
||||
if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic) {
|
||||
// configure PUSCH CQI reporting
|
||||
phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic = *physicalConfigDedicated->cqi_ReportConfig->cqi_ReportModeAperiodic;
|
||||
|
||||
if ((phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic != rm12) &&
|
||||
(phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic != rm30) &&
|
||||
(phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic != rm31))
|
||||
LOG_E(PHY,"Unsupported Aperiodic CQI Feedback Mode : %d\n",phy_vars_ue->cqi_report_config[eNB_id].cqi_ReportModeAperiodic);
|
||||
}
|
||||
|
||||
if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic) {
|
||||
if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->present == LTE_CQI_ReportPeriodic_PR_setup) {
|
||||
// configure PUCCH CQI reporting
|
||||
// configure PUCCH CQI reporting
|
||||
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PUCCH_ResourceIndex = physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex;
|
||||
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex = physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex;
|
||||
|
||||
if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex)
|
||||
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex = *physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex;
|
||||
}
|
||||
else if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->present == LTE_CQI_ReportPeriodic_PR_release) {
|
||||
} else if (physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic->present == LTE_CQI_ReportPeriodic_PR_release) {
|
||||
// handle release
|
||||
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.ri_ConfigIndex = -1;
|
||||
phy_vars_ue->cqi_report_config[eNB_id].CQI_ReportPeriodic.cqi_PMI_ConfigIndex = -1;
|
||||
@@ -579,28 +516,25 @@ void phy_config_dedicated_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
|
||||
// fill cqi parameters for periodic CQI reporting
|
||||
get_cqipmiri_params(phy_vars_ue,eNB_id);
|
||||
|
||||
// disable MIB SIB decoding once we are on connected mode
|
||||
first_dedicated_configuration ++;
|
||||
if(first_dedicated_configuration > 1)
|
||||
{
|
||||
LOG_I(PHY,"Disable SIB MIB decoding \n");
|
||||
phy_vars_ue->decode_SIB = 0;
|
||||
phy_vars_ue->decode_MIB = 0;
|
||||
|
||||
if(first_dedicated_configuration > 1) {
|
||||
LOG_I(PHY,"Disable SIB MIB decoding \n");
|
||||
phy_vars_ue->decode_SIB = 0;
|
||||
phy_vars_ue->decode_MIB = 0;
|
||||
}
|
||||
|
||||
if(nfapi_mode!=3){
|
||||
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
|
||||
//phy_vars_ue->pdcch_vars[1][eNB_id]->crnti = phy_vars_ue->pdcch_vars[0][eNB_id]->crnti;
|
||||
if(phy_vars_ue->pdcch_vars[0][eNB_id]->crnti == 0x1234)
|
||||
phy_vars_ue->pdcch_vars[0][eNB_id]->crnti = phy_vars_ue->pdcch_vars[1][eNB_id]->crnti;
|
||||
phy_vars_ue->pdcch_vars[0][eNB_id]->crnti = phy_vars_ue->pdcch_vars[1][eNB_id]->crnti;
|
||||
else
|
||||
phy_vars_ue->pdcch_vars[1][eNB_id]->crnti = phy_vars_ue->pdcch_vars[0][eNB_id]->crnti;
|
||||
phy_vars_ue->pdcch_vars[1][eNB_id]->crnti = phy_vars_ue->pdcch_vars[0][eNB_id]->crnti;
|
||||
|
||||
LOG_I(PHY,"C-RNTI %x %x \n", phy_vars_ue->pdcch_vars[0][eNB_id]->crnti,
|
||||
phy_vars_ue->pdcch_vars[1][eNB_id]->crnti);
|
||||
phy_vars_ue->pdcch_vars[1][eNB_id]->crnti);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*! \brief Helper function to allocate memory for DLSCH data structures.
|
||||
@@ -608,88 +542,71 @@ void phy_config_dedicated_ue(module_id_t Mod_id,int CC_id,uint8_t eNB_id,
|
||||
* \param[in] frame_parms LTE_DL_FRAME_PARMS structure.
|
||||
* \note This function is optimistic in that it expects malloc() to succeed.
|
||||
*/
|
||||
void phy_init_lte_ue__PDSCH( LTE_UE_PDSCH* const pdsch, const LTE_DL_FRAME_PARMS* const fp )
|
||||
{
|
||||
void phy_init_lte_ue__PDSCH( LTE_UE_PDSCH *const pdsch, const LTE_DL_FRAME_PARMS *const fp ) {
|
||||
AssertFatal( pdsch, "pdsch==0" );
|
||||
|
||||
pdsch->pmi_ext = (uint8_t*)malloc16_clear( fp->N_RB_DL );
|
||||
pdsch->llr[0] = (int16_t*)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
|
||||
pdsch->llr128 = (int16_t**)malloc16_clear( sizeof(int16_t*) );
|
||||
pdsch->pmi_ext = (uint8_t *)malloc16_clear( fp->N_RB_DL );
|
||||
pdsch->llr[0] = (int16_t *)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
|
||||
pdsch->llr128 = (int16_t **)malloc16_clear( sizeof(int16_t *) );
|
||||
// FIXME! no further allocation for (int16_t*)pdsch->llr128 !!! expect SIGSEGV
|
||||
// FK, 11-3-2015: this is only as a temporary pointer, no memory is stored there
|
||||
|
||||
|
||||
pdsch->rxdataF_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
|
||||
pdsch->rxdataF_uespec_pilots = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
|
||||
pdsch->rxdataF_comp0 = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
|
||||
pdsch->rho = (int32_t**)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t*) );
|
||||
pdsch->dl_ch_estimates_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
|
||||
pdsch->dl_bf_ch_estimates = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
|
||||
pdsch->dl_bf_ch_estimates_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
|
||||
pdsch->rxdataF_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
pdsch->rxdataF_uespec_pilots = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
pdsch->rxdataF_comp0 = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
pdsch->rho = (int32_t **)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
pdsch->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
pdsch->dl_bf_ch_estimates = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
pdsch->dl_bf_ch_estimates_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
//pdsch->dl_ch_rho_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
|
||||
//pdsch->dl_ch_rho2_ext = (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_mag0 = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
pdsch->dl_ch_magb0 = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
// the allocated memory size is fixed:
|
||||
AssertFatal( fp->nb_antennas_rx <= 2, "nb_antennas_rx > 2" );
|
||||
|
||||
for (int i=0; i<fp->nb_antennas_rx; i++) {
|
||||
pdsch->rho[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->N_RB_DL*12*7*2) );
|
||||
pdsch->rho[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(fp->N_RB_DL*12*7*2) );
|
||||
|
||||
for (int j=0; j<4; j++) { //fp->nb_antennas_tx; j++)
|
||||
const int idx = (j<<1)+i;
|
||||
const size_t num = 7*2*fp->N_RB_DL*12;
|
||||
pdsch->rxdataF_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
|
||||
pdsch->rxdataF_uespec_pilots[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * fp->N_RB_DL*12);
|
||||
pdsch->rxdataF_comp0[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_bf_ch_estimates[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * fp->ofdm_symbol_size*7*2);
|
||||
pdsch->dl_bf_ch_estimates_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
|
||||
pdsch->rxdataF_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
|
||||
pdsch->rxdataF_uespec_pilots[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * fp->N_RB_DL*12);
|
||||
pdsch->rxdataF_comp0[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_bf_ch_estimates[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * fp->ofdm_symbol_size*7*2);
|
||||
pdsch->dl_bf_ch_estimates_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
|
||||
//pdsch->dl_ch_rho_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
|
||||
//pdsch->dl_ch_rho2_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_magb0[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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int init_lte_ue_signal(PHY_VARS_UE *ue,
|
||||
int nb_connected_eNB,
|
||||
uint8_t abstraction_flag)
|
||||
{
|
||||
|
||||
int nb_connected_eNB,
|
||||
uint8_t abstraction_flag) {
|
||||
// create shortcuts
|
||||
LTE_DL_FRAME_PARMS* const fp = &ue->frame_parms;
|
||||
LTE_UE_COMMON* const common_vars = &ue->common_vars;
|
||||
LTE_UE_PDSCH** const pdsch_vars_SI = ue->pdsch_vars_SI;
|
||||
LTE_UE_PDSCH** const pdsch_vars_ra = ue->pdsch_vars_ra;
|
||||
LTE_UE_PDSCH** const pdsch_vars_p = ue->pdsch_vars_p;
|
||||
LTE_UE_PDSCH** const pdsch_vars_mch = ue->pdsch_vars_MCH;
|
||||
LTE_DL_FRAME_PARMS *const fp = &ue->frame_parms;
|
||||
LTE_UE_COMMON *const common_vars = &ue->common_vars;
|
||||
LTE_UE_PDSCH **const pdsch_vars_SI = ue->pdsch_vars_SI;
|
||||
LTE_UE_PDSCH **const pdsch_vars_ra = ue->pdsch_vars_ra;
|
||||
LTE_UE_PDSCH **const pdsch_vars_p = ue->pdsch_vars_p;
|
||||
LTE_UE_PDSCH **const pdsch_vars_mch = ue->pdsch_vars_MCH;
|
||||
LTE_UE_PDSCH* (*pdsch_vars_th)[][NUMBER_OF_CONNECTED_eNB_MAX+1] = &ue->pdsch_vars;
|
||||
LTE_UE_PDCCH* (*pdcch_vars_th)[][NUMBER_OF_CONNECTED_eNB_MAX] = &ue->pdcch_vars;
|
||||
LTE_UE_PBCH** const pbch_vars = ue->pbch_vars;
|
||||
LTE_UE_PRACH** const prach_vars = ue->prach_vars;
|
||||
|
||||
|
||||
|
||||
LTE_UE_PBCH **const pbch_vars = ue->pbch_vars;
|
||||
LTE_UE_PRACH **const prach_vars = ue->prach_vars;
|
||||
int i,j,k,l;
|
||||
int eNB_id;
|
||||
int th_id;
|
||||
|
||||
LOG_D(PHY,"Initializing UE vars (abstraction %"PRIu8") for eNB TXant %"PRIu8", UE RXant %"PRIu8"\n",abstraction_flag,fp->nb_antennas_tx,fp->nb_antennas_rx);
|
||||
|
||||
|
||||
|
||||
init_dfts();
|
||||
init_frame_parms(&ue->frame_parms,1);
|
||||
lte_sync_time_init(&ue->frame_parms);
|
||||
init_lte_top(&ue->frame_parms);
|
||||
init_7_5KHz();
|
||||
init_ul_hopping(&ue->frame_parms);
|
||||
|
||||
|
||||
// many memory allocation sizes are hard coded
|
||||
AssertFatal( fp->nb_antennas_rx <= 2, "hard coded allocation for ue_common_vars->dl_ch_estimates[eNB_id]" );
|
||||
AssertFatal( ue->n_connected_eNB <= NUMBER_OF_CONNECTED_eNB_MAX, "n_connected_eNB is too large" );
|
||||
@@ -710,49 +627,44 @@ int init_lte_ue_signal(PHY_VARS_UE *ue,
|
||||
ue->total_received_bits[eNB_id] = 0;
|
||||
}
|
||||
|
||||
for (i=0;i<10;i++)
|
||||
for (i=0; i<10; i++)
|
||||
ue->tx_power_dBm[i]=-127;
|
||||
|
||||
|
||||
|
||||
// init TX buffers
|
||||
|
||||
common_vars->txdata = (int32_t**)malloc16( fp->nb_antennas_tx*sizeof(int32_t*) );
|
||||
common_vars->txdataF = (int32_t **)malloc16( fp->nb_antennas_tx*sizeof(int32_t*) );
|
||||
|
||||
common_vars->txdata = (int32_t **)malloc16( fp->nb_antennas_tx*sizeof(int32_t *) );
|
||||
common_vars->txdataF = (int32_t **)malloc16( fp->nb_antennas_tx*sizeof(int32_t *) );
|
||||
|
||||
for (i=0; i<fp->nb_antennas_tx; i++) {
|
||||
|
||||
common_vars->txdata[i] = (int32_t*)malloc16_clear( fp->samples_per_tti*10*sizeof(int32_t) );
|
||||
common_vars->txdata[i] = (int32_t *)malloc16_clear( fp->samples_per_tti*10*sizeof(int32_t) );
|
||||
common_vars->txdataF[i] = (int32_t *)malloc16_clear( fp->ofdm_symbol_size*fp->symbols_per_tti*10*sizeof(int32_t) );
|
||||
}
|
||||
|
||||
// init RX buffers
|
||||
|
||||
common_vars->rxdata = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
|
||||
common_vars->common_vars_rx_data_per_thread[0].rxdataF = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
|
||||
common_vars->common_vars_rx_data_per_thread[1].rxdataF = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
|
||||
|
||||
for (i=0; i<fp->nb_antennas_rx; i++) {
|
||||
common_vars->rxdata[i] = (int32_t*) malloc16_clear( (fp->samples_per_tti*10+2048)*sizeof(int32_t) );
|
||||
LOG_I(PHY,"common_vars->rxdata[%d] %p\n",i,common_vars->rxdata[i]);
|
||||
common_vars->common_vars_rx_data_per_thread[0].rxdataF[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->ofdm_symbol_size*14) );
|
||||
common_vars->common_vars_rx_data_per_thread[1].rxdataF[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->ofdm_symbol_size*14) );
|
||||
}
|
||||
|
||||
// init RX buffers
|
||||
common_vars->rxdata = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
common_vars->common_vars_rx_data_per_thread[0].rxdataF = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
common_vars->common_vars_rx_data_per_thread[1].rxdataF = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
|
||||
for (i=0; i<fp->nb_antennas_rx; i++) {
|
||||
common_vars->rxdata[i] = (int32_t *) malloc16_clear( (fp->samples_per_tti*10+2048)*sizeof(int32_t) );
|
||||
LOG_I(PHY,"common_vars->rxdata[%d] %p\n",i,common_vars->rxdata[i]);
|
||||
common_vars->common_vars_rx_data_per_thread[0].rxdataF[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(fp->ofdm_symbol_size*14) );
|
||||
common_vars->common_vars_rx_data_per_thread[1].rxdataF[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(fp->ofdm_symbol_size*14) );
|
||||
}
|
||||
|
||||
// Channel estimates
|
||||
for (eNB_id=0; eNB_id<7; eNB_id++) {
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
common_vars->common_vars_rx_data_per_thread[th_id].dl_ch_estimates[eNB_id] = (int32_t**)malloc16_clear(8*sizeof(int32_t*));
|
||||
common_vars->common_vars_rx_data_per_thread[th_id].dl_ch_estimates_time[eNB_id] = (int32_t**)malloc16_clear(8*sizeof(int32_t*));
|
||||
common_vars->common_vars_rx_data_per_thread[th_id].dl_ch_estimates[eNB_id] = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
|
||||
common_vars->common_vars_rx_data_per_thread[th_id].dl_ch_estimates_time[eNB_id] = (int32_t **)malloc16_clear(8*sizeof(int32_t *));
|
||||
}
|
||||
|
||||
for (i=0; i<fp->nb_antennas_rx; i++)
|
||||
for (j=0; j<4; j++) {
|
||||
int idx = (j<<1) + i;
|
||||
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
common_vars->common_vars_rx_data_per_thread[th_id].dl_ch_estimates[eNB_id][idx] = (int32_t*)malloc16_clear( sizeof(int32_t)*fp->symbols_per_tti*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH) );
|
||||
common_vars->common_vars_rx_data_per_thread[th_id].dl_ch_estimates_time[eNB_id][idx] = (int32_t*)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size*2 );
|
||||
common_vars->common_vars_rx_data_per_thread[th_id].dl_ch_estimates[eNB_id][idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->symbols_per_tti*(fp->ofdm_symbol_size+LTE_CE_FILTER_LENGTH) );
|
||||
common_vars->common_vars_rx_data_per_thread[th_id].dl_ch_estimates_time[eNB_id][idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*fp->ofdm_symbol_size*2 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -760,11 +672,11 @@ int init_lte_ue_signal(PHY_VARS_UE *ue,
|
||||
// DLSCH
|
||||
for (eNB_id=0; eNB_id<ue->n_connected_eNB; eNB_id++) {
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
(*pdsch_vars_th)[th_id][eNB_id] = (LTE_UE_PDSCH *)malloc16_clear(sizeof(LTE_UE_PDSCH));
|
||||
(*pdsch_vars_th)[th_id][eNB_id] = (LTE_UE_PDSCH *)malloc16_clear(sizeof(LTE_UE_PDSCH));
|
||||
}
|
||||
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
(*pdcch_vars_th)[th_id][eNB_id] = (LTE_UE_PDCCH *)malloc16_clear(sizeof(LTE_UE_PDCCH));
|
||||
(*pdcch_vars_th)[th_id][eNB_id] = (LTE_UE_PDCCH *)malloc16_clear(sizeof(LTE_UE_PDCCH));
|
||||
}
|
||||
|
||||
pdsch_vars_SI[eNB_id] = (LTE_UE_PDSCH *)malloc16_clear(sizeof(LTE_UE_PDSCH));
|
||||
@@ -779,161 +691,159 @@ int init_lte_ue_signal(PHY_VARS_UE *ue,
|
||||
}
|
||||
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->llr_shifts = (uint8_t*)malloc16_clear(7*2*fp->N_RB_DL*12);
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->llr_shifts = (uint8_t *)malloc16_clear(7*2*fp->N_RB_DL*12);
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->llr_shifts_p = (*pdsch_vars_th)[0][eNB_id]->llr_shifts;
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->llr[1] = (int16_t*)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->llr128_2ndstream = (int16_t**)malloc16_clear( sizeof(int16_t*) );
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->rho = (int32_t**)malloc16_clear( fp->nb_antennas_rx*sizeof(int32_t*) );
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->llr[1] = (int16_t *)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->llr128_2ndstream = (int16_t **)malloc16_clear( sizeof(int16_t *) );
|
||||
(*pdsch_vars_th)[th_id][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++) {
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->rho[i] = (int32_t*)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->rho[i] = (int32_t *)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->dl_ch_rho2_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->dl_ch_rho2_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
}
|
||||
|
||||
|
||||
for (i=0; i<fp->nb_antennas_rx; i++)
|
||||
for (j=0; j<4; j++) {
|
||||
const int idx = (j<<1)+i;
|
||||
const size_t num = 7*2*fp->N_RB_DL*12+4;
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->dl_ch_rho2_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
|
||||
}
|
||||
|
||||
const int idx = (j<<1)+i;
|
||||
const size_t num = 7*2*fp->N_RB_DL*12+4;
|
||||
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
(*pdsch_vars_th)[th_id][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;
|
||||
for (k=0;k<8;k++) { //harq_pid
|
||||
for (l=0;l<8;l++) { //round
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->rxdataF_comp1[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->dl_ch_rho_ext[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->dl_ch_mag1[k][l] = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
|
||||
(*pdsch_vars_th)[th_id][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 j=0; j<4; j++) { //frame_parms->nb_antennas_tx; j++)
|
||||
const int idx = (j<<1)+i;
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->dl_ch_rho_ext[k][l][idx] = (int32_t*)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->rxdataF_comp1[k][l][idx] = (int32_t*)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->dl_ch_mag1[k][l][idx] = (int32_t*)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->dl_ch_magb1[k][l][idx] = (int32_t*)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
|
||||
}
|
||||
|
||||
}
|
||||
for (k=0; k<8; k++) { //harq_pid
|
||||
for (l=0; l<8; l++) { //round
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->rxdataF_comp1[k][l] = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->dl_ch_rho_ext[k][l] = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->dl_ch_mag1[k][l] = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
(*pdsch_vars_th)[th_id][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 j=0; j<4; j++) { //frame_parms->nb_antennas_tx; j++)
|
||||
const int idx = (j<<1)+i;
|
||||
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->dl_ch_rho_ext[k][l][idx] = (int32_t *)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->rxdataF_comp1[k][l][idx] = (int32_t *)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->dl_ch_mag1[k][l][idx] = (int32_t *)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->dl_ch_magb1[k][l][idx] = (int32_t *)malloc16_clear( 7*2*sizeof(int32_t)*(fp->N_RB_DL*12) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
phy_init_lte_ue__PDSCH( pdsch_vars_SI[eNB_id], fp );
|
||||
phy_init_lte_ue__PDSCH( pdsch_vars_ra[eNB_id], fp );
|
||||
phy_init_lte_ue__PDSCH( pdsch_vars_p[eNB_id], fp );
|
||||
phy_init_lte_ue__PDSCH( pdsch_vars_mch[eNB_id], fp );
|
||||
|
||||
|
||||
// 100 PRBs * 12 REs/PRB * 4 PDCCH SYMBOLS * 2 LLRs/RE
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->llr = (uint16_t*)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->llr16 = (uint16_t*)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->wbar = (uint16_t*)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->e_rx = (int8_t*)malloc16_clear( 4*2*100*12 );
|
||||
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rxdataF_comp = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->dl_ch_rho_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rho = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rxdataF_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->dl_ch_estimates_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->llr = (uint16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->llr16 = (uint16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->wbar = (uint16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->e_rx = (int8_t *)malloc16_clear( 4*2*100*12 );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->dl_ch_rho_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rho = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rxdataF_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
}
|
||||
|
||||
|
||||
for (i=0; i<fp->nb_antennas_rx; i++) {
|
||||
//ue_pdcch_vars[eNB_id]->rho[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->N_RB_DL*12*7*2) );
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rho[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(100*12*4) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rho[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(100*12*4) );
|
||||
}
|
||||
|
||||
|
||||
for (j=0; j<4; j++) { //fp->nb_antennas_tx; j++)
|
||||
int idx = (j<<1)+i;
|
||||
// size_t num = 7*2*fp->N_RB_DL*12;
|
||||
size_t num = 4*100*12; // 4 symbols, 100 PRBs, 12 REs per PRB
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rxdataF_comp[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->dl_ch_rho_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rxdataF_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->dl_ch_estimates_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
|
||||
}
|
||||
int idx = (j<<1)+i;
|
||||
// size_t num = 7*2*fp->N_RB_DL*12;
|
||||
size_t num = 4*100*12; // 4 symbols, 100 PRBs, 12 REs per PRB
|
||||
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->dl_ch_rho_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rxdataF_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
phy_init_lte_ue__PDSCH( pdsch_vars_SI[eNB_id], fp );
|
||||
phy_init_lte_ue__PDSCH( pdsch_vars_ra[eNB_id], fp );
|
||||
phy_init_lte_ue__PDSCH( pdsch_vars_p[eNB_id], fp );
|
||||
phy_init_lte_ue__PDSCH( pdsch_vars_mch[eNB_id], fp );
|
||||
|
||||
|
||||
// 100 PRBs * 12 REs/PRB * 4 PDCCH SYMBOLS * 2 LLRs/RE
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->llr = (uint16_t*)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->llr16 = (uint16_t*)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->wbar = (uint16_t*)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->e_rx = (int8_t*)malloc16_clear( 4*2*100*12 );
|
||||
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rxdataF_comp = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->dl_ch_rho_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rho = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rxdataF_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->dl_ch_estimates_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
|
||||
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->llr = (uint16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->llr16 = (uint16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->wbar = (uint16_t *)malloc16_clear( 2*4*100*12*sizeof(uint16_t) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->e_rx = (int8_t *)malloc16_clear( 4*2*100*12 );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->dl_ch_rho_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rho = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rxdataF_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->dciFormat = 0;
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->agregationLevel = 0xFF;
|
||||
}
|
||||
|
||||
|
||||
for (i=0; i<fp->nb_antennas_rx; i++) {
|
||||
//ue_pdcch_vars[eNB_id]->rho[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(fp->N_RB_DL*12*7*2) );
|
||||
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rho[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*(100*12*4) );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rho[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*(100*12*4) );
|
||||
}
|
||||
|
||||
|
||||
for (j=0; j<4; j++) { //fp->nb_antennas_tx; j++)
|
||||
int idx = (j<<1)+i;
|
||||
// size_t num = 7*2*fp->N_RB_DL*12;
|
||||
size_t num = 4*100*12; // 4 symbols, 100 PRBs, 12 REs per PRB
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rxdataF_comp[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->dl_ch_rho_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rxdataF_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->dl_ch_estimates_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t) * num );
|
||||
}
|
||||
int idx = (j<<1)+i;
|
||||
// size_t num = 7*2*fp->N_RB_DL*12;
|
||||
size_t num = 4*100*12; // 4 symbols, 100 PRBs, 12 REs per PRB
|
||||
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->dl_ch_rho_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->rxdataF_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
|
||||
(*pdcch_vars_th)[th_id][eNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t) * num );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// PBCH
|
||||
pbch_vars[eNB_id]->rxdataF_ext = (int32_t**)malloc16( fp->nb_antennas_rx*sizeof(int32_t*) );
|
||||
pbch_vars[eNB_id]->rxdataF_comp = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
|
||||
pbch_vars[eNB_id]->dl_ch_estimates_ext = (int32_t**)malloc16_clear( 8*sizeof(int32_t*) );
|
||||
pbch_vars[eNB_id]->llr = (int8_t*)malloc16_clear( 1920 );
|
||||
prach_vars[eNB_id]->prachF = (int16_t*)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
|
||||
prach_vars[eNB_id]->prach = (int16_t*)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
|
||||
|
||||
pbch_vars[eNB_id]->rxdataF_ext = (int32_t **)malloc16( fp->nb_antennas_rx*sizeof(int32_t *) );
|
||||
pbch_vars[eNB_id]->rxdataF_comp = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
pbch_vars[eNB_id]->dl_ch_estimates_ext = (int32_t **)malloc16_clear( 8*sizeof(int32_t *) );
|
||||
pbch_vars[eNB_id]->llr = (int8_t *)malloc16_clear( 1920 );
|
||||
prach_vars[eNB_id]->prachF = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
|
||||
prach_vars[eNB_id]->prach = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
|
||||
|
||||
for (i=0; i<fp->nb_antennas_rx; i++) {
|
||||
pbch_vars[eNB_id]->rxdataF_ext[i] = (int32_t*)malloc16_clear( sizeof(int32_t)*6*12*4 );
|
||||
|
||||
pbch_vars[eNB_id]->rxdataF_ext[i] = (int32_t *)malloc16_clear( sizeof(int32_t)*6*12*4 );
|
||||
|
||||
for (j=0; j<4; j++) {//fp->nb_antennas_tx;j++) {
|
||||
int idx = (j<<1)+i;
|
||||
pbch_vars[eNB_id]->rxdataF_comp[idx] = (int32_t*)malloc16_clear( sizeof(int32_t)*6*12*4 );
|
||||
pbch_vars[eNB_id]->dl_ch_estimates_ext[idx] = (int32_t*)malloc16_clear( sizeof(int32_t)*6*12*4 );
|
||||
int idx = (j<<1)+i;
|
||||
pbch_vars[eNB_id]->rxdataF_comp[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*6*12*4 );
|
||||
pbch_vars[eNB_id]->dl_ch_estimates_ext[idx] = (int32_t *)malloc16_clear( sizeof(int32_t)*6*12*4 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pbch_vars[eNB_id]->decoded_output = (uint8_t*)malloc16_clear( 64 );
|
||||
|
||||
pbch_vars[eNB_id]->decoded_output = (uint8_t *)malloc16_clear( 64 );
|
||||
}
|
||||
|
||||
// initialization for the last instance of pdsch_vars (used for MU-MIMO)
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
(*pdsch_vars_th)[th_id][eNB_id] = (LTE_UE_PDSCH *)malloc16_clear( sizeof(LTE_UE_PDSCH) );
|
||||
(*pdsch_vars_th)[th_id][eNB_id] = (LTE_UE_PDSCH *)malloc16_clear( sizeof(LTE_UE_PDSCH) );
|
||||
}
|
||||
|
||||
pdsch_vars_SI[eNB_id] = (LTE_UE_PDSCH *)malloc16_clear( sizeof(LTE_UE_PDSCH) );
|
||||
@@ -942,13 +852,12 @@ int init_lte_ue_signal(PHY_VARS_UE *ue,
|
||||
|
||||
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
|
||||
phy_init_lte_ue__PDSCH( (*pdsch_vars_th)[th_id][eNB_id], fp );
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->llr[1] = (int16_t*)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
|
||||
(*pdsch_vars_th)[th_id][eNB_id]->llr[1] = (int16_t *)malloc16_clear( (8*((3*8*6144)+12))*sizeof(int16_t) );
|
||||
}
|
||||
|
||||
|
||||
ue->sinr_CQI_dB = (double*) malloc16_clear( fp->N_RB_DL*12*sizeof(double) );
|
||||
|
||||
ue->sinr_CQI_dB = (double *) malloc16_clear( fp->N_RB_DL*12*sizeof(double) );
|
||||
ue->init_averaging = 1;
|
||||
|
||||
// default value until overwritten by RRCConnectionReconfiguration
|
||||
if (fp->nb_antenna_ports_eNB==2)
|
||||
ue->pdsch_config_dedicated->p_a = dBm3;
|
||||
@@ -958,40 +867,30 @@ int init_lte_ue_signal(PHY_VARS_UE *ue,
|
||||
// set channel estimation to do linear interpolation in time
|
||||
ue->high_speed_flag = 1;
|
||||
ue->ch_est_alpha = 24576;
|
||||
|
||||
// enable MIB/SIB decoding by default
|
||||
ue->decode_MIB = 1;
|
||||
ue->decode_SIB = 1;
|
||||
|
||||
init_prach_tables(839);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void init_lte_ue_transport(PHY_VARS_UE *ue,int abstraction_flag) {
|
||||
|
||||
int i,j,k;
|
||||
|
||||
for (i=0; i<NUMBER_OF_CONNECTED_eNB_MAX; i++) {
|
||||
for (j=0; j<2; j++) {
|
||||
for (k=0; k<2; k++) {
|
||||
AssertFatal((ue->dlsch[k][i][j] = new_ue_dlsch(1,NUMBER_OF_HARQ_PID_MAX,NSOFT,MAX_TURBO_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag))!=NULL,"Can't get ue dlsch structures\n");
|
||||
|
||||
LOG_D(PHY,"dlsch[%d][%d][%d] => %p\n",k,i,j,ue->dlsch[i][j]);
|
||||
AssertFatal((ue->dlsch[k][i][j] = new_ue_dlsch(1,NUMBER_OF_HARQ_PID_MAX,NSOFT,MAX_TURBO_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag))!=NULL,"Can't get ue dlsch structures\n");
|
||||
LOG_D(PHY,"dlsch[%d][%d][%d] => %p\n",k,i,j,ue->dlsch[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
AssertFatal((ue->ulsch[i] = new_ue_ulsch(ue->frame_parms.N_RB_UL, abstraction_flag))!=NULL,"Can't get ue ulsch structures\n");
|
||||
|
||||
ue->dlsch_SI[i] = new_ue_dlsch(1,1,NSOFT,MAX_TURBO_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag);
|
||||
ue->dlsch_ra[i] = new_ue_dlsch(1,1,NSOFT,MAX_TURBO_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag);
|
||||
|
||||
ue->transmission_mode[i] = ue->frame_parms.nb_antenna_ports_eNB==1 ? 1 : 2;
|
||||
}
|
||||
|
||||
ue->frame_parms.pucch_config_common.deltaPUCCH_Shift = 1;
|
||||
|
||||
ue->dlsch_MCH[0] = new_ue_dlsch(1,NUMBER_OF_HARQ_PID_MAX,NSOFT,MAX_TURBO_ITERATIONS_MBSFN,ue->frame_parms.N_RB_DL,0);
|
||||
|
||||
}
|
||||
|
||||
@@ -33,31 +33,29 @@
|
||||
#include "phy_init.h"
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
|
||||
|
||||
#include "targets/RT/USER/lte-softmodem.h"
|
||||
extern PHY_VARS_eNB *eNB;
|
||||
extern PHY_VARS_UE *UE;
|
||||
extern RU_t *ru;
|
||||
extern void phy_init_RU(RU_t*);
|
||||
extern void phy_init_RU(RU_t *);
|
||||
|
||||
void lte_param_init(PHY_VARS_eNB **eNBp,
|
||||
PHY_VARS_UE **UEp,
|
||||
RU_t **rup,
|
||||
unsigned char N_tx_port_eNB,
|
||||
PHY_VARS_UE **UEp,
|
||||
RU_t **rup,
|
||||
unsigned char N_tx_port_eNB,
|
||||
unsigned char N_tx_phy,
|
||||
unsigned char N_rx_ru,
|
||||
unsigned char N_rx_ru,
|
||||
unsigned char N_rx_ue,
|
||||
unsigned char transmission_mode,
|
||||
uint8_t extended_prefix_flag,
|
||||
frame_t frame_type,
|
||||
uint16_t Nid_cell,
|
||||
uint8_t tdd_config,
|
||||
uint8_t N_RB_DL,
|
||||
uint8_t pa,
|
||||
uint8_t threequarter_fs,
|
||||
unsigned char transmission_mode,
|
||||
uint8_t extended_prefix_flag,
|
||||
frame_t frame_type,
|
||||
uint16_t Nid_cell,
|
||||
uint8_t tdd_config,
|
||||
uint8_t N_RB_DL,
|
||||
uint8_t pa,
|
||||
uint8_t threequarter_fs,
|
||||
uint8_t osf,
|
||||
uint32_t perfect_ce)
|
||||
{
|
||||
|
||||
uint32_t perfect_ce) {
|
||||
LTE_DL_FRAME_PARMS *frame_parms;
|
||||
int i;
|
||||
PHY_VARS_eNB *eNB;
|
||||
@@ -71,23 +69,16 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
|
||||
UE = *UEp;
|
||||
ru = *rup;
|
||||
printf("eNB %p, UE %p, ru %p\n",eNB,UE,ru);
|
||||
|
||||
|
||||
|
||||
memset((void*)eNB,0,sizeof(PHY_VARS_eNB));
|
||||
memset((void*)UE,0,sizeof(PHY_VARS_UE));
|
||||
memset((void*)ru,0,sizeof(RU_t));
|
||||
|
||||
memset((void *)eNB,0,sizeof(PHY_VARS_eNB));
|
||||
memset((void *)UE,0,sizeof(PHY_VARS_UE));
|
||||
memset((void *)ru,0,sizeof(RU_t));
|
||||
ru->eNB_list[0] = eNB;
|
||||
eNB->RU_list[0] = ru;
|
||||
ru->num_eNB=1;
|
||||
|
||||
srand(0);
|
||||
randominit(0);
|
||||
set_taus_seed(0);
|
||||
|
||||
frame_parms = &(eNB->frame_parms);
|
||||
|
||||
frame_parms->N_RB_DL = N_RB_DL; //50 for 10MHz and 25 for 5 MHz
|
||||
frame_parms->N_RB_UL = N_RB_DL;
|
||||
frame_parms->threequarter_fs = threequarter_fs;
|
||||
@@ -106,13 +97,9 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
|
||||
// frame_parms->Bsrs = 0;
|
||||
// frame_parms->kTC = 0;44
|
||||
// frame_parms->n_RRC = 0;
|
||||
|
||||
init_frame_parms(frame_parms,osf);
|
||||
|
||||
//copy_lte_parms_to_phy_framing(frame_parms, &(PHY_config->PHY_framing));
|
||||
|
||||
// phy_init_top(frame_parms); //allocation
|
||||
|
||||
UE->is_secondary_ue = 0;
|
||||
UE->frame_parms = *frame_parms;
|
||||
UE->frame_parms.nb_antennas_rx=N_rx_ue;
|
||||
@@ -121,14 +108,10 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
|
||||
ru->nb_tx = N_tx_phy;
|
||||
ru->nb_rx = N_rx_ru;
|
||||
ru->if_south = LOCAL_RF;
|
||||
|
||||
eNB->configured=1;
|
||||
|
||||
eNB->transmission_mode[0] = transmission_mode;
|
||||
UE->transmission_mode[0] = transmission_mode;
|
||||
|
||||
dump_frame_parms(frame_parms);
|
||||
|
||||
UE->measurements.n_adj_cells=0;
|
||||
UE->measurements.adj_cell_id[0] = Nid_cell+1;
|
||||
UE->measurements.adj_cell_id[1] = Nid_cell+2;
|
||||
@@ -144,7 +127,6 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
|
||||
phy_init_RU(ru);
|
||||
generate_pcfich_reg_mapping(&UE->frame_parms);
|
||||
generate_phich_reg_mapping(&UE->frame_parms);
|
||||
|
||||
// DL power control init
|
||||
//if (transmission_mode == 1) {
|
||||
UE->pdsch_config_dedicated->p_a = pa;
|
||||
@@ -166,17 +148,13 @@ void lte_param_init(PHY_VARS_eNB **eNBp,
|
||||
if (eNB->frame_parms.N_RB_DL == 100) ru->N_TA_offset = 624;
|
||||
else if (eNB->frame_parms.N_RB_DL == 50) ru->N_TA_offset = 624/2;
|
||||
else if (eNB->frame_parms.N_RB_DL == 25) ru->N_TA_offset = 624/4;
|
||||
}
|
||||
else ru->N_TA_offset=0;
|
||||
} else ru->N_TA_offset=0;
|
||||
|
||||
#if BASIC_SIMULATOR
|
||||
/* this is required for the basic simulator in TDD mode
|
||||
* TODO: find a proper cleaner solution
|
||||
*/
|
||||
UE->N_TA_offset = 0;
|
||||
#endif
|
||||
if (IS_SOFTMODEM_BASICSIM)
|
||||
/* this is required for the basic simulator in TDD mode
|
||||
* TODO: find a proper cleaner solution
|
||||
*/
|
||||
UE->N_TA_offset = 0;
|
||||
|
||||
printf("Done lte_param_init\n");
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -566,6 +566,31 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain
|
||||
|
||||
}
|
||||
|
||||
#ifdef PHY_ABSTRACTION
|
||||
#include "SIMULATION/TOOLS/defs.h"
|
||||
#include "SIMULATION/RF/defs.h"
|
||||
//extern channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX];
|
||||
|
||||
int lte_sync_time_eNB_emul(PHY_VARS_eNB *phy_vars_eNB,
|
||||
uint8_t sect_id,
|
||||
int32_t *sync_val)
|
||||
{
|
||||
|
||||
uint8_t UE_id;
|
||||
uint8_t CC_id = phy_vars_eNB->CC_id;
|
||||
|
||||
LOG_E(PHY,"[PHY] EMUL lte_sync_time_eNB_emul eNB %d, sect_id %d\n",phy_vars_eNB->Mod_id,sect_id);
|
||||
*sync_val = 0;
|
||||
|
||||
for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
|
||||
//LOG_E(PHY,"[PHY] EMUL : eNB %d checking UE %d (PRACH %d) PL %d dB\n",phy_vars_eNB->Mod_id,UE_id,PHY_vars_UE_g[UE_id]->generate_prach,UE2eNB[UE_id][phy_vars_eNB->Mod_id]->path_loss_dB);
|
||||
if ((PHY_vars_UE_g[UE_id][CC_id]->generate_prach == 1) && (phy_vars_eNB->Mod_id == (UE_id % NB_eNB_INST))) {
|
||||
*sync_val = 1;
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
return(-1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *eNB,
|
||||
int32_t temp_in_ifft_0[2048*2] __attribute__((aligned(32)));
|
||||
|
||||
|
||||
#ifdef Rel14
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
if (eNB->ulsch[UE_id]->ue_type > 0) harq_pid = 0;
|
||||
else
|
||||
#endif
|
||||
|
||||
@@ -35,30 +35,22 @@
|
||||
int lte_dl_mbsfn(PHY_VARS_eNB *eNB, int32_t *output,
|
||||
short amp,
|
||||
int subframe,
|
||||
unsigned char l)
|
||||
{
|
||||
|
||||
unsigned char l) {
|
||||
unsigned int mprime,mprime_dword,mprime_qpsk_symb,m;
|
||||
unsigned short k=0,a;
|
||||
int32_t qpsk[4];
|
||||
|
||||
a = (amp*ONE_OVER_SQRT2_Q15)>>15;
|
||||
((short *)&qpsk[0])[0] = a;
|
||||
((short *)&qpsk[0])[1] = a;
|
||||
|
||||
((short *)&qpsk[1])[0] = -a;
|
||||
((short *)&qpsk[1])[1] = a;
|
||||
((short *)&qpsk[2])[0] = a;
|
||||
((short *)&qpsk[2])[1] = -a;
|
||||
|
||||
((short *)&qpsk[3])[0] = -a;
|
||||
((short *)&qpsk[3])[1] = -a;
|
||||
|
||||
|
||||
mprime = 3*(110 - eNB->frame_parms.N_RB_DL);
|
||||
|
||||
for (m=0; m<eNB->frame_parms.N_RB_DL*6; m++) {
|
||||
|
||||
if ((l==0) || (l==2))
|
||||
k = m<<1;
|
||||
else if (l==1)
|
||||
@@ -69,7 +61,6 @@ int lte_dl_mbsfn(PHY_VARS_eNB *eNB, int32_t *output,
|
||||
}
|
||||
|
||||
k+=eNB->frame_parms.first_carrier_offset;
|
||||
|
||||
mprime_dword = mprime>>4;
|
||||
mprime_qpsk_symb = mprime&0xf;
|
||||
|
||||
@@ -80,22 +71,18 @@ int lte_dl_mbsfn(PHY_VARS_eNB *eNB, int32_t *output,
|
||||
|
||||
output[k] = qpsk[(eNB->lte_gold_mbsfn_table[subframe][l][mprime_dword]>>(2*mprime_qpsk_symb))&3];
|
||||
//output[k] = (lte_gold_table[eNB_offset][subframe][l][mprime_dword]>>(2*mprime_qpsk_symb))&3;
|
||||
|
||||
|
||||
#ifdef DEBUG_DL_MBSFN
|
||||
LOG_D(PHY,"subframe %d, l %d, m %d, mprime %d, mprime_dword %d, mprime_qpsk_symbol %d\n",
|
||||
subframe,l,m,mprime,mprime_dword,mprime_qpsk_symb);
|
||||
subframe,l,m,mprime,mprime_dword,mprime_qpsk_symb);
|
||||
LOG_D(PHY,"index = %d (k %d)(%x)\n",(eNB->lte_gold_mbsfn_table[subframe][l][mprime_dword]>>(2*mprime_qpsk_symb))&3,k,eNB->lte_gold_mbsfn_table[subframe][l][mprime_dword]);
|
||||
#endif
|
||||
mprime++;
|
||||
|
||||
#ifdef DEBUG_DL_MBSFN
|
||||
|
||||
if (m<18)
|
||||
printf("subframe %d, l %d output[%d] = (%d,%d)\n",subframe,l,k,((short *)&output[k])[0],((short *)&output[k])[1]);
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
return(0);
|
||||
@@ -106,15 +93,11 @@ int lte_dl_mbsfn(PHY_VARS_eNB *eNB, int32_t *output,
|
||||
int lte_dl_mbsfn_rx(PHY_VARS_UE *ue,
|
||||
int *output,
|
||||
int subframe,
|
||||
unsigned char l)
|
||||
{
|
||||
|
||||
unsigned char l) {
|
||||
unsigned int mprime,mprime_dword,mprime_qpsk_symb,m;
|
||||
unsigned short k=0;
|
||||
unsigned int qpsk[4];
|
||||
|
||||
// This includes complex conjugate for channel estimation
|
||||
|
||||
((short *)&qpsk[0])[0] = ONE_OVER_SQRT2_Q15;
|
||||
((short *)&qpsk[0])[1] = -ONE_OVER_SQRT2_Q15;
|
||||
((short *)&qpsk[1])[0] = -ONE_OVER_SQRT2_Q15;
|
||||
@@ -123,23 +106,18 @@ int lte_dl_mbsfn_rx(PHY_VARS_UE *ue,
|
||||
((short *)&qpsk[2])[1] = ONE_OVER_SQRT2_Q15;
|
||||
((short *)&qpsk[3])[0] = -ONE_OVER_SQRT2_Q15;
|
||||
((short *)&qpsk[3])[1] = ONE_OVER_SQRT2_Q15;
|
||||
|
||||
mprime = 3*(110 - ue->frame_parms.N_RB_DL);
|
||||
|
||||
for (m=0; m<ue->frame_parms.N_RB_DL*6; m++) {
|
||||
|
||||
mprime_dword = mprime>>4;
|
||||
mprime_qpsk_symb = mprime&0xf;
|
||||
|
||||
// this is r_mprime from 3GPP 36-211 6.10.1.2
|
||||
output[k] = qpsk[(ue->lte_gold_mbsfn_table[subframe][l][mprime_dword]>>(2*mprime_qpsk_symb))&3];
|
||||
|
||||
#ifdef DEBUG_DL_MBSFN
|
||||
printf("subframe %d, l %d, m %d, mprime %d, mprime_dword %d, mprime_qpsk_symbol %d\n",
|
||||
printf("subframe %d, l %d, m %u, mprime %u, mprime_dword %u, mprime_qpsk_symbol %u\n",
|
||||
subframe,l,m,mprime, mprime_dword,mprime_qpsk_symb);
|
||||
printf("index = %d (k %d) (%x)\n",(ue->lte_gold_mbsfn_table[subframe][l][mprime_dword]>>(2*mprime_qpsk_symb))&3,k,ue->lte_gold_mbsfn_table[subframe][l][mprime_dword]);
|
||||
#endif
|
||||
|
||||
mprime++;
|
||||
#ifdef DEBUG_DL_MBSFN
|
||||
|
||||
@@ -148,7 +126,6 @@ int lte_dl_mbsfn_rx(PHY_VARS_UE *ue,
|
||||
|
||||
#endif
|
||||
k++;
|
||||
|
||||
}
|
||||
|
||||
return(0);
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
*/
|
||||
|
||||
#ifdef MAIN
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#endif
|
||||
#include "lte_refsig.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
@@ -43,8 +43,7 @@ char ref24[720] = {
|
||||
-1,3,1,-3,3,-1,1,3,-3,3,1,3,-3,3,1,1,-1,1,3,-3,3,-3,-1,-3,-3,3,-3,-3,-3,1,-3,-3,3,-1,1,1,1,3,1,-1,3,-3,-3,1,3,1,1,-3,3,-1,3,3,1,1,-3,3,3,3,3,1,-1,3,-1,1,1,-1,-3,-1,-1,1,3,3,-1,-3,1,1,3,-3,1,1,-3,-1,-1,1,3,1,3,1,-1,3,1,1,-3,-1,-3,-1,-1,-1,-1,-3,-3,-1,1,1,3,3,-1,3,-1,1,-1,-3,1,-1,-3,-3,1,-3,-1,-1,-3,1,1,3,-1,1,3,1,-3,1,-3,1,1,-1,-1,3,-1,-3,3,-3,-3,-3,1,1,1,1,-1,-1,3,-3,-3,3,-3,1,-1,-1,1,-1,1,1,-1,-3,-1,1,-1,3,-1,-3,-3,3,3,-1,-1,-3,-1,3,1,3,1,3,1,1,-1,3,1,-1,1,3,-3,-1,-1,1,-3,1,3,-3,1,-1,-3,3,-3,3,-1,-1,-1,-1,1,-3,-3,-3,1,-3,-3,-3,1,-3,1,1,-3,3,3,-1,-3,-1,3,-3,3,3,3,-1,1,1,-3,1,-1,1,1,-3,1,1,-1,1,-3,-3,3,-1,3,-1,-1,-3,-3,-3,-1,-3,-3,1,-1,1,3,3,-1,1,-1,3,1,3,3,-3,-3,1,3,1,-1,-3,-3,-3,3,3,-3,3,3,-1,-3,3,-1,1,-3,1,1,3,3,1,1,1,-1,-1,1,-3,3,-1,1,1,-3,3,3,-1,-3,3,-3,-1,-3,-1,3,-1,-1,-1,-1,-3,-1,3,3,1,-1,1,3,3,3,-1,1,1,-3,1,3,-1,-3,3,-3,-3,3,1,3,1,-3,3,1,3,1,1,3,3,-1,-1,-3,1,-3,-1,3,1,1,3,-1,-1,1,-3,1,3,-3,1,-1,-3,-1,3,1,3,1,-1,-3,-3,-1,-1,-3,-3,-3,-1,-1,-3,3,-1,-1,-1,-1,1,1,-3,3,1,3,3,1,-1,1,-3,1,-3,1,1,-3,-1,1,3,-1,3,3,-1,-3,1,-1,-3,3,3,3,-1,1,1,3,-1,-3,-1,3,-1,-1,-1,1,1,1,1,1,-1,3,-1,-3,1,1,3,-3,1,-3,-1,1,1,-3,-3,3,1,1,-3,1,3,3,1,-1,-3,3,-1,3,3,3,-3,1,-1,1,-1,-3,-1,1,3,-1,3,-3,-3,-1,-3,3,-3,-3,-3,-1,-1,-3,-1,-3,3,1,3,-3,-1,3,-1,1,-1,3,-3,1,-1,-3,-3,1,1,-1,1,-1,1,-1,3,1,-3,-1,1,-1,1,-1,-1,3,3,-3,-1,1,-3,-3,-1,-3,3,1,-1,-3,-1,-3,-3,3,-3,3,-3,-1,1,3,1,-3,1,3,3,-1,-3,-1,-1,-1,-1,3,3,3,1,3,3,-3,1,3,-1,3,-1,3,3,-3,3,1,-1,3,3,1,-1,3,3,-1,-3,3,-3,-1,-1,3,-1,3,-1,-1,1,1,1,1,-1,-1,-3,-1,3,1,-1,1,-1,3,-1,3,1,1,-1,-1,-3,1,1,-3,1,3,-3,1,1,-3,-3,-1,-1,-3,-1,1,3,1,1,-3,-1,-1,-3,3,-3,3,1,-3,3,-3,1,-1,1,-3,1,1,1,-1,-3,3,3,1,1,3,-1,-3,-1,-1,-1,3,1,-3,-3,-1,3,-3,-1,-3,-1,-3,-1,-1,-3,-1,-1,1,-3,-1,-1,1,-1,-3,1,1,-3,1,-3,-3,3,1,1,-1,3,-1,-1,1,1,-1,-1,-3,-1,3,-1,3,-1,1,3,1,-1,3,1,3,-3,-3,1,-1,-1,1,3
|
||||
};
|
||||
|
||||
void generate_ul_ref_sigs(void)
|
||||
{
|
||||
void generate_ul_ref_sigs(void) {
|
||||
double qbar,phase;
|
||||
unsigned int u,v,Msc_RS,q,m,n;
|
||||
|
||||
@@ -53,7 +52,7 @@ void generate_ul_ref_sigs(void)
|
||||
for (u=0; u<30; u++) {
|
||||
for (v=0; v<2; v++) {
|
||||
qbar = ref_primes[Msc_RS] * (u+1)/(double)31;
|
||||
ul_ref_sigs[u][v][Msc_RS] = (int16_t*)malloc16(2*sizeof(int16_t)*dftsizes[Msc_RS]);
|
||||
ul_ref_sigs[u][v][Msc_RS] = (int16_t *)malloc16(2*sizeof(int16_t)*dftsizes[Msc_RS]);
|
||||
|
||||
if ((((int)floor(2*qbar))&1) == 0)
|
||||
q = (int)(floor(qbar+.5)) - v;
|
||||
@@ -61,7 +60,7 @@ void generate_ul_ref_sigs(void)
|
||||
q = (int)(floor(qbar+.5)) + v;
|
||||
|
||||
#ifdef MAIN
|
||||
printf("Msc_RS %d (%d), u %d, v %d -> q %d (qbar %f)\n",Msc_RS,dftsizes[Msc_RS],u,v,q,qbar);
|
||||
printf("Msc_RS %u (%d), u %u, v %u -> q %u (qbar %f)\n",Msc_RS,dftsizes[Msc_RS],u,v,q,qbar);
|
||||
#endif
|
||||
|
||||
for (n=0; n<dftsizes[Msc_RS]; n++) {
|
||||
@@ -89,32 +88,26 @@ void generate_ul_ref_sigs(void)
|
||||
|
||||
// These are the sequences for RB 1
|
||||
for (u=0; u<30; u++) {
|
||||
ul_ref_sigs[u][0][0] = (int16_t*)malloc16(2*sizeof(int16_t)*dftsizes[0]);
|
||||
ul_ref_sigs[u][0][0] = (int16_t *)malloc16(2*sizeof(int16_t)*dftsizes[0]);
|
||||
|
||||
for (n=0; n<dftsizes[0]; n++) {
|
||||
ul_ref_sigs[u][0][0][n<<1] =(int16_t)(floor(32767*cos(M_PI*ref12[(u*12) + n]/4)));
|
||||
ul_ref_sigs[u][0][0][1+(n<<1)]=(int16_t)(floor(32767*sin(M_PI*ref12[(u*12) + n]/4)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// These are the sequences for RB 2
|
||||
for (u=0; u<30; u++) {
|
||||
ul_ref_sigs[u][0][1] = (int16_t*)malloc16(2*sizeof(int16_t)*dftsizes[1]);
|
||||
ul_ref_sigs[u][0][1] = (int16_t *)malloc16(2*sizeof(int16_t)*dftsizes[1]);
|
||||
|
||||
for (n=0; n<dftsizes[1]; n++) {
|
||||
ul_ref_sigs[u][0][1][n<<1] =(int16_t)(floor(32767*cos(M_PI*ref24[(u*24) + n]/4)));
|
||||
ul_ref_sigs[u][0][1][1+(n<<1)]=(int16_t)(floor(32767*sin(M_PI*ref24[(u*24) + n]/4)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void generate_ul_ref_sigs_rx(void)
|
||||
{
|
||||
void generate_ul_ref_sigs_rx(void) {
|
||||
double qbar,phase;
|
||||
unsigned int u,v,Msc_RS,q,m,n;
|
||||
|
||||
@@ -123,7 +116,7 @@ void generate_ul_ref_sigs_rx(void)
|
||||
for (u=0; u<30; u++) {
|
||||
for (v=0; v<2; v++) {
|
||||
qbar = ref_primes[Msc_RS] * (u+1)/(double)31;
|
||||
ul_ref_sigs_rx[u][v][Msc_RS] = (int16_t*)malloc16(2*sizeof(int16_t)*dftsizes[Msc_RS]);
|
||||
ul_ref_sigs_rx[u][v][Msc_RS] = (int16_t *)malloc16(2*sizeof(int16_t)*dftsizes[Msc_RS]);
|
||||
|
||||
if ((((int)floor(2*qbar))&1) == 0)
|
||||
q = (int)(floor(qbar+.5)) - v;
|
||||
@@ -131,7 +124,7 @@ void generate_ul_ref_sigs_rx(void)
|
||||
q = (int)(floor(qbar+.5)) + v;
|
||||
|
||||
#ifdef MAIN
|
||||
printf("Msc_RS %d (%d), u %d, v %d -> q %d (qbar %f)\n",Msc_RS,dftsizes[Msc_RS],u,v,q,qbar);
|
||||
printf("Msc_RS %u (%d), u %u, v %u -> q %u (qbar %f)\n",Msc_RS,dftsizes[Msc_RS],u,v,q,qbar);
|
||||
#endif
|
||||
|
||||
for (n=0; n<dftsizes[Msc_RS]; n++) {
|
||||
@@ -159,7 +152,7 @@ void generate_ul_ref_sigs_rx(void)
|
||||
|
||||
// These are the sequences for RB 1
|
||||
for (u=0; u<30; u++) {
|
||||
ul_ref_sigs_rx[u][0][0] = (int16_t*)malloc16(2*sizeof(int16_t)*dftsizes[0]);
|
||||
ul_ref_sigs_rx[u][0][0] = (int16_t *)malloc16(2*sizeof(int16_t)*dftsizes[0]);
|
||||
|
||||
for (n=0; n<dftsizes[0]; n++) {
|
||||
ul_ref_sigs_rx[u][0][0][n<<1] = (int16_t)(floor(32767*cos(M_PI*ref12[(u*12) + n]/4)));
|
||||
@@ -169,21 +162,17 @@ void generate_ul_ref_sigs_rx(void)
|
||||
|
||||
// These are the sequences for RB 2
|
||||
for (u=0; u<30; u++) {
|
||||
ul_ref_sigs_rx[u][0][1] = (int16_t*)malloc16(2*sizeof(int16_t)*dftsizes[1]);
|
||||
ul_ref_sigs_rx[u][0][1] = (int16_t *)malloc16(2*sizeof(int16_t)*dftsizes[1]);
|
||||
|
||||
for (n=0; n<dftsizes[1]; n++) {
|
||||
ul_ref_sigs_rx[u][0][1][n<<1] = (int16_t)(floor(32767*cos(M_PI*ref24[(u*24) + n]/4)));
|
||||
ul_ref_sigs_rx[u][0][1][1+(n<<1)]= (int16_t)(floor(32767*sin(M_PI*ref24[(u*24) + n]/4)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void free_ul_ref_sigs(void)
|
||||
{
|
||||
|
||||
void free_ul_ref_sigs(void) {
|
||||
unsigned int u,v,Msc_RS;
|
||||
|
||||
for (Msc_RS=0; Msc_RS<34; Msc_RS++) {
|
||||
@@ -204,9 +193,7 @@ void free_ul_ref_sigs(void)
|
||||
}
|
||||
|
||||
#ifdef MAIN
|
||||
main()
|
||||
{
|
||||
|
||||
main() {
|
||||
generate_ul_ref_sigs();
|
||||
generate_ul_ref_sigs_rx();
|
||||
free_ul_ref_sigs();
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_extern.h"
|
||||
#include "PHY/LTE_REFSIG/lte_refsig.h"
|
||||
|
||||
#include "targets/RT/USER/lte-softmodem.h"
|
||||
//#define DEBUG_DCI_ENCODING 1
|
||||
//#define DEBUG_DCI_DECODING 1
|
||||
//#define DEBUG_PHY
|
||||
@@ -64,63 +64,47 @@ void dci_encoding(uint8_t *a,
|
||||
uint8_t A,
|
||||
uint16_t E,
|
||||
uint8_t *e,
|
||||
uint16_t rnti)
|
||||
{
|
||||
|
||||
|
||||
uint16_t rnti) {
|
||||
uint8_t D = (A + 16);
|
||||
uint32_t RCC;
|
||||
uint8_t d[3*(MAX_DCI_SIZE_BITS + 16) + 96];
|
||||
uint8_t w[3*3*(MAX_DCI_SIZE_BITS+16)];
|
||||
|
||||
#ifdef DEBUG_DCI_ENCODING
|
||||
int32_t i;
|
||||
#endif
|
||||
// encode dci
|
||||
|
||||
#ifdef DEBUG_DCI_ENCODING
|
||||
printf("Doing DCI encoding for %d bits, e %p, rnti %x, E %d\n",A,e,rnti,E);
|
||||
#endif
|
||||
|
||||
// encode dci
|
||||
memset((void *)d,LTE_NULL,96);
|
||||
|
||||
ccodelte_encode(A,2,a,d+96,rnti);
|
||||
|
||||
#ifdef DEBUG_DCI_ENCODING
|
||||
|
||||
for (i=0; i<16+A; i++)
|
||||
printf("%d : (%d,%d,%d)\n",i,*(d+96+(3*i)),*(d+97+(3*i)),*(d+98+(3*i)));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_DCI_ENCODING
|
||||
printf("Doing DCI interleaving for %d coded bits, e %p\n",D*3,e);
|
||||
#endif
|
||||
|
||||
RCC = sub_block_interleaving_cc(D,d+96,w);
|
||||
|
||||
//#ifdef DEBUG_DCI_ENCODING
|
||||
#ifdef DEBUG_DCI_ENCODING
|
||||
if (E>1000) printf("Doing DCI rate matching for %d channel bits, RCC %d, e %p\n",E,RCC,e);
|
||||
//#endif
|
||||
#endif
|
||||
|
||||
lte_rate_matching_cc(RCC,E,w,e);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
uint8_t *generate_dci0(uint8_t *dci,
|
||||
uint8_t *e,
|
||||
uint8_t DCI_LENGTH,
|
||||
uint16_t coded_bits,
|
||||
uint16_t rnti)
|
||||
{
|
||||
|
||||
uint16_t coded_bits,
|
||||
uint16_t rnti) {
|
||||
uint8_t dci_flip[8];
|
||||
#ifdef DEBUG_DCI_ENCODING
|
||||
|
||||
#ifdef DEBUG_DCI_ENCODING
|
||||
for (int i=0;i<1+((DCI_LENGTH+16)/8);i++)
|
||||
for (int i=0; i<1+((DCI_LENGTH+16)/8); i++)
|
||||
printf("i %d : %x\n",i,dci[i]);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
if (DCI_LENGTH<=32) {
|
||||
dci_flip[0] = dci[3];
|
||||
@@ -129,8 +113,7 @@ uint8_t *generate_dci0(uint8_t *dci,
|
||||
dci_flip[3] = dci[0];
|
||||
#ifdef DEBUG_DCI_ENCODING
|
||||
printf("DCI => %x,%x,%x,%x\n",
|
||||
dci_flip[0],dci_flip[1],dci_flip[2],dci_flip[3]);
|
||||
|
||||
dci_flip[0],dci_flip[1],dci_flip[2],dci_flip[3]);
|
||||
#endif
|
||||
} else {
|
||||
dci_flip[0] = dci[7];
|
||||
@@ -143,13 +126,12 @@ uint8_t *generate_dci0(uint8_t *dci,
|
||||
dci_flip[7] = dci[0];
|
||||
#ifdef DEBUG_DCI_ENCODING
|
||||
printf("DCI => %x,%x,%x,%x,%x,%x,%x,%x\n",
|
||||
dci_flip[0],dci_flip[1],dci_flip[2],dci_flip[3],
|
||||
dci_flip[4],dci_flip[5],dci_flip[6],dci_flip[7]);
|
||||
dci_flip[0],dci_flip[1],dci_flip[2],dci_flip[3],
|
||||
dci_flip[4],dci_flip[5],dci_flip[6],dci_flip[7]);
|
||||
#endif
|
||||
}
|
||||
|
||||
dci_encoding(dci_flip,DCI_LENGTH,coded_bits,e,rnti);
|
||||
|
||||
return(e+coded_bits);
|
||||
}
|
||||
|
||||
@@ -160,9 +142,7 @@ uint8_t *generate_dci0(uint8_t *dci,
|
||||
|
||||
|
||||
|
||||
void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **wbar,uint8_t n_symbols_pdcch,uint8_t mi)
|
||||
{
|
||||
|
||||
void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **wbar,uint8_t n_symbols_pdcch,uint8_t mi) {
|
||||
int32_t *wptr,*wptr2,*zptr;
|
||||
uint32_t Mquad = get_nquad(n_symbols_pdcch,frame_parms,mi);
|
||||
uint32_t RCC = (Mquad>>5), ND;
|
||||
@@ -180,7 +160,6 @@ void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **w
|
||||
|
||||
Kpi = (RCC<<5);
|
||||
ND = Kpi - Mquad;
|
||||
|
||||
k=0;
|
||||
|
||||
for (col=0; col<32; col++) {
|
||||
@@ -191,12 +170,9 @@ void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **w
|
||||
if (index>=ND) {
|
||||
for (a=0; a<frame_parms->nb_antenna_ports_eNB; a++) {
|
||||
//printf("a %d k %d\n",a,k);
|
||||
|
||||
wptr = &wtemp[a][k<<2];
|
||||
zptr = &z[a][(index-ND)<<2];
|
||||
|
||||
//printf("wptr=%p, zptr=%p\n",wptr,zptr);
|
||||
|
||||
wptr[0] = zptr[0];
|
||||
wptr[1] = zptr[1];
|
||||
wptr[2] = zptr[2];
|
||||
@@ -212,9 +188,7 @@ void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **w
|
||||
|
||||
// permutation
|
||||
for (i=0; i<Mquad; i++) {
|
||||
|
||||
for (a=0; a<frame_parms->nb_antenna_ports_eNB; a++) {
|
||||
|
||||
//wptr = &wtemp[a][i<<2];
|
||||
//wptr2 = &wbar[a][((i+frame_parms->Nid_cell)%Mquad)<<2];
|
||||
wptr = &wtemp[a][((i+frame_parms->Nid_cell)%Mquad)<<2];
|
||||
@@ -230,17 +204,13 @@ void pdcch_interleaving(LTE_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **w
|
||||
void pdcch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
uint8_t subframe,
|
||||
uint8_t *e,
|
||||
uint32_t length)
|
||||
{
|
||||
uint32_t length) {
|
||||
int i;
|
||||
uint8_t reset;
|
||||
uint32_t x1, x2, s=0;
|
||||
|
||||
//LOG_D(PHY, "%s(fp, subframe:%d, e, length:%d)\n", __FUNCTION__, subframe, length);
|
||||
|
||||
reset = 1;
|
||||
// x1 is set in lte_gold_generic
|
||||
|
||||
x2 = (subframe<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.8.2
|
||||
|
||||
for (i=0; i<length; i++) {
|
||||
@@ -257,16 +227,13 @@ void pdcch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
}
|
||||
|
||||
uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
||||
uint8_t num_dci,
|
||||
uint8_t num_dci,
|
||||
DCI_ALLOC_t *dci_alloc,
|
||||
uint32_t n_rnti,
|
||||
int16_t amp,
|
||||
LTE_DL_FRAME_PARMS *frame_parms,
|
||||
int32_t **txdataF,
|
||||
uint32_t subframe)
|
||||
{
|
||||
|
||||
|
||||
uint32_t subframe) {
|
||||
uint8_t *e_ptr;
|
||||
int8_t L;
|
||||
uint32_t i, lprime;
|
||||
@@ -276,46 +243,42 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
||||
uint8_t e[DCI_BITS_MAX];
|
||||
uint32_t Msymb=(DCI_BITS_MAX/2);
|
||||
int32_t yseq0[Msymb],yseq1[Msymb],wbar0[Msymb],wbar1[Msymb];
|
||||
|
||||
int32_t *y[2];
|
||||
int32_t *wbar[2];
|
||||
|
||||
int nushiftmod3 = frame_parms->nushift%3;
|
||||
|
||||
int Msymb2;
|
||||
int split_flag=0;
|
||||
|
||||
switch (frame_parms->N_RB_DL) {
|
||||
case 100:
|
||||
Msymb2 = Msymb;
|
||||
break;
|
||||
case 100:
|
||||
Msymb2 = Msymb;
|
||||
break;
|
||||
|
||||
case 75:
|
||||
Msymb2 = 3*Msymb/4;
|
||||
break;
|
||||
case 75:
|
||||
Msymb2 = 3*Msymb/4;
|
||||
break;
|
||||
|
||||
case 50:
|
||||
Msymb2 = Msymb>>1;
|
||||
break;
|
||||
case 50:
|
||||
Msymb2 = Msymb>>1;
|
||||
break;
|
||||
|
||||
case 25:
|
||||
Msymb2 = Msymb>>2;
|
||||
break;
|
||||
case 25:
|
||||
Msymb2 = Msymb>>2;
|
||||
break;
|
||||
|
||||
case 15:
|
||||
Msymb2 = Msymb*15/100;
|
||||
break;
|
||||
case 15:
|
||||
Msymb2 = Msymb*15/100;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
Msymb2 = Msymb*6/100;
|
||||
break;
|
||||
case 6:
|
||||
Msymb2 = Msymb*6/100;
|
||||
break;
|
||||
|
||||
default:
|
||||
Msymb2 = Msymb>>2;
|
||||
break;
|
||||
default:
|
||||
Msymb2 = Msymb>>2;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_PCFICH,1);
|
||||
generate_pcfich(num_pdcch_symbols,
|
||||
amp,
|
||||
@@ -328,42 +291,37 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
||||
y[0] = &yseq0[0];
|
||||
y[1] = &yseq1[0];
|
||||
|
||||
#if BASIC_SIMULATOR
|
||||
/* this should be the normal case
|
||||
* but it has to be validated for all the various cases
|
||||
* so let's just do it for the basic simulator
|
||||
*/
|
||||
memset(e, 2, DCI_BITS_MAX);
|
||||
#else
|
||||
#if 1
|
||||
// reset all bits to <NIL>, here we set <NIL> elements as 2
|
||||
// memset(e, 2, DCI_BITS_MAX);
|
||||
// here we interpret NIL as a random QPSK sequence. That makes power estimation easier.
|
||||
for (i=0; i<DCI_BITS_MAX; i++)
|
||||
e[i]=taus()&1;
|
||||
#endif
|
||||
if (IS_SOFTMODEM_BASICSIM) {
|
||||
/* this should be the normal case
|
||||
* but it has to be validated for all the various cases
|
||||
* so let's just do it for the basic simulator
|
||||
*/
|
||||
// memset(e, 2, DCI_BITS_MAX);
|
||||
} else {
|
||||
// reset all bits to <NIL>, here we set <NIL> elements as 2
|
||||
// memset(e, 2, DCI_BITS_MAX);
|
||||
// here we interpret NIL as a random QPSK sequence. That makes power estimation easier.
|
||||
for (i=0; i<DCI_BITS_MAX; i++)
|
||||
e[i]=taus()&1;
|
||||
|
||||
/* clear all bits, the above code may generate too much false detections
|
||||
* (not sure about this, to be checked somehow)
|
||||
*/
|
||||
//memset(e, 0, DCI_BITS_MAX);
|
||||
#endif /* BASIC_SIMULATOR */
|
||||
/* clear all bits, the above code may generate too much false detections
|
||||
* (not sure about this, to be checked somehow)
|
||||
*/
|
||||
//memset(e, 0, DCI_BITS_MAX);
|
||||
}/* BASIC_SIMULATOR */
|
||||
|
||||
e_ptr = e;
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DCI0,1);
|
||||
|
||||
// generate DCIs in order of decreasing aggregation level, then common/ue spec
|
||||
// MAC is assumed to have ordered the UE spec DCI according to the RNTI-based randomization
|
||||
for (L=8; L>=1; L>>=1) {
|
||||
for (i=0; i<num_dci; i++) {
|
||||
|
||||
if (dci_alloc[i].L == (uint8_t)L) {
|
||||
|
||||
LOG_D(PHY,"Generating DCI %d/%d (nCCE %d) of length %d, aggregation %d (%x), rnti %x\n",
|
||||
i,num_dci,dci_alloc[i].firstCCE,dci_alloc[i].dci_length,dci_alloc[i].L,
|
||||
*(unsigned int*)dci_alloc[i].dci_pdu,
|
||||
dci_alloc[i].rnti);
|
||||
*(unsigned int *)dci_alloc[i].dci_pdu,
|
||||
dci_alloc[i].rnti);
|
||||
|
||||
if (dci_alloc[i].firstCCE>=0) {
|
||||
e_ptr = generate_dci0(dci_alloc[i].dci_pdu,
|
||||
@@ -375,14 +333,13 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
||||
}
|
||||
}
|
||||
}
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DCI0,0);
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DCI0,0);
|
||||
// Scrambling
|
||||
#ifdef DEBUG_DCI_ENCODING
|
||||
printf("pdcch scrambling\n");
|
||||
#endif
|
||||
//LOG_D(PHY, "num_pdcch_symbols:%d mi:%d nquad:%d\n", num_pdcch_symbols, mi, get_nquad(num_pdcch_symbols, frame_parms, mi));
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_SCRAMBLING,1);
|
||||
pdcch_scrambling(frame_parms,
|
||||
subframe,
|
||||
@@ -390,11 +347,8 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
||||
8*get_nquad(num_pdcch_symbols, frame_parms, mi));
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_SCRAMBLING,0);
|
||||
//72*get_nCCE(num_pdcch_symbols,frame_parms,mi));
|
||||
|
||||
|
||||
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_MODULATION,1);
|
||||
|
||||
// Now do modulation
|
||||
if (frame_parms->nb_antenna_ports_eNB==1)
|
||||
gain_lin_QPSK = (int16_t)((amp*ONE_OVER_SQRT2_Q15)>>15);
|
||||
@@ -402,7 +356,6 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
||||
gain_lin_QPSK = amp/2;
|
||||
|
||||
e_ptr = e;
|
||||
|
||||
#ifdef DEBUG_DCI_ENCODING
|
||||
printf(" PDCCH Modulation, Msymb %d, Msymb2 %d,gain_lin_QPSK %d\n",Msymb,Msymb2,gain_lin_QPSK);
|
||||
#endif
|
||||
@@ -410,91 +363,73 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
||||
//LOG_D(PHY,"%s() Msymb2:%d\n", __FUNCTION__, Msymb2);
|
||||
|
||||
if (frame_parms->nb_antenna_ports_eNB==1) { //SISO
|
||||
|
||||
|
||||
for (i=0; i<Msymb2; i++) {
|
||||
|
||||
//((int16_t*)(&(y[0][i])))[0] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||
//((int16_t*)(&(y[1][i])))[0] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||
((int16_t*)(&(y[0][i])))[0] = (*e_ptr == 2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||
((int16_t*)(&(y[1][i])))[0] = (*e_ptr == 2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||
((int16_t *)(&(y[0][i])))[0] = (*e_ptr == 2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||
((int16_t *)(&(y[1][i])))[0] = (*e_ptr == 2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||
e_ptr++;
|
||||
//((int16_t*)(&(y[0][i])))[1] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||
//((int16_t*)(&(y[1][i])))[1] = (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||
((int16_t*)(&(y[0][i])))[1] = (*e_ptr == 2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||
((int16_t*)(&(y[1][i])))[1] = (*e_ptr == 2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||
|
||||
((int16_t *)(&(y[0][i])))[1] = (*e_ptr == 2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||
((int16_t *)(&(y[1][i])))[1] = (*e_ptr == 2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||
e_ptr++;
|
||||
}
|
||||
} else { //ALAMOUTI
|
||||
|
||||
|
||||
for (i=0; i<Msymb2; i+=2) {
|
||||
|
||||
#ifdef DEBUG_DCI_ENCODING
|
||||
printf(" PDCCH Modulation (TX diversity): REG %d\n",i>>2);
|
||||
#endif
|
||||
// first antenna position n -> x0
|
||||
((int16_t*)&y[0][i])[0] = (*e_ptr==2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||
((int16_t *)&y[0][i])[0] = (*e_ptr==2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||
e_ptr++;
|
||||
((int16_t*)&y[0][i])[1] = (*e_ptr==2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||
((int16_t *)&y[0][i])[1] = (*e_ptr==2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||
e_ptr++;
|
||||
|
||||
// second antenna position n -> -x1*
|
||||
((int16_t*)&y[1][i])[0] = (*e_ptr==2) ? 0 : (*e_ptr == 1) ? gain_lin_QPSK : -gain_lin_QPSK;
|
||||
((int16_t *)&y[1][i])[0] = (*e_ptr==2) ? 0 : (*e_ptr == 1) ? gain_lin_QPSK : -gain_lin_QPSK;
|
||||
e_ptr++;
|
||||
((int16_t*)&y[1][i])[1] = (*e_ptr==2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||
((int16_t *)&y[1][i])[1] = (*e_ptr==2) ? 0 : (*e_ptr == 1) ? -gain_lin_QPSK : gain_lin_QPSK;
|
||||
e_ptr++;
|
||||
|
||||
// fill in the rest of the ALAMOUTI precoding
|
||||
((int16_t*)&y[0][i+1])[0] = -((int16_t*)&y[1][i])[0];
|
||||
((int16_t*)&y[0][i+1])[1] = ((int16_t*)&y[1][i])[1];
|
||||
((int16_t*)&y[1][i+1])[0] = ((int16_t*)&y[0][i])[0];
|
||||
((int16_t*)&y[1][i+1])[1] = -((int16_t*)&y[0][i])[1];
|
||||
|
||||
((int16_t *)&y[0][i+1])[0] = -((int16_t *)&y[1][i])[0];
|
||||
((int16_t *)&y[0][i+1])[1] = ((int16_t *)&y[1][i])[1];
|
||||
((int16_t *)&y[1][i+1])[0] = ((int16_t *)&y[0][i])[0];
|
||||
((int16_t *)&y[1][i+1])[1] = -((int16_t *)&y[0][i])[1];
|
||||
}
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_MODULATION,0);
|
||||
|
||||
|
||||
#ifdef DEBUG_DCI_ENCODING
|
||||
printf(" PDCCH Interleaving\n");
|
||||
#endif
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_INTERLEAVING,1);
|
||||
// printf("y %p (%p,%p), wbar %p (%p,%p)\n",y,y[0],y[1],wbar,wbar[0],wbar[1]);
|
||||
// This is the interleaving procedure defined in 36-211, first part of Section 6.8.5
|
||||
pdcch_interleaving(frame_parms,&y[0],&wbar[0],num_pdcch_symbols,mi);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_INTERLEAVING,0);
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_TX,1);
|
||||
mprime=0;
|
||||
nsymb = (frame_parms->Ncp==0) ? 14:12;
|
||||
re_offset = frame_parms->first_carrier_offset;
|
||||
|
||||
// This is the REG allocation algorithm from 36-211, second part of Section 6.8.5
|
||||
// printf("DCI (SF %d) : txdataF %p (0 %p)\n",subframe,&txdataF[0][512*14*subframe],&txdataF[0][0]);
|
||||
#ifdef DEBUG_DCI_ENCODING
|
||||
printf("kprime loop - N_RB_DL:%d lprime:num_pdcch_symbols:%d Ncp:%d pcfich:%02x,%02x,%02x,%02x ofdm_symbol_size:%d first_carrier_offset:%d nb_antenna_ports_eNB:%d\n",
|
||||
frame_parms->N_RB_DL, num_pdcch_symbols,frame_parms->Ncp,
|
||||
frame_parms->pcfich_reg[0],
|
||||
frame_parms->pcfich_reg[1],
|
||||
frame_parms->pcfich_reg[2],
|
||||
frame_parms->pcfich_reg[3],
|
||||
frame_parms->ofdm_symbol_size,
|
||||
frame_parms->first_carrier_offset,
|
||||
frame_parms->nb_antenna_ports_eNB
|
||||
);
|
||||
frame_parms->N_RB_DL, num_pdcch_symbols,frame_parms->Ncp,
|
||||
frame_parms->pcfich_reg[0],
|
||||
frame_parms->pcfich_reg[1],
|
||||
frame_parms->pcfich_reg[2],
|
||||
frame_parms->pcfich_reg[3],
|
||||
frame_parms->ofdm_symbol_size,
|
||||
frame_parms->first_carrier_offset,
|
||||
frame_parms->nb_antenna_ports_eNB
|
||||
);
|
||||
#endif
|
||||
|
||||
for (kprime=0; kprime<frame_parms->N_RB_DL*12; kprime++) {
|
||||
for (lprime=0; lprime<num_pdcch_symbols; lprime++) {
|
||||
|
||||
symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(lprime+(subframe*nsymb));
|
||||
|
||||
|
||||
|
||||
tti_offset = symbol_offset + re_offset;
|
||||
|
||||
(re_offset==(frame_parms->ofdm_symbol_size-2)) ? (split_flag=1) : (split_flag=0);
|
||||
|
||||
// printf("kprime %d, lprime %d => REG %d (symbol %d)\n",kprime,lprime,(lprime==0)?(kprime/6) : (kprime>>2),symbol_offset);
|
||||
@@ -505,16 +440,13 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
||||
#endif
|
||||
} else {
|
||||
// Copy REG to TX buffer
|
||||
|
||||
if ((lprime == 0)||
|
||||
((lprime==1)&&(frame_parms->nb_antenna_ports_eNB == 4))) {
|
||||
// first symbol, or second symbol+4 TX antennas skip pilots
|
||||
|
||||
kprime_mod12 = kprime%12;
|
||||
|
||||
if ((kprime_mod12 == 0) || (kprime_mod12 == 6)) {
|
||||
// kprime represents REG
|
||||
|
||||
for (i=0; i<6; i++) {
|
||||
if ((i!=(nushiftmod3))&&(i!=(nushiftmod3+3))) {
|
||||
txdataF[0][tti_offset+i] = wbar[0][mprime];
|
||||
@@ -523,9 +455,8 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
||||
txdataF[1][tti_offset+i] = wbar[1][mprime];
|
||||
|
||||
#ifdef DEBUG_DCI_ENCODING
|
||||
printf(" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset+i,*(short*)&wbar[0][mprime],*(1+(short*)&wbar[0][mprime]));
|
||||
printf(" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset+i,*(short *)&wbar[0][mprime],*(1+(short *)&wbar[0][mprime]));
|
||||
#endif
|
||||
|
||||
mprime++;
|
||||
}
|
||||
}
|
||||
@@ -543,7 +474,7 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
||||
txdataF[1][tti_offset+i] = wbar[1][mprime];
|
||||
|
||||
#ifdef DEBUG_DCI_ENCODING
|
||||
LOG_I(PHY," PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset+i,*(short*)&wbar[0][mprime],*(1+(short*)&wbar[0][mprime]));
|
||||
LOG_I(PHY," PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset+i,*(short *)&wbar[0][mprime],*(1+(short *)&wbar[0][mprime]));
|
||||
#endif
|
||||
mprime++;
|
||||
}
|
||||
@@ -554,7 +485,7 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
||||
txdataF[1][tti_offset+0] = wbar[1][mprime];
|
||||
|
||||
#ifdef DEBUG_DCI_ENCODING
|
||||
printf(" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset,*(short*)&wbar[0][mprime],*(1+(short*)&wbar[0][mprime]));
|
||||
printf(" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset,*(short *)&wbar[0][mprime],*(1+(short *)&wbar[0][mprime]));
|
||||
#endif
|
||||
mprime++;
|
||||
txdataF[0][tti_offset+1] = wbar[0][mprime];
|
||||
@@ -563,7 +494,7 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
||||
txdataF[1][tti_offset+1] = wbar[1][mprime];
|
||||
|
||||
#ifdef DEBUG_DCI_ENCODING
|
||||
printf("PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset+1,*(short*)&wbar[0][mprime],*(1+(short*)&wbar[0][mprime]));
|
||||
printf("PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset+1,*(short *)&wbar[0][mprime],*(1+(short *)&wbar[0][mprime]));
|
||||
#endif
|
||||
mprime++;
|
||||
txdataF[0][tti_offset-frame_parms->ofdm_symbol_size+3] = wbar[0][mprime];
|
||||
@@ -572,8 +503,8 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
||||
txdataF[1][tti_offset-frame_parms->ofdm_symbol_size+3] = wbar[1][mprime];
|
||||
|
||||
#ifdef DEBUG_DCI_ENCODING
|
||||
printf(" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset-frame_parms->ofdm_symbol_size+3,*(short*)&wbar[0][mprime],
|
||||
*(1+(short*)&wbar[0][mprime]));
|
||||
printf(" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset-frame_parms->ofdm_symbol_size+3,*(short *)&wbar[0][mprime],
|
||||
*(1+(short *)&wbar[0][mprime]));
|
||||
#endif
|
||||
mprime++;
|
||||
txdataF[0][tti_offset-frame_parms->ofdm_symbol_size+4] = wbar[0][mprime];
|
||||
@@ -582,11 +513,10 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
||||
txdataF[1][tti_offset-frame_parms->ofdm_symbol_size+4] = wbar[1][mprime];
|
||||
|
||||
#ifdef DEBUG_DCI_ENCODING
|
||||
printf(" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset-frame_parms->ofdm_symbol_size+4,*(short*)&wbar[0][mprime],
|
||||
*(1+(short*)&wbar[0][mprime]));
|
||||
printf(" PDCCH mapping mprime %d => %d (symbol %d re %d) -> (%d,%d)\n",mprime,tti_offset,symbol_offset,re_offset-frame_parms->ofdm_symbol_size+4,*(short *)&wbar[0][mprime],
|
||||
*(1+(short *)&wbar[0][mprime]));
|
||||
#endif
|
||||
mprime++;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -594,7 +524,6 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
||||
if (mprime>=Msymb2)
|
||||
return(num_pdcch_symbols);
|
||||
} // check_phich_reg
|
||||
|
||||
} //lprime loop
|
||||
|
||||
re_offset++;
|
||||
@@ -602,8 +531,8 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
|
||||
if (re_offset == (frame_parms->ofdm_symbol_size))
|
||||
re_offset = 1;
|
||||
} // kprime loop
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_TX,0);
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCCH_TX,0);
|
||||
return(num_pdcch_symbols);
|
||||
}
|
||||
|
||||
|
||||
@@ -300,7 +300,8 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
|
||||
dlsch0 = eNB->dlsch[UE_id][0];
|
||||
dlsch1 = eNB->dlsch[UE_id][1];
|
||||
|
||||
|
||||
dlsch0->ue_type = 0;
|
||||
dlsch1->ue_type = 0;
|
||||
beamforming_mode = eNB->transmission_mode[(uint8_t)UE_id]<7?0:eNB->transmission_mode[(uint8_t)UE_id];
|
||||
dlsch0_harq = dlsch0->harq_processes[rel8->harq_process];
|
||||
dlsch0_harq->codeword = 0;
|
||||
@@ -351,7 +352,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
|
||||
&rel8->resource_block_coding,rel8->resource_block_coding,rel8->rnti,rel8->rnti_type,rel8->dci_format,rel8->harq_process);
|
||||
|
||||
dci_alloc->format = format1A;
|
||||
|
||||
|
||||
switch (fp->N_RB_DL) {
|
||||
case 6:
|
||||
if (fp->frame_type == TDD) {
|
||||
@@ -527,7 +528,7 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t
|
||||
|
||||
dlsch0->harq_mask |= (1 << rel8->harq_process);
|
||||
|
||||
if (rel8->rnti_type == 1) LOG_I(PHY,"DCI 1A: round %d, mcs %d, rballoc %x, rv %d, rnti %x, harq process %d\n",dlsch0_harq->round,rel8->mcs_1,rel8->resource_block_coding,rel8->redundancy_version_1,rel8->rnti,rel8->harq_process);
|
||||
if (rel8->rnti_type == 1) LOG_D(PHY,"DCI 1A: round %d, mcs %d, TBS %d, rballoc %x, rv %d, rnti %x, harq process %d\n",dlsch0_harq->round,rel8->mcs_1,dlsch0_harq->TBS,rel8->resource_block_coding,rel8->redundancy_version_1,rel8->rnti,rel8->harq_process);
|
||||
|
||||
break;
|
||||
case NFAPI_DL_DCI_FORMAT_1:
|
||||
@@ -1559,7 +1560,6 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc
|
||||
|
||||
case 10: // Format 6-1A
|
||||
dci_alloc->format = format6_1A;
|
||||
dlsch0->active = 1;
|
||||
switch (fp->N_RB_DL) {
|
||||
|
||||
case 25:
|
||||
@@ -1594,7 +1594,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc
|
||||
((DCI6_1A_10MHz_t *) dci_pdu)->harq_ack_off = rel13->harq_resource_offset;
|
||||
((DCI6_1A_10MHz_t *) dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number;
|
||||
|
||||
LOG_I(PHY,"Frame %d, Subframe %d : Programming Format 6-1A DCI, type %d, hopping %d, narrowband %d, rballoc %x, mcs %d, rep %d, harq_pid %d, ndi %d, rv %d, TPC %d, srs_req %d, harq_ack_off %d, dci_rep r%d => %x\n",
|
||||
LOG_D(PHY,"Frame %d, Subframe %d : Programming Format 6-1A DCI, type %d, hopping %d, narrowband %d, rballoc %x, mcs %d, rep %d, harq_pid %d, ndi %d, rv %d, TPC %d, srs_req %d, harq_ack_off %d, dci_rep r%d => %x\n",
|
||||
frame,subframe,
|
||||
((DCI6_1A_10MHz_t *) dci_pdu)->type,
|
||||
((DCI6_1A_10MHz_t *) dci_pdu)->hopping,
|
||||
@@ -1630,7 +1630,6 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc
|
||||
break;
|
||||
case 11: // Format 6-1B
|
||||
dci_alloc->format = format6_1B;
|
||||
dlsch0->active = 1;
|
||||
switch (fp->N_RB_DL) {
|
||||
|
||||
case 25:
|
||||
@@ -1670,7 +1669,6 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc
|
||||
}
|
||||
case 12: // Format 6-2
|
||||
dci_alloc->format = format6_2;
|
||||
dlsch0->active = 1;
|
||||
switch (fp->N_RB_DL) {
|
||||
case 25:
|
||||
dci_alloc->dci_length = sizeof_DCI6_2_5MHz_t;
|
||||
@@ -1719,15 +1717,17 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc
|
||||
}
|
||||
AssertFatal (rel13->harq_process < 8, "ERROR: Format 6_1A: harq_pid=%d >= 8\n", rel13->harq_process);
|
||||
|
||||
dlsch0->ue_type = rel13->ce_mode;
|
||||
|
||||
dlsch0_harq = dlsch0->harq_processes[rel13->harq_process];
|
||||
dlsch0_harq->codeword = 0;
|
||||
|
||||
// printf("DCI: Setting subframe_tx for subframe %d\n",subframe);
|
||||
dlsch0->subframe_tx[(subframe + 2) % 10] = 1;
|
||||
LOG_I(PHY,"PDSCH : resource_block_coding %x\n",rel13->resource_block_coding);
|
||||
LOG_D(PHY,"PDSCH : resource_block_coding %x\n",rel13->resource_block_coding);
|
||||
|
||||
conv_eMTC_rballoc (rel13->resource_block_coding,
|
||||
fp->N_RB_DL,
|
||||
conv_eMTC_rballoc (rel13->resource_block_coding,
|
||||
fp->N_RB_DL,
|
||||
dlsch0_harq->rb_alloc);
|
||||
|
||||
dlsch0_harq->nb_rb = RIV2nb_rb_LUT6[rel13->resource_block_coding & 31]; // this is the 6PRB RIV
|
||||
@@ -1750,6 +1750,7 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc
|
||||
if (dlsch0->rnti != rel13->rnti) { // if rnti of dlsch is not the same as in the config, this is a new entry
|
||||
dlsch0_harq->round = 0;
|
||||
dlsch0->harq_mask =0;
|
||||
printf("*********************** rnti %x => %x, pos %d\n",rel13->rnti,dlsch0->rnti,UE_id);
|
||||
}
|
||||
if ((dlsch0->harq_mask & (1 << rel13->harq_process)) > 0) {
|
||||
if ((rel13->new_data_indicator != dlsch0_harq->ndi)||(dci_alloc->ra_flag==1))
|
||||
@@ -1767,8 +1768,9 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc
|
||||
else if (rel13->tpc == 0) //N1A_PRB=2, get TBS from table using mcs and nb_rb=2
|
||||
dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][1];
|
||||
else if (rel13->tpc == 1) //N1A_PRB=3, get TBS from table using mcs and nb_rb=3
|
||||
dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][2];
|
||||
LOG_I(PHY,"TBS = %d(%d)\n",dlsch0_harq->TBS,dlsch0_harq->mcs);
|
||||
dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][2];
|
||||
else AssertFatal(1==0,"Don't know how to set TBS (TPC %d)\n",rel13->tpc);
|
||||
LOG_D(PHY,"fill_mdci_and_dlsch : TBS = %d(%d) %p, %x\n",dlsch0_harq->TBS,dlsch0_harq->mcs,dlsch0,rel13->rnti);
|
||||
}
|
||||
dlsch0->active = 1;
|
||||
dlsch0->harq_mask |= (1 << rel13->harq_process);
|
||||
@@ -1776,11 +1778,11 @@ void fill_mdci_and_dlsch(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc,mDCI_ALLOC_t *dc
|
||||
dlsch0_harq->frame = (subframe >= 8) ? ((frame + 1) & 1023) : frame;
|
||||
dlsch0_harq->subframe = (subframe + 2) % 10;
|
||||
|
||||
LOG_I(PHY,"Setting DLSCH harq_ids[%d] to %d\n",dlsch0_harq->subframe,dlsch0->harq_ids[frame%2][dlsch0_harq->subframe]);
|
||||
dlsch0->harq_ids[frame%2][dlsch0_harq->subframe] = rel13->harq_process;
|
||||
LOG_D(PHY,"Setting DLSCH UEid %d harq_ids[%d] from %d to %d\n",UE_id,dlsch0_harq->subframe,dlsch0->harq_ids[frame%2][dlsch0_harq->subframe],rel13->harq_process);
|
||||
dlsch0->harq_ids[dlsch0_harq->frame%2][dlsch0_harq->subframe] = rel13->harq_process;
|
||||
dlsch0_harq->pdsch_start = rel13->start_symbol;
|
||||
|
||||
LOG_I(PHY,"Setting DLSCH harq %d round %d to active for %d.%d\n",rel13->harq_process,dlsch0_harq->round,dlsch0_harq->frame,dlsch0_harq->subframe);
|
||||
LOG_D(PHY,"Setting DLSCH harq %d round %d to active for %d.%d\n",rel13->harq_process,dlsch0_harq->round,dlsch0_harq->frame,dlsch0_harq->subframe);
|
||||
|
||||
dlsch0->rnti = rel13->rnti;
|
||||
|
||||
@@ -1968,7 +1970,7 @@ void fill_dci0(PHY_VARS_eNB *eNB,int frame,int subframe,L1_rxtx_proc_t *proc,
|
||||
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
int get_narrowband_index(int N_RB_UL,int rb) {
|
||||
|
||||
|
||||
switch (N_RB_UL) {
|
||||
case 6: // 6 PRBs, N_NB=1, i_0=0
|
||||
case 25: // 25 PRBs, N_NB=4, i_0=0
|
||||
@@ -2011,6 +2013,7 @@ void fill_ulsch(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_ulsch_pdu *ulsch_pdu
|
||||
ulsch->harq_mask |= 1 << harq_pid;
|
||||
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
LOG_D(PHY,"Filling ULSCH : ue_type %d, harq_pid %d\n",ulsch->ue_type,harq_pid);
|
||||
ulsch->ue_type = ulsch_pdu->ulsch_pdu_rel13.ue_type;
|
||||
AssertFatal(harq_pid ==0 || ulsch->ue_type == NOCE, "Harq PID is not zero for BL/CE UE\n");
|
||||
|
||||
@@ -2115,7 +2118,7 @@ void fill_ulsch(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_ulsch_pdu *ulsch_pdu
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
|
||||
int get_first_rb_in_narrowband(int N_RB_UL,int rb) {
|
||||
|
||||
|
||||
switch (N_RB_UL) {
|
||||
case 6: // 6 PRBs, N_NB=1, i_0=0
|
||||
case 25: // 25 PRBs, N_NB=4, i_0=0
|
||||
@@ -2236,7 +2239,7 @@ void fill_mpdcch_dci0 (PHY_VARS_eNB * eNB, L1_rxtx_proc_t * proc, mDCI_ALLOC_t *
|
||||
((DCI6_0A_10MHz_t *) dci_pdu)->csi_req = cqi_req;
|
||||
((DCI6_0A_10MHz_t *) dci_pdu)->srs_req = rel13->srs_request;
|
||||
((DCI6_0A_10MHz_t *) dci_pdu)->dci_rep = rel13->dci_subframe_repetition_number;
|
||||
LOG_I(PHY,"Frame %d, Subframe %d : Programming Format 6-0A DCI, type %d, hopping %d, narrowband %d, rballoc %x, mcs %d, rep %d, harq_pid %d, ndi %d, rv %d, TPC %d, csi_req %d, srs_req %d, dci_rep r%d => %x\n",
|
||||
LOG_D(PHY,"Frame %d, Subframe %d : Programming Format 6-0A DCI, type %d, hopping %d, narrowband %d, rballoc %x, mcs %d, rep %d, harq_pid %d, ndi %d, rv %d, TPC %d, csi_req %d, srs_req %d, dci_rep r%d => %x\n",
|
||||
proc->frame_tx,proc->subframe_tx,
|
||||
((DCI6_0A_10MHz_t *) dci_pdu)->type,
|
||||
((DCI6_0A_10MHz_t *) dci_pdu)->hopping,
|
||||
@@ -2287,6 +2290,3 @@ void fill_mpdcch_dci0 (PHY_VARS_eNB * eNB, L1_rxtx_proc_t * proc, mDCI_ALLOC_t *
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -367,11 +367,11 @@ void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t
|
||||
if ((rb_alloc&(1<<i)) != 0)
|
||||
rb_alloc2[(3*(16-i))>>5] |= (7<<((3*(16-i))%32));
|
||||
}
|
||||
|
||||
|
||||
// bit mask across
|
||||
if ((rb_alloc2[0]>>31)==1)
|
||||
rb_alloc2[1] |= 1;
|
||||
|
||||
|
||||
if ((rb_alloc&1) != 0)
|
||||
rb_alloc2[1] |= (3<<16);
|
||||
}
|
||||
@@ -385,7 +385,7 @@ void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t
|
||||
for (i=0; i<25; i++) {
|
||||
if ((rb_alloc&(1<<(24-i))) != 0)
|
||||
rb_alloc2[(4*i)>>5] |= (0xf<<((4*i)%32));
|
||||
|
||||
|
||||
// printf("rb_alloc2[%d] (type 0) %x (%d)\n",(4*i)>>5,rb_alloc2[(4*i)>>5],rb_alloc&(1<<i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,71 +53,73 @@
|
||||
*/
|
||||
#define is_not_pilot(pilots,first_pilot,re) (1)
|
||||
/*extern void thread_top_init(char *thread_name,
|
||||
int affinity,
|
||||
uint64_t runtime,
|
||||
uint64_t deadline,
|
||||
uint64_t period);*/
|
||||
int affinity,
|
||||
uint64_t runtime,
|
||||
uint64_t deadline,
|
||||
uint64_t period);*/
|
||||
extern WORKER_CONF_t get_thread_worker_conf(void);
|
||||
|
||||
|
||||
void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch)
|
||||
{
|
||||
void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch) {
|
||||
int i, r, aa, layer;
|
||||
|
||||
if (dlsch) {
|
||||
for (layer=0; layer<4; layer++) {
|
||||
for (aa=0; aa<64; aa++) free16(dlsch->ue_spec_bf_weights[layer][aa], OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
|
||||
free16(dlsch->ue_spec_bf_weights[layer], 64*sizeof(int32_t*));
|
||||
|
||||
free16(dlsch->ue_spec_bf_weights[layer], 64*sizeof(int32_t *));
|
||||
}
|
||||
|
||||
for (i=0; i<dlsch->Mdlharq; i++) {
|
||||
if (dlsch->harq_processes[i]) {
|
||||
if (dlsch->harq_processes[i]->b) {
|
||||
free16(dlsch->harq_processes[i]->b,MAX_DLSCH_PAYLOAD_BYTES);
|
||||
dlsch->harq_processes[i]->b = NULL;
|
||||
}
|
||||
|
||||
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS; r++) {
|
||||
if (dlsch->harq_processes[i]->c[r]) {
|
||||
free16(dlsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+768);
|
||||
dlsch->harq_processes[i]->c[r] = NULL;
|
||||
}
|
||||
|
||||
if (dlsch->harq_processes[i]->d[r]) {
|
||||
free16(dlsch->harq_processes[i]->d[r],(96+12+3+(3*6144)));
|
||||
dlsch->harq_processes[i]->d[r] = NULL;
|
||||
}
|
||||
}
|
||||
free16(dlsch->harq_processes[i],sizeof(LTE_DL_eNB_HARQ_t));
|
||||
dlsch->harq_processes[i] = NULL;
|
||||
}
|
||||
|
||||
free16(dlsch->harq_processes[i],sizeof(LTE_DL_eNB_HARQ_t));
|
||||
dlsch->harq_processes[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
free16(dlsch,sizeof(LTE_eNB_DLSCH_t));
|
||||
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_DL_FRAME_PARMS* frame_parms)
|
||||
{
|
||||
|
||||
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_DL_FRAME_PARMS *frame_parms) {
|
||||
LTE_eNB_DLSCH_t *dlsch;
|
||||
unsigned char exit_flag = 0,i,j,r,aa,layer;
|
||||
int re;
|
||||
unsigned char bw_scaling =1;
|
||||
|
||||
switch (N_RB_DL) {
|
||||
case 6:
|
||||
bw_scaling =16;
|
||||
break;
|
||||
case 6:
|
||||
bw_scaling =16;
|
||||
break;
|
||||
|
||||
case 25:
|
||||
bw_scaling =4;
|
||||
break;
|
||||
case 25:
|
||||
bw_scaling =4;
|
||||
break;
|
||||
|
||||
case 50:
|
||||
bw_scaling =2;
|
||||
break;
|
||||
case 50:
|
||||
bw_scaling =2;
|
||||
break;
|
||||
|
||||
default:
|
||||
bw_scaling =1;
|
||||
break;
|
||||
default:
|
||||
bw_scaling =1;
|
||||
break;
|
||||
}
|
||||
|
||||
dlsch = (LTE_eNB_DLSCH_t *)malloc16(sizeof(LTE_eNB_DLSCH_t));
|
||||
@@ -128,15 +130,16 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
|
||||
dlsch->Mdlharq = Mdlharq;
|
||||
dlsch->Mlimit = 8;
|
||||
dlsch->Nsoft = Nsoft;
|
||||
|
||||
|
||||
for (layer=0; layer<4; layer++) {
|
||||
dlsch->ue_spec_bf_weights[layer] = (int32_t**)malloc16(64*sizeof(int32_t*));
|
||||
|
||||
dlsch->ue_spec_bf_weights[layer] = (int32_t **)malloc16(64*sizeof(int32_t *));
|
||||
|
||||
for (aa=0; aa<64; aa++) {
|
||||
dlsch->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
|
||||
for (re=0;re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) {
|
||||
dlsch->ue_spec_bf_weights[layer][aa][re] = 0x00007fff;
|
||||
}
|
||||
dlsch->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
|
||||
|
||||
for (re=0; re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) {
|
||||
dlsch->ue_spec_bf_weights[layer][aa][re] = 0x00007fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +162,7 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
|
||||
if (dlsch->harq_processes[i]) {
|
||||
bzero(dlsch->harq_processes[i],sizeof(LTE_DL_eNB_HARQ_t));
|
||||
// dlsch->harq_processes[i]->first_tx=1;
|
||||
dlsch->harq_processes[i]->b = (unsigned char*)malloc16(MAX_DLSCH_PAYLOAD_BYTES/bw_scaling);
|
||||
dlsch->harq_processes[i]->b = (unsigned char *)malloc16(MAX_DLSCH_PAYLOAD_BYTES/bw_scaling);
|
||||
|
||||
if (dlsch->harq_processes[i]->b) {
|
||||
bzero(dlsch->harq_processes[i]->b,MAX_DLSCH_PAYLOAD_BYTES/bw_scaling);
|
||||
@@ -171,14 +174,16 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
|
||||
if (abstraction_flag==0) {
|
||||
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS/bw_scaling; r++) {
|
||||
// account for filler in first segment and CRCs for multiple segment case
|
||||
dlsch->harq_processes[i]->c[r] = (uint8_t*)malloc16(((r==0)?8:0) + 3+ 768);
|
||||
dlsch->harq_processes[i]->d[r] = (uint8_t*)malloc16((96+12+3+(3*6144)));
|
||||
dlsch->harq_processes[i]->c[r] = (uint8_t *)malloc16(((r==0)?8:0) + 3+ 768);
|
||||
dlsch->harq_processes[i]->d[r] = (uint8_t *)malloc16((96+12+3+(3*6144)));
|
||||
|
||||
if (dlsch->harq_processes[i]->c[r]) {
|
||||
bzero(dlsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+ 768);
|
||||
} else {
|
||||
printf("Can't get c\n");
|
||||
exit_flag=2;
|
||||
}
|
||||
|
||||
if (dlsch->harq_processes[i]->d[r]) {
|
||||
bzero(dlsch->harq_processes[i]->d[r],(96+12+3+(3*6144)));
|
||||
} else {
|
||||
@@ -197,13 +202,12 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
|
||||
for (i=0; i<Mdlharq; i++) {
|
||||
dlsch->harq_processes[i]->round=0;
|
||||
|
||||
for (j=0; j<96; j++)
|
||||
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS/bw_scaling; r++) {
|
||||
// printf("dlsch->harq_processes[%d]->d[%d] %p\n",i,r,dlsch->harq_processes[i]->d[r]);
|
||||
if (dlsch->harq_processes[i]->d[r])
|
||||
dlsch->harq_processes[i]->d[r][j] = LTE_NULL;
|
||||
}
|
||||
|
||||
for (j=0; j<96; j++)
|
||||
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS/bw_scaling; r++) {
|
||||
// printf("dlsch->harq_processes[%d]->d[%d] %p\n",i,r,dlsch->harq_processes[i]->d[r]);
|
||||
if (dlsch->harq_processes[i]->d[r])
|
||||
dlsch->harq_processes[i]->d[r][j] = LTE_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return(dlsch);
|
||||
@@ -211,16 +215,12 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
|
||||
}
|
||||
|
||||
LOG_D(PHY,"new_eNB_dlsch exit flag %d, size of %ld\n",
|
||||
exit_flag, sizeof(LTE_eNB_DLSCH_t));
|
||||
exit_flag, sizeof(LTE_eNB_DLSCH_t));
|
||||
free_eNB_dlsch(dlsch);
|
||||
return(NULL);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch)
|
||||
{
|
||||
|
||||
void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch) {
|
||||
unsigned char Mdlharq;
|
||||
unsigned char i,j,r;
|
||||
|
||||
@@ -228,8 +228,10 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch)
|
||||
Mdlharq = dlsch->Mdlharq;
|
||||
dlsch->rnti = 0;
|
||||
#ifdef PHY_TX_THREAD
|
||||
|
||||
for (i=0; i<10; i++)
|
||||
dlsch->active[i] = 0;
|
||||
|
||||
#else
|
||||
dlsch->active = 0;
|
||||
#endif
|
||||
@@ -244,11 +246,10 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch)
|
||||
dlsch->harq_processes[i]->status = 0;
|
||||
dlsch->harq_processes[i]->round = 0;
|
||||
|
||||
for (j=0; j<96; j++)
|
||||
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS; r++)
|
||||
if (dlsch->harq_processes[i]->d[r])
|
||||
dlsch->harq_processes[i]->d[r][j] = LTE_NULL;
|
||||
|
||||
for (j=0; j<96; j++)
|
||||
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS; r++)
|
||||
if (dlsch->harq_processes[i]->d[r])
|
||||
dlsch->harq_processes[i]->d[r][j] = LTE_NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -258,31 +259,24 @@ void clean_eNb_dlsch(LTE_eNB_DLSCH_t *dlsch)
|
||||
|
||||
|
||||
int dlsch_encoding_2threads0(te_params *tep) {
|
||||
|
||||
LTE_eNB_DLSCH_t *dlsch = tep->dlsch;
|
||||
unsigned int G = tep->G;
|
||||
unsigned char harq_pid = tep->harq_pid;
|
||||
unsigned int total_worker = tep->total_worker;
|
||||
unsigned int current_worker = tep->current_worker;
|
||||
|
||||
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb;
|
||||
unsigned int Kr=0,Kr_bytes,r,r_offset=0;
|
||||
// unsigned short m=dlsch->harq_processes[harq_pid]->mcs;
|
||||
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING_W, VCD_FUNCTION_IN);
|
||||
|
||||
if (dlsch->harq_processes[harq_pid]->round == 0) { // this is a new packet
|
||||
|
||||
for (r=(dlsch->harq_processes[harq_pid]->C/(total_worker+1))*current_worker; r<(dlsch->harq_processes[harq_pid]->C/(total_worker+1))*(current_worker+1); r++) {
|
||||
|
||||
if (r<dlsch->harq_processes[harq_pid]->Cminus)
|
||||
Kr = dlsch->harq_processes[harq_pid]->Kminus;
|
||||
else
|
||||
Kr = dlsch->harq_processes[harq_pid]->Kplus;
|
||||
|
||||
Kr_bytes = Kr>>3;
|
||||
|
||||
encoder(dlsch->harq_processes[harq_pid]->c[r],
|
||||
Kr>>3,
|
||||
&dlsch->harq_processes[harq_pid]->d[r][96],
|
||||
@@ -293,25 +287,24 @@ int dlsch_encoding_2threads0(te_params *tep) {
|
||||
&dlsch->harq_processes[harq_pid]->d[r][96],
|
||||
dlsch->harq_processes[harq_pid]->w[r]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Fill in the "e"-sequence from 36-212, V8.6 2009-03, p. 16-17 (for each "e") and concatenate the
|
||||
// outputs for each code segment, see Section 5.1.5 p.20
|
||||
|
||||
for (r=0,r_offset=0; r<(dlsch->harq_processes[harq_pid]->C/(total_worker+1))*(current_worker+1); r++) {
|
||||
if(r<(dlsch->harq_processes[harq_pid]->C/(total_worker+1))*(current_worker)){
|
||||
int Nl=dlsch->harq_processes[harq_pid]->Nl;
|
||||
if(r<(dlsch->harq_processes[harq_pid]->C/(total_worker+1))*(current_worker)) {
|
||||
int Nl=dlsch->harq_processes[harq_pid]->Nl;
|
||||
int Qm=dlsch->harq_processes[harq_pid]->Qm;
|
||||
int C = dlsch->harq_processes[harq_pid]->C;
|
||||
int Gp = G/Nl/Qm;
|
||||
int GpmodC = Gp%C;
|
||||
|
||||
if (r < (C-(GpmodC)))
|
||||
r_offset += Nl*Qm * (Gp/C);
|
||||
r_offset += Nl*Qm * (Gp/C);
|
||||
else
|
||||
r_offset += Nl*Qm * ((GpmodC==0?0:1) + (Gp/C));
|
||||
}
|
||||
else{
|
||||
r_offset += Nl*Qm * ((GpmodC==0?0:1) + (Gp/C));
|
||||
} else {
|
||||
r_offset += lte_rate_matching_turbo(dlsch->harq_processes[harq_pid]->RTC[r],
|
||||
G, //G
|
||||
dlsch->harq_processes[harq_pid]->w[r],
|
||||
@@ -330,7 +323,6 @@ int dlsch_encoding_2threads0(te_params *tep) {
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING_W, VCD_FUNCTION_OUT);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -339,19 +331,16 @@ extern int oai_exit;
|
||||
void *te_thread(void *param) {
|
||||
cpu_set_t cpuset;
|
||||
CPU_ZERO(&cpuset);
|
||||
|
||||
thread_top_init("te_thread",1,200000,250000,500000);
|
||||
pthread_setname_np( pthread_self(),"te processing");
|
||||
LOG_I(PHY,"thread te created id=%ld\n", syscall(__NR_gettid));
|
||||
|
||||
|
||||
te_params *tep = (te_params *)param;
|
||||
|
||||
//wait_sync("te_thread");
|
||||
|
||||
while (!oai_exit) {
|
||||
|
||||
//wait_sync("te_thread");
|
||||
|
||||
while (!oai_exit) {
|
||||
if (wait_on_condition(&tep->mutex_te,&tep->cond_te,&tep->instance_cnt_te,"te thread")<0) break;
|
||||
|
||||
if(oai_exit) break;
|
||||
|
||||
dlsch_encoding_2threads0(tep);
|
||||
@@ -363,6 +352,7 @@ void *te_thread(void *param) {
|
||||
exit_fun( "ERROR pthread_cond_signal" );
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/*if(opp_enabled == 1 && te_wakeup_stats0->p_time>50*3000){
|
||||
print_meas_now(te_wakeup_stats0,"coding_wakeup",stderr);
|
||||
printf("te_thread0 delay for waking up in frame_rx: %d subframe_rx: %d \n",proc->frame_rx,proc->subframe_rx);
|
||||
@@ -375,61 +365,56 @@ void *te_thread(void *param) {
|
||||
|
||||
|
||||
int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
|
||||
unsigned char *a,
|
||||
uint8_t num_pdcch_symbols,
|
||||
LTE_eNB_DLSCH_t *dlsch,
|
||||
int frame,
|
||||
uint8_t subframe,
|
||||
time_stats_t *rm_stats,
|
||||
time_stats_t *te_stats,
|
||||
time_stats_t *te_wait_stats,
|
||||
time_stats_t *te_main_stats,
|
||||
time_stats_t *te_wakeup_stats0,
|
||||
time_stats_t *te_wakeup_stats1,
|
||||
time_stats_t *i_stats,
|
||||
int worker_num)
|
||||
{
|
||||
|
||||
unsigned char *a,
|
||||
uint8_t num_pdcch_symbols,
|
||||
LTE_eNB_DLSCH_t *dlsch,
|
||||
int frame,
|
||||
uint8_t subframe,
|
||||
time_stats_t *rm_stats,
|
||||
time_stats_t *te_stats,
|
||||
time_stats_t *te_wait_stats,
|
||||
time_stats_t *te_main_stats,
|
||||
time_stats_t *te_wakeup_stats0,
|
||||
time_stats_t *te_wakeup_stats1,
|
||||
time_stats_t *i_stats,
|
||||
int worker_num) {
|
||||
//start_meas(&eNB->dlsch_turbo_encoding_preperation_stats);
|
||||
|
||||
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
|
||||
L1_proc_t *proc = &eNB->proc;
|
||||
unsigned int G;
|
||||
unsigned int crc=1;
|
||||
|
||||
unsigned char harq_pid = dlsch->harq_ids[frame%2][subframe];
|
||||
|
||||
if(harq_pid >= dlsch->Mdlharq) {
|
||||
LOG_E(PHY,"dlsch_encoding_2threads illegal harq_pid %d\n", harq_pid);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb;
|
||||
unsigned int A;
|
||||
unsigned char mod_order;
|
||||
unsigned int Kr=0,Kr_bytes,r,r_offset=0;
|
||||
// unsigned short m=dlsch->harq_processes[harq_pid]->mcs;
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN);
|
||||
|
||||
A = dlsch->harq_processes[harq_pid]->TBS; //6228
|
||||
mod_order = dlsch->harq_processes[harq_pid]->Qm;
|
||||
G = get_G(frame_parms,nb_rb,dlsch->harq_processes[harq_pid]->rb_alloc,mod_order,dlsch->harq_processes[harq_pid]->Nl,num_pdcch_symbols,frame,subframe,dlsch->harq_processes[harq_pid]->mimo_mode==TM7?7:0);
|
||||
G = get_G(frame_parms,nb_rb,dlsch->harq_processes[harq_pid]->rb_alloc,mod_order,dlsch->harq_processes[harq_pid]->Nl,num_pdcch_symbols,frame,subframe,
|
||||
dlsch->harq_processes[harq_pid]->mimo_mode==TM7?7:0);
|
||||
|
||||
if (dlsch->harq_processes[harq_pid]->round == 0) { // this is a new packet
|
||||
|
||||
start_meas(&eNB->dlsch_turbo_encoding_preperation_stats);
|
||||
// Add 24-bit crc (polynomial A) to payload
|
||||
crc = crc24a(a,
|
||||
A)>>8;
|
||||
stop_meas(&eNB->dlsch_turbo_encoding_preperation_stats);
|
||||
a[A>>3] = ((uint8_t*)&crc)[2];
|
||||
a[1+(A>>3)] = ((uint8_t*)&crc)[1];
|
||||
a[2+(A>>3)] = ((uint8_t*)&crc)[0];
|
||||
|
||||
a[A>>3] = ((uint8_t *)&crc)[2];
|
||||
a[1+(A>>3)] = ((uint8_t *)&crc)[1];
|
||||
a[2+(A>>3)] = ((uint8_t *)&crc)[0];
|
||||
dlsch->harq_processes[harq_pid]->B = A+24;
|
||||
memcpy(dlsch->harq_processes[harq_pid]->b,a,(A/8)+4);
|
||||
//stop_meas(&eNB->dlsch_turbo_encoding_preperation_stats);
|
||||
|
||||
start_meas(&eNB->dlsch_turbo_encoding_segmentation_stats);
|
||||
|
||||
if (lte_segmentation(dlsch->harq_processes[harq_pid]->b,
|
||||
dlsch->harq_processes[harq_pid]->c,
|
||||
dlsch->harq_processes[harq_pid]->B,
|
||||
@@ -442,48 +427,46 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
|
||||
return(-1);
|
||||
|
||||
stop_meas(&eNB->dlsch_turbo_encoding_segmentation_stats);
|
||||
|
||||
start_meas(&eNB->dlsch_turbo_encoding_signal_stats);
|
||||
for(int i=0;i<worker_num;i++)
|
||||
{
|
||||
|
||||
for(int i=0; i<worker_num; i++) {
|
||||
proc->tep[i].eNB = eNB;
|
||||
proc->tep[i].dlsch = dlsch;
|
||||
proc->tep[i].G = G;
|
||||
proc->tep[i].harq_pid = harq_pid;
|
||||
proc->tep[i].total_worker = worker_num;
|
||||
proc->tep[i].current_worker = i;
|
||||
|
||||
pthread_mutex_lock( &proc->tep[i].mutex_te );
|
||||
|
||||
if (proc->tep[i].instance_cnt_te==0) {
|
||||
printf("[eNB] TE thread busy\n");
|
||||
exit_fun("TE thread busy");
|
||||
pthread_mutex_unlock( &proc->tep[i].mutex_te );
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
++proc->tep[i].instance_cnt_te;
|
||||
|
||||
|
||||
// wakeup worker to do segments
|
||||
if (pthread_cond_signal(&proc->tep[i].cond_te) != 0) {
|
||||
printf("[eNB] ERROR pthread_cond_signal for te thread %d exit\n",i);
|
||||
exit_fun( "ERROR pthread_cond_signal" );
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
||||
pthread_mutex_unlock( &proc->tep[i].mutex_te );
|
||||
}
|
||||
|
||||
stop_meas(&eNB->dlsch_turbo_encoding_signal_stats);
|
||||
start_meas(te_main_stats);
|
||||
for (r=(dlsch->harq_processes[harq_pid]->C/(worker_num+1))*worker_num; r<dlsch->harq_processes[harq_pid]->C; r++) {
|
||||
|
||||
for (r=(dlsch->harq_processes[harq_pid]->C/(worker_num+1))*worker_num; r<dlsch->harq_processes[harq_pid]->C; r++) {
|
||||
if (r<dlsch->harq_processes[harq_pid]->Cminus)
|
||||
Kr = dlsch->harq_processes[harq_pid]->Kminus;
|
||||
else
|
||||
Kr = dlsch->harq_processes[harq_pid]->Kplus;
|
||||
|
||||
Kr_bytes = Kr>>3;
|
||||
|
||||
start_meas(te_stats);
|
||||
encoder(dlsch->harq_processes[harq_pid]->c[r],
|
||||
Kr>>3,
|
||||
@@ -491,7 +474,6 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
|
||||
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0
|
||||
);
|
||||
stop_meas(te_stats);
|
||||
|
||||
start_meas(i_stats);
|
||||
dlsch->harq_processes[harq_pid]->RTC[r] =
|
||||
sub_block_interleaving_turbo(4+(Kr_bytes*8),
|
||||
@@ -499,17 +481,14 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
|
||||
dlsch->harq_processes[harq_pid]->w[r]);
|
||||
stop_meas(i_stats);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
for(int i=0;i<worker_num;i++)
|
||||
{
|
||||
} else {
|
||||
for(int i=0; i<worker_num; i++) {
|
||||
proc->tep[i].eNB = eNB;
|
||||
proc->tep[i].dlsch = dlsch;
|
||||
proc->tep[i].G = G;
|
||||
proc->tep[i].total_worker = worker_num;
|
||||
proc->tep[i].current_worker = i;
|
||||
|
||||
if (pthread_cond_signal(&proc->tep[i].cond_te) != 0) {
|
||||
printf("[eNB] ERROR pthread_cond_signal for te thread exit\n");
|
||||
exit_fun( "ERROR pthread_cond_signal" );
|
||||
@@ -521,7 +500,6 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
|
||||
// Fill in the "e"-sequence from 36-212, V8.6 2009-03, p. 16-17 (for each "e") and concatenate the
|
||||
// outputs for each code segment, see Section 5.1.5 p.20
|
||||
for (r=0,r_offset=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
|
||||
|
||||
// get information for E for the segments that are handled by the worker thread
|
||||
if (r<(dlsch->harq_processes[harq_pid]->C/(worker_num+1))*worker_num) {
|
||||
int Nl=dlsch->harq_processes[harq_pid]->Nl;
|
||||
@@ -529,209 +507,188 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
|
||||
int C = dlsch->harq_processes[harq_pid]->C;
|
||||
int Gp = G/Nl/Qm;
|
||||
int GpmodC = Gp%C;
|
||||
|
||||
if (r < (C-(GpmodC)))
|
||||
r_offset += Nl*Qm * (Gp/C);
|
||||
r_offset += Nl*Qm * (Gp/C);
|
||||
else
|
||||
r_offset += Nl*Qm * ((GpmodC==0?0:1) + (Gp/C));
|
||||
}
|
||||
else {
|
||||
r_offset += Nl*Qm * ((GpmodC==0?0:1) + (Gp/C));
|
||||
} else {
|
||||
start_meas(rm_stats);
|
||||
r_offset += lte_rate_matching_turbo(dlsch->harq_processes[harq_pid]->RTC[r],
|
||||
G, //G
|
||||
dlsch->harq_processes[harq_pid]->w[r],
|
||||
dlsch->harq_processes[harq_pid]->e+r_offset,
|
||||
dlsch->harq_processes[harq_pid]->C, // C
|
||||
dlsch->Nsoft, // Nsoft,
|
||||
dlsch->Mdlharq,
|
||||
dlsch->Kmimo,
|
||||
dlsch->harq_processes[harq_pid]->rvidx,
|
||||
dlsch->harq_processes[harq_pid]->Qm,
|
||||
dlsch->harq_processes[harq_pid]->Nl,
|
||||
r,
|
||||
nb_rb);
|
||||
// m); // r
|
||||
G, //G
|
||||
dlsch->harq_processes[harq_pid]->w[r],
|
||||
dlsch->harq_processes[harq_pid]->e+r_offset,
|
||||
dlsch->harq_processes[harq_pid]->C, // C
|
||||
dlsch->Nsoft, // Nsoft,
|
||||
dlsch->Mdlharq,
|
||||
dlsch->Kmimo,
|
||||
dlsch->harq_processes[harq_pid]->rvidx,
|
||||
dlsch->harq_processes[harq_pid]->Qm,
|
||||
dlsch->harq_processes[harq_pid]->Nl,
|
||||
r,
|
||||
nb_rb);
|
||||
// m); // r
|
||||
stop_meas(rm_stats);
|
||||
}
|
||||
}
|
||||
stop_meas(te_main_stats);
|
||||
|
||||
stop_meas(te_main_stats);
|
||||
start_meas(te_wait_stats);
|
||||
if(worker_num == 1)
|
||||
{
|
||||
|
||||
if(worker_num == 1) {
|
||||
wait_on_busy_condition(&proc->tep[0].mutex_te,&proc->tep[0].cond_te,&proc->tep[0].instance_cnt_te,"te thread 0");
|
||||
}
|
||||
else if(worker_num == 2)
|
||||
{
|
||||
} else if(worker_num == 2) {
|
||||
wait_on_busy_condition(&proc->tep[0].mutex_te,&proc->tep[0].cond_te,&proc->tep[0].instance_cnt_te,"te thread 0");
|
||||
wait_on_busy_condition(&proc->tep[1].mutex_te,&proc->tep[1].cond_te,&proc->tep[1].instance_cnt_te,"te thread 1");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
wait_on_busy_condition(&proc->tep[0].mutex_te,&proc->tep[0].cond_te,&proc->tep[0].instance_cnt_te,"te thread 0");
|
||||
wait_on_busy_condition(&proc->tep[1].mutex_te,&proc->tep[1].cond_te,&proc->tep[1].instance_cnt_te,"te thread 1");
|
||||
wait_on_busy_condition(&proc->tep[2].mutex_te,&proc->tep[2].cond_te,&proc->tep[2].instance_cnt_te,"te thread 2");
|
||||
}
|
||||
|
||||
stop_meas(te_wait_stats);
|
||||
|
||||
/*if(opp_enabled == 1 && te_wait_stats->p_time>100*3000){
|
||||
print_meas_now(te_wait_stats,"coding_wait",stderr);
|
||||
printf("coding delay in wait on codition in frame_rx: %d \n",proc->frame_rx);
|
||||
printf("coding delay in wait on codition in frame_rx: %d \n",proc->frame_rx);
|
||||
}*/
|
||||
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
|
||||
|
||||
return(0);
|
||||
}
|
||||
int dlsch_encoding_all(PHY_VARS_eNB *eNB,
|
||||
unsigned char *a,
|
||||
uint8_t num_pdcch_symbols,
|
||||
LTE_eNB_DLSCH_t *dlsch,
|
||||
int frame,
|
||||
uint8_t subframe,
|
||||
time_stats_t *rm_stats,
|
||||
time_stats_t *te_stats,
|
||||
time_stats_t *te_wait_stats,
|
||||
time_stats_t *te_main_stats,
|
||||
time_stats_t *te_wakeup_stats0,
|
||||
time_stats_t *te_wakeup_stats1,
|
||||
time_stats_t *i_stats)
|
||||
{
|
||||
int encoding_return = 0;
|
||||
unsigned int L,C,B;
|
||||
B = dlsch->harq_processes[dlsch->harq_ids[frame%2][subframe]]->B;
|
||||
if(B<=6144)
|
||||
{
|
||||
L=0;
|
||||
C=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
L=24;
|
||||
C = B/(6144-L);
|
||||
if((6144-L)*C < B)
|
||||
{
|
||||
C = C+1;
|
||||
}
|
||||
}
|
||||
unsigned char *a,
|
||||
uint8_t num_pdcch_symbols,
|
||||
LTE_eNB_DLSCH_t *dlsch,
|
||||
int frame,
|
||||
uint8_t subframe,
|
||||
time_stats_t *rm_stats,
|
||||
time_stats_t *te_stats,
|
||||
time_stats_t *te_wait_stats,
|
||||
time_stats_t *te_main_stats,
|
||||
time_stats_t *te_wakeup_stats0,
|
||||
time_stats_t *te_wakeup_stats1,
|
||||
time_stats_t *i_stats) {
|
||||
int encoding_return = 0;
|
||||
unsigned int L,C,B;
|
||||
B = dlsch->harq_processes[dlsch->harq_ids[frame%2][subframe]]->B;
|
||||
|
||||
LOG_D(PHY,"B %d, harq_pid %d\n",B,dlsch->harq_ids[frame%2][subframe]);
|
||||
|
||||
if(get_thread_worker_conf() == WORKER_ENABLE)
|
||||
{
|
||||
if(C >= 8)//one main three worker
|
||||
{
|
||||
encoding_return =
|
||||
dlsch_encoding_2threads(eNB,
|
||||
a,
|
||||
num_pdcch_symbols,
|
||||
dlsch,
|
||||
frame,
|
||||
subframe,
|
||||
rm_stats,
|
||||
te_stats,
|
||||
te_wait_stats,
|
||||
te_main_stats,
|
||||
te_wakeup_stats0,
|
||||
te_wakeup_stats1,
|
||||
i_stats,
|
||||
3);
|
||||
}
|
||||
else if(C >= 6)//one main two worker
|
||||
{
|
||||
encoding_return =
|
||||
dlsch_encoding_2threads(eNB,
|
||||
a,
|
||||
num_pdcch_symbols,
|
||||
dlsch,
|
||||
frame,
|
||||
subframe,
|
||||
rm_stats,
|
||||
te_stats,
|
||||
te_wait_stats,
|
||||
te_main_stats,
|
||||
te_wakeup_stats0,
|
||||
te_wakeup_stats1,
|
||||
i_stats,
|
||||
2);
|
||||
}
|
||||
else if(C >= 4)//one main one worker
|
||||
{
|
||||
encoding_return =
|
||||
dlsch_encoding_2threads(eNB,
|
||||
a,
|
||||
num_pdcch_symbols,
|
||||
dlsch,
|
||||
frame,
|
||||
subframe,
|
||||
rm_stats,
|
||||
te_stats,
|
||||
te_wait_stats,
|
||||
te_main_stats,
|
||||
te_wakeup_stats0,
|
||||
te_wakeup_stats1,
|
||||
i_stats,
|
||||
1);
|
||||
}
|
||||
else
|
||||
{
|
||||
encoding_return =
|
||||
dlsch_encoding(eNB,
|
||||
a,
|
||||
num_pdcch_symbols,
|
||||
dlsch,
|
||||
frame,
|
||||
subframe,
|
||||
rm_stats,
|
||||
te_stats,
|
||||
i_stats);
|
||||
}
|
||||
if(B<=6144) {
|
||||
L=0;
|
||||
C=1;
|
||||
} else {
|
||||
L=24;
|
||||
C = B/(6144-L);
|
||||
|
||||
if((6144-L)*C < B) {
|
||||
C = C+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
encoding_return =
|
||||
dlsch_encoding(eNB,
|
||||
a,
|
||||
num_pdcch_symbols,
|
||||
dlsch,
|
||||
frame,
|
||||
subframe,
|
||||
rm_stats,
|
||||
te_stats,
|
||||
i_stats);
|
||||
}
|
||||
|
||||
if(get_thread_worker_conf() == WORKER_ENABLE) {
|
||||
if(C >= 8) { //one main three worker
|
||||
encoding_return =
|
||||
dlsch_encoding_2threads(eNB,
|
||||
a,
|
||||
num_pdcch_symbols,
|
||||
dlsch,
|
||||
frame,
|
||||
subframe,
|
||||
rm_stats,
|
||||
te_stats,
|
||||
te_wait_stats,
|
||||
te_main_stats,
|
||||
te_wakeup_stats0,
|
||||
te_wakeup_stats1,
|
||||
i_stats,
|
||||
3);
|
||||
} else if(C >= 6) { //one main two worker
|
||||
encoding_return =
|
||||
dlsch_encoding_2threads(eNB,
|
||||
a,
|
||||
num_pdcch_symbols,
|
||||
dlsch,
|
||||
frame,
|
||||
subframe,
|
||||
rm_stats,
|
||||
te_stats,
|
||||
te_wait_stats,
|
||||
te_main_stats,
|
||||
te_wakeup_stats0,
|
||||
te_wakeup_stats1,
|
||||
i_stats,
|
||||
2);
|
||||
} else if(C >= 4) { //one main one worker
|
||||
encoding_return =
|
||||
dlsch_encoding_2threads(eNB,
|
||||
a,
|
||||
num_pdcch_symbols,
|
||||
dlsch,
|
||||
frame,
|
||||
subframe,
|
||||
rm_stats,
|
||||
te_stats,
|
||||
te_wait_stats,
|
||||
te_main_stats,
|
||||
te_wakeup_stats0,
|
||||
te_wakeup_stats1,
|
||||
i_stats,
|
||||
1);
|
||||
} else {
|
||||
encoding_return =
|
||||
dlsch_encoding(eNB,
|
||||
a,
|
||||
num_pdcch_symbols,
|
||||
dlsch,
|
||||
frame,
|
||||
subframe,
|
||||
rm_stats,
|
||||
te_stats,
|
||||
i_stats);
|
||||
}
|
||||
return encoding_return;
|
||||
} else {
|
||||
encoding_return =
|
||||
dlsch_encoding(eNB,
|
||||
a,
|
||||
num_pdcch_symbols,
|
||||
dlsch,
|
||||
frame,
|
||||
subframe,
|
||||
rm_stats,
|
||||
te_stats,
|
||||
i_stats);
|
||||
}
|
||||
|
||||
return encoding_return;
|
||||
}
|
||||
|
||||
|
||||
int dlsch_encoding(PHY_VARS_eNB *eNB,
|
||||
unsigned char *a,
|
||||
unsigned char *a,
|
||||
uint8_t num_pdcch_symbols,
|
||||
LTE_eNB_DLSCH_t *dlsch,
|
||||
int frame,
|
||||
uint8_t subframe,
|
||||
time_stats_t *rm_stats,
|
||||
time_stats_t *te_stats,
|
||||
time_stats_t *i_stats)
|
||||
{
|
||||
|
||||
time_stats_t *i_stats) {
|
||||
unsigned int G;
|
||||
unsigned int crc=1;
|
||||
|
||||
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
|
||||
unsigned char harq_pid = dlsch->harq_ids[frame%2][subframe];
|
||||
|
||||
if(harq_pid >= dlsch->Mdlharq) {
|
||||
LOG_E(PHY,"dlsch_encoding illegal harq_pid %d\n", harq_pid);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb;
|
||||
unsigned int A;
|
||||
unsigned char mod_order;
|
||||
unsigned int Kr=0,Kr_bytes,r,r_offset=0;
|
||||
// unsigned short m=dlsch->harq_processes[harq_pid]->mcs;
|
||||
uint8_t beamforming_mode=0;
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN);
|
||||
|
||||
A = dlsch->harq_processes[harq_pid]->TBS; //6228
|
||||
// printf("Encoder: A: %d\n",A);
|
||||
mod_order = dlsch->harq_processes[harq_pid]->Qm;
|
||||
@@ -742,13 +699,13 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
|
||||
beamforming_mode = 8;
|
||||
else if(dlsch->harq_processes[harq_pid]->mimo_mode == TM9_10)
|
||||
beamforming_mode = 9;
|
||||
G = get_G(frame_parms,nb_rb,dlsch->harq_processes[harq_pid]->rb_alloc,mod_order,dlsch->harq_processes[harq_pid]->Nl,num_pdcch_symbols,frame,subframe,beamforming_mode);
|
||||
|
||||
G = get_G(frame_parms,nb_rb,dlsch->harq_processes[harq_pid]->rb_alloc,mod_order,dlsch->harq_processes[harq_pid]->Nl,num_pdcch_symbols,frame,subframe,beamforming_mode);
|
||||
|
||||
// if (dlsch->harq_processes[harq_pid]->Ndi == 1) { // this is a new packet
|
||||
if (dlsch->harq_processes[harq_pid]->round == 0) { // this is a new packet
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
printf("encoding thinks this is a new packet for harq_pid %d (%p) \n",harq_pid,dlsch->harq_processes[harq_pid]->b);
|
||||
printf("encoding thinks this is a new packet for harq_pid %d (%p), A %u \n",harq_pid,dlsch,A);
|
||||
#endif
|
||||
/*
|
||||
int i;
|
||||
@@ -758,14 +715,12 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
|
||||
printf("\n");
|
||||
*/
|
||||
// Add 24-bit crc (polynomial A) to payload
|
||||
|
||||
crc = crc24a(a,
|
||||
A)>>8;
|
||||
a[A>>3] = ((uint8_t*)&crc)[2];
|
||||
a[1+(A>>3)] = ((uint8_t*)&crc)[1];
|
||||
a[2+(A>>3)] = ((uint8_t*)&crc)[0];
|
||||
a[A>>3] = ((uint8_t *)&crc)[2];
|
||||
a[1+(A>>3)] = ((uint8_t *)&crc)[1];
|
||||
a[2+(A>>3)] = ((uint8_t *)&crc)[0];
|
||||
// printf("CRC %x (A %d)\n",crc,A);
|
||||
|
||||
dlsch->harq_processes[harq_pid]->B = A+24;
|
||||
// dlsch->harq_processes[harq_pid]->b = a;
|
||||
memcpy(dlsch->harq_processes[harq_pid]->b,a,(A/8)+4);
|
||||
@@ -782,25 +737,20 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
|
||||
return(-1);
|
||||
|
||||
for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
|
||||
|
||||
if (r<dlsch->harq_processes[harq_pid]->Cminus)
|
||||
Kr = dlsch->harq_processes[harq_pid]->Kminus;
|
||||
else
|
||||
Kr = dlsch->harq_processes[harq_pid]->Kplus;
|
||||
|
||||
Kr_bytes = Kr>>3;
|
||||
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
printf("Generating Code Segment %d (%d bits)\n",r,Kr);
|
||||
printf("Generating Code Segment %u (%u bits)\n",r,Kr);
|
||||
// generate codewords
|
||||
|
||||
printf("bits_per_codeword (Kr)= %d, A %d\n",Kr,A);
|
||||
printf("bits_per_codeword (Kr)= %u, A %u\n",Kr,A);
|
||||
printf("N_RB = %d\n",nb_rb);
|
||||
printf("Ncp %d\n",frame_parms->Ncp);
|
||||
printf("mod_order %d\n",mod_order);
|
||||
#endif
|
||||
|
||||
|
||||
start_meas(te_stats);
|
||||
encoder(dlsch->harq_processes[harq_pid]->c[r],
|
||||
Kr>>3,
|
||||
@@ -821,7 +771,6 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
|
||||
dlsch->harq_processes[harq_pid]->w[r]);
|
||||
stop_meas(i_stats);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Fill in the "e"-sequence from 36-212, V8.6 2009-03, p. 16-17 (for each "e") and concatenate the
|
||||
@@ -829,16 +778,15 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
|
||||
|
||||
for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
printf("Rate Matching, Code segment %d (coded bits (G) %d,unpunctured/repeated bits per code segment %d,mod_order %d, nb_rb %d)...\n",
|
||||
r,
|
||||
G,
|
||||
Kr*3,
|
||||
mod_order,nb_rb);
|
||||
printf("Rate Matching, Code segment %u (coded bits (G) %u,unpunctured/repeated bits per code segment %u,mod_order %d, nb_rb %d)...\n",
|
||||
r,
|
||||
G,
|
||||
Kr*3,
|
||||
mod_order,nb_rb);
|
||||
#endif
|
||||
|
||||
start_meas(rm_stats);
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
printf("rvidx in encoding = %d\n", dlsch->harq_processes[harq_pid]->rvidx);
|
||||
printf("rvidx in encoding = %d\n", dlsch->harq_processes[harq_pid]->rvidx);
|
||||
#endif
|
||||
r_offset += lte_rate_matching_turbo(dlsch->harq_processes[harq_pid]->RTC[r],
|
||||
G, //G
|
||||
@@ -853,7 +801,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
|
||||
dlsch->harq_processes[harq_pid]->Nl,
|
||||
r,
|
||||
nb_rb);
|
||||
// m); // r
|
||||
// m); // r
|
||||
stop_meas(rm_stats);
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
|
||||
@@ -864,7 +812,6 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1960,6 +1960,10 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF,
|
||||
|
||||
case 4: //16QAM
|
||||
|
||||
if (qam_table_s == NULL) {
|
||||
LOG_E(PHY,"qam table pointer is NULL\n");
|
||||
return -1;
|
||||
}
|
||||
qam16_table_offset_re = 0;
|
||||
qam16_table_offset_im = 0;
|
||||
|
||||
@@ -2029,7 +2033,9 @@ int allocate_REs_in_RB_MCH(int32_t **txdataF,
|
||||
((int16_t *)&txdataF[4][tti_offset])[1]=qam_table_s[qam64_table_offset_im];//(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_E(PHY,"Invalid modulation order %i_n",mod_order);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ void mpdcch_scrambling(LTE_DL_FRAME_PARMS * frame_parms, mDCI_ALLOC_t * mdci, ui
|
||||
|
||||
// rule for BL/CE UEs from Section 6.8.B2 in 36.211
|
||||
x2 = ((((j0 + j) * Nacc) % 10) << 9) + mdci->dmrs_scrambling_init;
|
||||
LOG_I(PHY,"MPDCCH cinit = %x (mdci->dmrs_scrambling_init = %d), scrambling %d encoded DCI bits\n",
|
||||
LOG_D(PHY,"MPDCCH cinit = %x (mdci->dmrs_scrambling_init = %d), scrambling %d encoded DCI bits\n",
|
||||
x2,mdci->dmrs_scrambling_init,length);
|
||||
for (n = 0; n < length; n++) {
|
||||
if ((n & 0x1f) == 0) {
|
||||
@@ -109,17 +109,16 @@ void init_mpdcch5ss1tab_normal_regular_subframe_evenNRBDL(PHY_VARS_eNB * eNB)
|
||||
{
|
||||
int l, k, kmod, re=0;
|
||||
|
||||
LOG_I(PHY, "Inititalizing mpdcchss15tab for normal prefix, normal prefix, no PSS/SSS/PBCH, even N_RB_DL\n");
|
||||
LOG_D(PHY, "Inititalizing mpdcchss15tab for normal prefix, normal prefix, no PSS/SSS/PBCH, even N_RB_DL\n");
|
||||
|
||||
for (l = 1; l < 14; l++) {
|
||||
for (k = 0; k < 72; k++) {
|
||||
kmod = k % 12;
|
||||
if (((l != 5) && (l != 6) && (l != 12) && (l != 13)) || (kmod == 2) || (kmod == 3) || (kmod == 4) || (kmod == 7) || (kmod == 8) || (kmod == 9)) {
|
||||
mpdcch5ss1tab[re] = (l * eNB->frame_parms.ofdm_symbol_size) + k;
|
||||
re++;
|
||||
printf("l %d, k %d (kmod %d) => re %d\n", l, k, kmod, re);
|
||||
mpdcch5ss1tab[re] = (l * eNB->frame_parms.ofdm_symbol_size) + k;
|
||||
re++;
|
||||
} else if ((kmod == 0) || (kmod == 5) || (kmod == 10)) {
|
||||
mpdcch5ss1tab[re++] = (l * eNB->frame_parms.ofdm_symbol_size) + k;
|
||||
mpdcch5ss1tab[re++] = (l * eNB->frame_parms.ofdm_symbol_size) + k;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -139,7 +138,7 @@ void init_mpdcch5ss2tab_normal_regular_subframe_evenNRBDL(PHY_VARS_eNB * eNB)
|
||||
int nushift = eNB->frame_parms.Nid_cell % 6;
|
||||
int nushiftp3 = (eNB->frame_parms.Nid_cell+3) % 6;
|
||||
// NOTE : THIS IS FOR TM1 ONLY FOR NOW!!!!!!!
|
||||
LOG_I(PHY, "Inititalizing mpdcch5ss2tab for normal prefix, normal prefix, no PSS/SSS/PBCH, even N_RB_DL\n");
|
||||
LOG_D(PHY, "Inititalizing mpdcch5ss2tab for normal prefix, normal prefix, no PSS/SSS/PBCH, even N_RB_DL\n");
|
||||
for (l = 2; l < 14; l++) {
|
||||
for (k = 0; k < 72; k++) {
|
||||
kmod = k % 12;
|
||||
@@ -168,7 +167,7 @@ void init_mpdcch5ss3tab_normal_regular_subframe_evenNRBDL(PHY_VARS_eNB * eNB)
|
||||
{
|
||||
int l, k, kmod, re=0;
|
||||
|
||||
LOG_I(PHY, "Inititalizing mpdcch5ss3tab for normal prefix, normal prefix, no PSS/SSS/PBCH, even N_RB_DL\n");
|
||||
LOG_D(PHY, "Inititalizing mpdcch5ss3tab for normal prefix, normal prefix, no PSS/SSS/PBCH, even N_RB_DL\n");
|
||||
for (l = 3; l < 14; l++) {
|
||||
for (k = 0; k < 72; k++) {
|
||||
kmod = k % 12;
|
||||
@@ -194,7 +193,7 @@ void init_mpdcch3ss1tab_normal_regular_subframe_evenNRBDL(PHY_VARS_eNB * eNB)
|
||||
{
|
||||
int l, k, kmod, re=0;
|
||||
|
||||
LOG_I(PHY, "Inititalizing mpdcch3ss1tab for normal prefix, normal prefix, no PSS/SSS/PBCH, even N_RB_DL\n");
|
||||
LOG_D(PHY, "Inititalizing mpdcch3ss1tab for normal prefix, normal prefix, no PSS/SSS/PBCH, even N_RB_DL\n");
|
||||
for (l = 1, re = 0; l < 14; l++) {
|
||||
for (k = 0; k < 48; k++) {
|
||||
kmod = k % 12;
|
||||
@@ -218,7 +217,7 @@ void init_mpdcch2ss1tab_normal_regular_subframe_evenNRBDL(PHY_VARS_eNB * eNB)
|
||||
{
|
||||
int l, k, kmod, re=0;
|
||||
|
||||
LOG_I(PHY, "Inititalizing mpdcch2ss1tab for normal prefix, normal prefix, no PSS/SSS/PBCH, even N_RB_DL\n");
|
||||
LOG_D(PHY, "Inititalizing mpdcch2ss1tab for normal prefix, normal prefix, no PSS/SSS/PBCH, even N_RB_DL\n");
|
||||
for (l = 1, re = 0; l < 14; l++) {
|
||||
for (k = 0; k < 24; k++) {
|
||||
kmod = k % 12;
|
||||
@@ -288,7 +287,7 @@ void generate_mdci_top(PHY_VARS_eNB * eNB, int frame, int subframe, int16_t amp,
|
||||
int wp[2][4] = {{1,1,1,1},{1,-1,1,-1}};
|
||||
int *w;
|
||||
|
||||
LOG_I(PHY, "generate_mdci_top: num_dci %d\n", mpdcch->num_dci);
|
||||
LOG_D(PHY, "generate_mdci_top: num_dci %d\n", mpdcch->num_dci);
|
||||
|
||||
for (i = 0; i < mpdcch->num_dci; i++) {
|
||||
mdci = &mpdcch->mdci_alloc[i];
|
||||
@@ -320,7 +319,7 @@ void generate_mdci_top(PHY_VARS_eNB * eNB, int frame, int subframe, int16_t amp,
|
||||
} else
|
||||
AssertFatal(1 == 0, "Illegal combination start_symbol %d, a_index %d\n", mdci->start_symbol, a_index);
|
||||
|
||||
LOG_I(PHY, "mdci %d, length %d: rnti %x, L %d, prb_pairs %d, ce_mode %d, transmission type %s, i0 %d, ss %d ,coded_bits %d\n",
|
||||
LOG_D(PHY, "mdci %d, length %d: rnti %x, L %d, prb_pairs %d, ce_mode %d, transmission type %s, i0 %d, ss %d ,coded_bits %d\n",
|
||||
i, mdci->dci_length,mdci->rnti,
|
||||
mdci->L, mdci->number_of_prb_pairs,
|
||||
mdci->ce_mode,
|
||||
@@ -422,7 +421,7 @@ void generate_mdci_top(PHY_VARS_eNB * eNB, int frame, int subframe, int16_t amp,
|
||||
uint32_t b = ((mdci->dmrs_scrambling_init << 1) + 1) << 16;
|
||||
x2 = a * b;
|
||||
x2 = x2 + 2;
|
||||
LOG_I(PHY, "mpdcch_dmrs cinit %x (a=%d,b=%d,i0=%d,j0=%d)\n", x2,a,b,i0,j0);
|
||||
LOG_D(PHY, "mpdcch_dmrs cinit %x (a=%d,b=%d,i0=%d,j0=%d)\n", x2,a,b,i0,j0);
|
||||
|
||||
// add MPDCCH pilots
|
||||
int reset = 1;
|
||||
|
||||
@@ -308,7 +308,7 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch,
|
||||
|
||||
#ifdef DEBUG_PBCH
|
||||
if (frame_mod4==0) {
|
||||
LOG_M"pbch_e.m","pbch_e",
|
||||
LOG_M("pbch_e.m","pbch_e",
|
||||
eNB_pbch->pbch_e,
|
||||
pbch_E,
|
||||
1,
|
||||
@@ -325,7 +325,7 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch,
|
||||
pbch_E);
|
||||
#ifdef DEBUG_PBCH
|
||||
if (frame_mod4==0) {
|
||||
LOG_M"pbch_e_s.m","pbch_e_s",
|
||||
LOG_M("pbch_e_s.m","pbch_e_s",
|
||||
eNB_pbch->pbch_e,
|
||||
pbch_E,
|
||||
1,
|
||||
|
||||
@@ -46,96 +46,91 @@ uint8_t get_mi(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe)
|
||||
|
||||
// for TDD
|
||||
switch (frame_parms->tdd_config) {
|
||||
case 0:
|
||||
if ((subframe==0) || (subframe==5))
|
||||
return(2);
|
||||
else return(1);
|
||||
|
||||
case 0:
|
||||
if ((subframe==0) || (subframe==5))
|
||||
return(2);
|
||||
else return(1);
|
||||
break;
|
||||
|
||||
break;
|
||||
case 1:
|
||||
if ((subframe==0) || (subframe==5))
|
||||
return(0);
|
||||
else return(1);
|
||||
|
||||
case 1:
|
||||
if ((subframe==0) || (subframe==5))
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if ((subframe==3) || (subframe==8))
|
||||
return(1);
|
||||
else return(0);
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if ((subframe==0) || (subframe==8) || (subframe==9))
|
||||
return(1);
|
||||
else return(0);
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if ((subframe==8) || (subframe==9))
|
||||
return(1);
|
||||
else return(0);
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
if (subframe==8)
|
||||
return(1);
|
||||
else return(0);
|
||||
|
||||
break;
|
||||
|
||||
case 6:
|
||||
return(1);
|
||||
break;
|
||||
|
||||
default:
|
||||
return(0);
|
||||
else return(1);
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if ((subframe==3) || (subframe==8))
|
||||
return(1);
|
||||
else return(0);
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if ((subframe==0) || (subframe==8) || (subframe==9))
|
||||
return(1);
|
||||
else return(0);
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if ((subframe==8) || (subframe==9))
|
||||
return(1);
|
||||
else return(0);
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
if (subframe==8)
|
||||
return(1);
|
||||
else return(0);
|
||||
|
||||
break;
|
||||
|
||||
case 6:
|
||||
return(1);
|
||||
break;
|
||||
|
||||
default:
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char subframe2_ul_harq(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe)
|
||||
{
|
||||
|
||||
unsigned char subframe2_ul_harq(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe) {
|
||||
if (frame_parms->frame_type == FDD)
|
||||
return(subframe&7);
|
||||
|
||||
switch (frame_parms->tdd_config) {
|
||||
case 3:
|
||||
if ( (subframe == 8) || (subframe == 9) ) {
|
||||
return(subframe-8);
|
||||
} else if (subframe==0)
|
||||
return(2);
|
||||
else {
|
||||
LOG_E(PHY,"phich.c: subframe2_ul_harq, illegal subframe %d for tdd_config %d\n",
|
||||
subframe,frame_parms->tdd_config);
|
||||
return(0);
|
||||
}
|
||||
case 3:
|
||||
if ( (subframe == 8) || (subframe == 9) ) {
|
||||
return(subframe-8);
|
||||
} else if (subframe==0)
|
||||
return(2);
|
||||
else {
|
||||
LOG_E(PHY,"phich.c: subframe2_ul_harq, illegal subframe %d for tdd_config %d\n",
|
||||
subframe,frame_parms->tdd_config);
|
||||
return(0);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if ( (subframe == 8) || (subframe == 9) ) {
|
||||
return(subframe-8);
|
||||
} else {
|
||||
LOG_E(PHY,"phich.c: subframe2_ul_harq, illegal subframe %d for tdd_config %d\n",
|
||||
subframe,frame_parms->tdd_config);
|
||||
return(0);
|
||||
}
|
||||
|
||||
break;
|
||||
case 4:
|
||||
if ( (subframe == 8) || (subframe == 9) ) {
|
||||
return(subframe-8);
|
||||
} else {
|
||||
LOG_E(PHY,"phich.c: subframe2_ul_harq, illegal subframe %d for tdd_config %d\n",
|
||||
subframe,frame_parms->tdd_config);
|
||||
return(0);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int phich_frame2_pusch_frame(LTE_DL_FRAME_PARMS *frame_parms, int frame, int subframe)
|
||||
{
|
||||
int phich_frame2_pusch_frame(LTE_DL_FRAME_PARMS *frame_parms, int frame, int subframe) {
|
||||
int pusch_frame;
|
||||
|
||||
if (frame_parms->frame_type == FDD) {
|
||||
@@ -149,127 +144,124 @@ int phich_frame2_pusch_frame(LTE_DL_FRAME_PARMS *frame_parms, int frame, int sub
|
||||
return pusch_frame % 1024;
|
||||
}
|
||||
|
||||
uint8_t phich_subframe2_pusch_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe)
|
||||
{
|
||||
uint8_t phich_subframe2_pusch_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe) {
|
||||
uint8_t pusch_subframe = 255;
|
||||
|
||||
if (frame_parms->frame_type == FDD)
|
||||
return subframe < 4 ? subframe + 6 : subframe - 4;
|
||||
|
||||
switch (frame_parms->tdd_config) {
|
||||
case 0:
|
||||
if (subframe == 0)
|
||||
pusch_subframe = (3);
|
||||
else if (subframe == 5) {
|
||||
pusch_subframe = (8);
|
||||
} else if (subframe == 6)
|
||||
pusch_subframe = (2);
|
||||
else if (subframe == 1)
|
||||
pusch_subframe = (7);
|
||||
else {
|
||||
AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
|
||||
subframe,frame_parms->tdd_config);
|
||||
case 0:
|
||||
if (subframe == 0)
|
||||
pusch_subframe = (3);
|
||||
else if (subframe == 5) {
|
||||
pusch_subframe = (8);
|
||||
} else if (subframe == 6)
|
||||
pusch_subframe = (2);
|
||||
else if (subframe == 1)
|
||||
pusch_subframe = (7);
|
||||
else {
|
||||
AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
|
||||
subframe,frame_parms->tdd_config);
|
||||
pusch_subframe = (0);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (subframe == 6)
|
||||
pusch_subframe = (2);
|
||||
else if (subframe == 9)
|
||||
pusch_subframe = (3);
|
||||
else if (subframe == 1)
|
||||
pusch_subframe = (7);
|
||||
else if (subframe == 4)
|
||||
pusch_subframe = (8);
|
||||
else {
|
||||
AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
|
||||
subframe,frame_parms->tdd_config);
|
||||
pusch_subframe = (0);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (subframe == 8)
|
||||
pusch_subframe = (2);
|
||||
else if (subframe == 3)
|
||||
pusch_subframe = (7);
|
||||
else {
|
||||
AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
|
||||
subframe,frame_parms->tdd_config);
|
||||
pusch_subframe = (0);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if ( (subframe == 8) || (subframe == 9) ) {
|
||||
pusch_subframe = (subframe-6);
|
||||
} else if (subframe==0)
|
||||
pusch_subframe = (4);
|
||||
else {
|
||||
AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
|
||||
subframe,frame_parms->tdd_config);
|
||||
pusch_subframe = (0);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if ( (subframe == 8) || (subframe == 9) ) {
|
||||
pusch_subframe = (subframe-6);
|
||||
} else {
|
||||
AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
|
||||
subframe,frame_parms->tdd_config);
|
||||
pusch_subframe = (0);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
if (subframe == 8) {
|
||||
pusch_subframe = (2);
|
||||
} else {
|
||||
AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
|
||||
subframe,frame_parms->tdd_config);
|
||||
pusch_subframe = (0);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 6:
|
||||
if (subframe == 6) {
|
||||
pusch_subframe = (2);
|
||||
} else if (subframe == 9) {
|
||||
pusch_subframe = (3);
|
||||
} else if (subframe == 0) {
|
||||
pusch_subframe = (4);
|
||||
} else if (subframe == 1) {
|
||||
pusch_subframe = (7);
|
||||
} else if (subframe == 5) {
|
||||
pusch_subframe = (8);
|
||||
} else {
|
||||
AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
|
||||
subframe,frame_parms->tdd_config);
|
||||
pusch_subframe = (0);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(1==0, "no implementation for TDD UL/DL-config = %d!\n", frame_parms->tdd_config);
|
||||
pusch_subframe = (0);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (subframe == 6)
|
||||
pusch_subframe = (2);
|
||||
else if (subframe == 9)
|
||||
pusch_subframe = (3);
|
||||
else if (subframe == 1)
|
||||
pusch_subframe = (7);
|
||||
else if (subframe == 4)
|
||||
pusch_subframe = (8);
|
||||
else {
|
||||
AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
|
||||
subframe,frame_parms->tdd_config);
|
||||
pusch_subframe = (0);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (subframe == 8)
|
||||
pusch_subframe = (2);
|
||||
else if (subframe == 3)
|
||||
pusch_subframe = (7);
|
||||
else {
|
||||
AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
|
||||
subframe,frame_parms->tdd_config);
|
||||
pusch_subframe = (0);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if ( (subframe == 8) || (subframe == 9) ) {
|
||||
pusch_subframe = (subframe-6);
|
||||
} else if (subframe==0)
|
||||
pusch_subframe = (4);
|
||||
else {
|
||||
AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
|
||||
subframe,frame_parms->tdd_config);
|
||||
pusch_subframe = (0);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if ( (subframe == 8) || (subframe == 9) ) {
|
||||
pusch_subframe = (subframe-6);
|
||||
} else {
|
||||
AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
|
||||
subframe,frame_parms->tdd_config);
|
||||
pusch_subframe = (0);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 5:
|
||||
if (subframe == 8) {
|
||||
pusch_subframe = (2);
|
||||
} else {
|
||||
AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
|
||||
subframe,frame_parms->tdd_config);
|
||||
pusch_subframe = (0);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 6:
|
||||
if (subframe == 6) {
|
||||
pusch_subframe = (2);
|
||||
} else if (subframe == 9) {
|
||||
pusch_subframe = (3);
|
||||
} else if (subframe == 0) {
|
||||
pusch_subframe = (4);
|
||||
} else if (subframe == 1) {
|
||||
pusch_subframe = (7);
|
||||
} else if (subframe == 5) {
|
||||
pusch_subframe = (8);
|
||||
} else {
|
||||
AssertFatal(1==0,"phich.c: phich_subframe2_pusch_subframe, illegal subframe %d for tdd_config %d\n",
|
||||
subframe,frame_parms->tdd_config);
|
||||
pusch_subframe = (0);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
AssertFatal(1==0, "no implementation for TDD UL/DL-config = %d!\n", frame_parms->tdd_config);
|
||||
pusch_subframe = (0);
|
||||
}
|
||||
|
||||
LOG_D(PHY, "subframe %d: PUSCH subframe = %d\n", subframe, pusch_subframe);
|
||||
return pusch_subframe;
|
||||
}
|
||||
|
||||
int check_pcfich(LTE_DL_FRAME_PARMS *frame_parms,uint16_t reg)
|
||||
{
|
||||
|
||||
int check_pcfich(LTE_DL_FRAME_PARMS *frame_parms,uint16_t reg) {
|
||||
if ((reg == frame_parms->pcfich_reg[0]) ||
|
||||
(reg == frame_parms->pcfich_reg[1]) ||
|
||||
(reg == frame_parms->pcfich_reg[2]) ||
|
||||
@@ -279,9 +271,7 @@ int check_pcfich(LTE_DL_FRAME_PARMS *frame_parms,uint16_t reg)
|
||||
return(0);
|
||||
}
|
||||
|
||||
void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms)
|
||||
{
|
||||
|
||||
void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms) {
|
||||
unsigned short n0 = (frame_parms->N_RB_DL * 2) - 4; // 2 REG per RB less the 4 used by PCFICH in first symbol
|
||||
unsigned short n1 = (frame_parms->N_RB_DL * 3); // 3 REG per RB in second and third symbol
|
||||
unsigned short n2 = n1;
|
||||
@@ -289,11 +279,9 @@ void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms)
|
||||
unsigned short Ngroup_PHICH;
|
||||
// uint16_t *phich_reg = frame_parms->phich_reg;
|
||||
uint16_t *pcfich_reg = frame_parms->pcfich_reg;
|
||||
|
||||
// compute Ngroup_PHICH (see formula at beginning of Section 6.9 in 36-211
|
||||
Ngroup_PHICH = (frame_parms->phich_config_common.phich_resource*frame_parms->N_RB_DL)/48;
|
||||
|
||||
|
||||
if (((frame_parms->phich_config_common.phich_resource*frame_parms->N_RB_DL)%48) > 0)
|
||||
Ngroup_PHICH++;
|
||||
|
||||
@@ -303,25 +291,24 @@ void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms)
|
||||
}
|
||||
|
||||
#ifdef DEBUG_PHICH
|
||||
LOG_D(PHY,"Ngroup_PHICH %d (phich_config_common.phich_resource %d,phich_config_common.phich_duration %s, NidCell %d,Ncp %d, frame_type %d), smallest pcfich REG %d, n0 %d, n1 %d (first PHICH REG %d)\n",
|
||||
((frame_parms->Ncp == NORMAL)?Ngroup_PHICH:(Ngroup_PHICH>>1)),
|
||||
frame_parms->phich_config_common.phich_resource,
|
||||
frame_parms->phich_config_common.phich_duration==normal?"normal":"extended",
|
||||
frame_parms->Nid_cell,frame_parms->Ncp,frame_parms->frame_type,
|
||||
pcfich_reg[frame_parms->pcfich_first_reg_idx],
|
||||
n0,
|
||||
n1,
|
||||
((frame_parms->Nid_cell))%n0);
|
||||
LOG_D(PHY,
|
||||
"Ngroup_PHICH %d (phich_config_common.phich_resource %d,phich_config_common.phich_duration %s, NidCell %d,Ncp %d, frame_type %d), smallest pcfich REG %d, n0 %d, n1 %d (first PHICH REG %d)\n",
|
||||
((frame_parms->Ncp == NORMAL)?Ngroup_PHICH:(Ngroup_PHICH>>1)),
|
||||
frame_parms->phich_config_common.phich_resource,
|
||||
frame_parms->phich_config_common.phich_duration==normal?"normal":"extended",
|
||||
frame_parms->Nid_cell,frame_parms->Ncp,frame_parms->frame_type,
|
||||
pcfich_reg[frame_parms->pcfich_first_reg_idx],
|
||||
n0,
|
||||
n1,
|
||||
((frame_parms->Nid_cell))%n0);
|
||||
#endif
|
||||
|
||||
// This is the algorithm from Section 6.9.3 in 36-211, it works only for normal PHICH duration for now ...
|
||||
|
||||
for (mprime=0;
|
||||
mprime<((frame_parms->Ncp == NORMAL)?Ngroup_PHICH:(Ngroup_PHICH>>1));
|
||||
for (mprime=0;
|
||||
mprime<((frame_parms->Ncp == NORMAL)?Ngroup_PHICH:(Ngroup_PHICH>>1));
|
||||
mprime++) {
|
||||
|
||||
if (frame_parms->phich_config_common.phich_duration==normal) { // normal PHICH duration
|
||||
|
||||
frame_parms->phich_reg[mprime][0] = (frame_parms->Nid_cell + mprime)%n0;
|
||||
|
||||
if (frame_parms->phich_reg[mprime][0]>=pcfich_reg[frame_parms->pcfich_first_reg_idx])
|
||||
@@ -338,10 +325,9 @@ void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms)
|
||||
|
||||
frame_parms->phich_reg[mprime][1] = (frame_parms->Nid_cell + mprime + (n0/3))%n0;
|
||||
|
||||
|
||||
if (frame_parms->phich_reg[mprime][1]>=pcfich_reg[frame_parms->pcfich_first_reg_idx])
|
||||
frame_parms->phich_reg[mprime][1]++;
|
||||
|
||||
|
||||
if (frame_parms->phich_reg[mprime][1]>=pcfich_reg[(frame_parms->pcfich_first_reg_idx+1)&3])
|
||||
frame_parms->phich_reg[mprime][1]++;
|
||||
|
||||
@@ -350,10 +336,9 @@ void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms)
|
||||
|
||||
if (frame_parms->phich_reg[mprime][1]>=pcfich_reg[(frame_parms->pcfich_first_reg_idx+3)&3])
|
||||
frame_parms->phich_reg[mprime][1]++;
|
||||
|
||||
|
||||
frame_parms->phich_reg[mprime][2] = (frame_parms->Nid_cell + mprime + (2*n0/3))%n0;
|
||||
|
||||
|
||||
if (frame_parms->phich_reg[mprime][2]>=pcfich_reg[frame_parms->pcfich_first_reg_idx])
|
||||
frame_parms->phich_reg[mprime][2]++;
|
||||
|
||||
@@ -365,21 +350,19 @@ void generate_phich_reg_mapping(LTE_DL_FRAME_PARMS *frame_parms)
|
||||
|
||||
if (frame_parms->phich_reg[mprime][2]>=pcfich_reg[(frame_parms->pcfich_first_reg_idx+3)&3])
|
||||
frame_parms->phich_reg[mprime][2]++;
|
||||
|
||||
|
||||
#ifdef DEBUG_PHICH
|
||||
printf("phich_reg :%d => %d,%d,%d\n",mprime,frame_parms->phich_reg[mprime][0],frame_parms->phich_reg[mprime][1],frame_parms->phich_reg[mprime][2]);
|
||||
#endif
|
||||
} else { // extended PHICH duration
|
||||
frame_parms->phich_reg[mprime<<1][0] = (frame_parms->Nid_cell + mprime)%n0;
|
||||
frame_parms->phich_reg[1+(mprime<<1)][0] = (frame_parms->Nid_cell + mprime)%n0;
|
||||
|
||||
frame_parms->phich_reg[mprime<<1][1] = ((frame_parms->Nid_cell*n1/n0) + mprime + (n1/3))%n1;
|
||||
frame_parms->phich_reg[mprime<<1][2] = ((frame_parms->Nid_cell*n2/n0) + mprime + (2*n2/3))%n2;
|
||||
|
||||
frame_parms->phich_reg[1+(mprime<<1)][1] = ((frame_parms->Nid_cell*n1/n0) + mprime + (n1/3))%n1;
|
||||
frame_parms->phich_reg[1+(mprime<<1)][2] = ((frame_parms->Nid_cell*n2/n0) + mprime + (2*n2/3))%n2;
|
||||
//#ifdef DEBUG_PHICH
|
||||
printf("phich_reg :%d => %d,%d,%d\n",mprime<<1,frame_parms->phich_reg[mprime<<1][0],frame_parms->phich_reg[mprime][1],frame_parms->phich_reg[mprime][2]);
|
||||
printf("phich_reg :%u => %d,%d,%d\n",mprime<<1,frame_parms->phich_reg[mprime<<1][0],frame_parms->phich_reg[mprime][1],frame_parms->phich_reg[mprime][2]);
|
||||
printf("phich_reg :%d => %d,%d,%d\n",1+(mprime<<1),frame_parms->phich_reg[1+(mprime<<1)][0],frame_parms->phich_reg[1+(mprime<<1)][1],frame_parms->phich_reg[1+(mprime<<1)][2]);
|
||||
//#endif
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
#endif
|
||||
) {
|
||||
int i;
|
||||
LTE_DL_FRAME_PARMS *fp;
|
||||
LTE_DL_FRAME_PARMS *fp=NULL;
|
||||
lte_frame_type_t frame_type;
|
||||
uint16_t rootSequenceIndex;
|
||||
uint8_t prach_ConfigIndex;
|
||||
@@ -66,7 +66,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
int subframe;
|
||||
int16_t *prachF=NULL;
|
||||
int16_t **rxsigF=NULL;
|
||||
int nb_rx;
|
||||
int nb_rx=0;
|
||||
int16_t *prach2;
|
||||
uint8_t preamble_index;
|
||||
uint16_t NCS,NCS2;
|
||||
@@ -96,13 +96,17 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
int prach_ifft_cnt=0;
|
||||
#endif
|
||||
|
||||
if (ru) {
|
||||
fp = &ru->frame_parms;
|
||||
nb_rx = ru->nb_rx;
|
||||
} else if (eNB) {
|
||||
fp = &eNB->frame_parms;
|
||||
|
||||
if(eNB) {
|
||||
fp = &(eNB->frame_parms);
|
||||
nb_rx = fp->nb_antennas_rx;
|
||||
} else AssertFatal(1==0,"rx_prach called without valid RU or eNB descriptor\n");
|
||||
} else {
|
||||
fp = &(ru->frame_parms);
|
||||
nb_rx = ru->nb_rx;
|
||||
}
|
||||
AssertFatal(fp!=NULL,"rx_prach called without valid RU or eNB descriptor\n");
|
||||
|
||||
frame_type = fp->frame_type;
|
||||
|
||||
frame_type = fp->frame_type;
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
@@ -148,29 +152,26 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
prachF = eNB->prach_vars_br.prachF;
|
||||
rxsigF = eNB->prach_vars_br.rxsigF[ce_level];
|
||||
|
||||
if (LOG_DEBUGFLAG(PRACH)) {
|
||||
if (((ru->proc.frame_prach)&1023) < 20) LOG_I(PHY,
|
||||
"PRACH (eNB) : running rx_prach (br_flag %d, ce_level %d) for frame %d subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d, rootSequenceIndex %d, repetition number %d,numRepetitionsPrePreambleAttempt %d\n",
|
||||
br_flag,ce_level,ru->proc.frame_prach,subframe,
|
||||
fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[ce_level],
|
||||
prach_ConfigIndex,rootSequenceIndex,
|
||||
eNB->prach_vars_br.repetition_number[ce_level],
|
||||
fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[ce_level]);
|
||||
if (LOG_DEBUGFLAG(PRACH)){
|
||||
if (((eNB->proc.frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (eNB) : running rx_prach (br_flag %d, ce_level %d) for frame %d subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d, rootSequenceIndex %d, repetition number %d,numRepetitionsPrePreambleAttempt %d\n",
|
||||
br_flag,ce_level,eNB->proc.frame_prach,subframe,
|
||||
fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[ce_level],
|
||||
prach_ConfigIndex,rootSequenceIndex,
|
||||
eNB->prach_vars_br.repetition_number[ce_level],
|
||||
fp->prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[ce_level]);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
prach_ifftp = eNB->prach_vars.prach_ifft[0];
|
||||
subframe = eNB->proc.subframe_prach;
|
||||
prachF = eNB->prach_vars.prachF;
|
||||
rxsigF = eNB->prach_vars.rxsigF[0];
|
||||
|
||||
if (LOG_DEBUGFLAG(PRACH)) {
|
||||
if (((ru->proc.frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (eNB) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d , rootSequenceIndex %d\n", subframe,
|
||||
fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,prach_ConfigIndex,rootSequenceIndex);
|
||||
{
|
||||
prach_ifftp = eNB->prach_vars.prach_ifft[0];
|
||||
subframe = eNB->proc.subframe_prach;
|
||||
prachF = eNB->prach_vars.prachF;
|
||||
rxsigF = eNB->prach_vars.rxsigF[0];
|
||||
if (LOG_DEBUGFLAG(PRACH)){
|
||||
if (((eNB->proc.frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (eNB) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d , rootSequenceIndex %d\n", subframe,fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,prach_ConfigIndex,rootSequenceIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
|
||||
if (br_flag == 1) {
|
||||
@@ -421,7 +422,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
}
|
||||
}
|
||||
|
||||
if ((eNB==NULL) && ru->function == NGFI_RRU_IF4p5) {
|
||||
if ((eNB==NULL) && ru->function == NGFI_RRU_IF4p5) {
|
||||
/// **** send_IF4 of rxsigF to RAU **** ///
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
if (br_flag == 1) send_IF4p5(ru, ru->proc.frame_prach, ru->proc.subframe_prach, IF4p5_PRACH+1+ce_level);
|
||||
@@ -445,26 +446,27 @@ void rx_prach0(PHY_VARS_eNB *eNB,
|
||||
uint8_t update_TA2 = 1;
|
||||
|
||||
switch (eNB->frame_parms.N_RB_DL) {
|
||||
case 6:
|
||||
update_TA = 16;
|
||||
break;
|
||||
|
||||
case 25:
|
||||
update_TA = 4;
|
||||
break;
|
||||
case 6:
|
||||
update_TA = 16;
|
||||
break;
|
||||
|
||||
case 25:
|
||||
update_TA = 4;
|
||||
break;
|
||||
|
||||
case 50:
|
||||
update_TA = 2;
|
||||
break;
|
||||
|
||||
case 75:
|
||||
update_TA = 3;
|
||||
update_TA2 = 2;
|
||||
break;
|
||||
case 100:
|
||||
update_TA = 1;
|
||||
break;
|
||||
|
||||
case 50:
|
||||
update_TA = 2;
|
||||
break;
|
||||
|
||||
case 75:
|
||||
update_TA = 3;
|
||||
update_TA2 = 2;
|
||||
break;
|
||||
|
||||
case 100:
|
||||
update_TA = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
*max_preamble_energy=0;
|
||||
|
||||
@@ -565,17 +565,16 @@ int is_prach_subframe0(LTE_DL_FRAME_PARMS *frame_parms,uint8_t prach_ConfigIndex
|
||||
return(prach_mask);
|
||||
}
|
||||
|
||||
int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t subframe) {
|
||||
int is_prach_subframe(LTE_DL_FRAME_PARMS *frame_parms, uint32_t frame, uint8_t subframe) {
|
||||
|
||||
uint8_t prach_ConfigIndex = frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
|
||||
int prach_mask = is_prach_subframe0(frame_parms,prach_ConfigIndex,frame,subframe);
|
||||
int prach_mask = is_prach_subframe0(frame_parms, prach_ConfigIndex, frame, subframe);
|
||||
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
int i;
|
||||
|
||||
for (i=0;i<4;i++) {
|
||||
for (int i=0; i<4; i++) {
|
||||
if (frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[i] == 1)
|
||||
prach_mask|=(is_prach_subframe0(frame_parms,frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[i],frame,subframe)<<(i+1));
|
||||
prach_mask |= (is_prach_subframe0(frame_parms, frame_parms->prach_emtc_config_common.prach_ConfigInfo.prach_ConfigIndex[i],
|
||||
frame, subframe) << (i+1));
|
||||
}
|
||||
#endif
|
||||
return(prach_mask);
|
||||
|
||||
@@ -507,7 +507,7 @@ int dump_ue_stats(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,char* buffer, int length
|
||||
len += sprintf(&buffer[len], "[UE PROC] DLSCH Total %d, Error %d, FER %d\n",ue->dlsch_received[0],ue->dlsch_errors[0],ue->dlsch_fer[0]);
|
||||
len += sprintf(&buffer[len], "[UE PROC] DLSCH (SI) Total %d, Error %d\n",ue->dlsch_SI_received[0],ue->dlsch_SI_errors[0]);
|
||||
len += sprintf(&buffer[len], "[UE PROC] DLSCH (RA) Total %d, Error %d\n",ue->dlsch_ra_received[0],ue->dlsch_ra_errors[0]);
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
|
||||
int i=0;
|
||||
|
||||
//len += sprintf(&buffer[len], "[UE PROC] MCH Total %d\n", ue->dlsch_mch_received[0]);
|
||||
|
||||
@@ -38,72 +38,65 @@
|
||||
//#include "defs.h"
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "targets/RT/USER/lte-softmodem.h"
|
||||
|
||||
int generate_pss(int32_t **txdataF,
|
||||
short amp,
|
||||
LTE_DL_FRAME_PARMS *frame_parms,
|
||||
unsigned short symbol,
|
||||
unsigned short slot_offset)
|
||||
{
|
||||
|
||||
unsigned short slot_offset) {
|
||||
unsigned int Nsymb;
|
||||
unsigned short k,m,aa,a;
|
||||
uint8_t Nid2;
|
||||
short *primary_sync;
|
||||
|
||||
|
||||
Nid2 = frame_parms->Nid_cell % 3;
|
||||
|
||||
switch (Nid2) {
|
||||
case 0:
|
||||
primary_sync = primary_synch0;
|
||||
break;
|
||||
case 0:
|
||||
primary_sync = primary_synch0;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
primary_sync = primary_synch1;
|
||||
break;
|
||||
case 1:
|
||||
primary_sync = primary_synch1;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
primary_sync = primary_synch2;
|
||||
break;
|
||||
case 2:
|
||||
primary_sync = primary_synch2;
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_E(PHY,"[PSS] eNb_id has to be 0,1,2\n");
|
||||
return(-1);
|
||||
default:
|
||||
LOG_E(PHY,"[PSS] eNb_id has to be 0,1,2\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
a = (frame_parms->nb_antenna_ports_eNB == 1) ? amp: (amp*ONE_OVER_SQRT2_Q15)>>15;
|
||||
//printf("[PSS] amp=%d, a=%d\n",amp,a);
|
||||
|
||||
#if BASIC_SIMULATOR
|
||||
/* a hack to remove at some point (the UE doesn't synch with 100 RBs) */
|
||||
a = (frame_parms->nb_antenna_ports_eNB == 1) ? 4*amp: (amp*ONE_OVER_SQRT2_Q15)>>15;
|
||||
#endif
|
||||
if (IS_SOFTMODEM_BASICSIM)
|
||||
/* a hack to remove at some point (the UE doesn't synch with 100 RBs) */
|
||||
a = (frame_parms->nb_antenna_ports_eNB == 1) ? 4*amp: (amp*ONE_OVER_SQRT2_Q15)>>15;
|
||||
|
||||
Nsymb = (frame_parms->Ncp==NORMAL)?14:12;
|
||||
|
||||
for (aa=0; aa<frame_parms->nb_antenna_ports_eNB; aa++) {
|
||||
// aa = 0;
|
||||
|
||||
// The PSS occupies the inner 6 RBs, which start at
|
||||
k = frame_parms->ofdm_symbol_size-3*12+5;
|
||||
|
||||
//printf("[PSS] k = %d\n",k);
|
||||
for (m=5; m<67; m++) {
|
||||
((short*)txdataF[aa])[2*(slot_offset*Nsymb/2*frame_parms->ofdm_symbol_size +
|
||||
symbol*frame_parms->ofdm_symbol_size + k)] =
|
||||
(a * primary_sync[2*m]) >> 15;
|
||||
((short*)txdataF[aa])[2*(slot_offset*Nsymb/2*frame_parms->ofdm_symbol_size +
|
||||
symbol*frame_parms->ofdm_symbol_size + k) + 1] =
|
||||
(a * primary_sync[2*m+1]) >> 15;
|
||||
|
||||
((short *)txdataF[aa])[2*(slot_offset*Nsymb/2*frame_parms->ofdm_symbol_size +
|
||||
symbol*frame_parms->ofdm_symbol_size + k)] =
|
||||
(a * primary_sync[2*m]) >> 15;
|
||||
((short *)txdataF[aa])[2*(slot_offset*Nsymb/2*frame_parms->ofdm_symbol_size +
|
||||
symbol*frame_parms->ofdm_symbol_size + k) + 1] =
|
||||
(a * primary_sync[2*m+1]) >> 15;
|
||||
k+=1;
|
||||
|
||||
if (k >= frame_parms->ofdm_symbol_size) {
|
||||
k++; //skip DC
|
||||
k-=frame_parms->ofdm_symbol_size;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -719,20 +719,16 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
int frame,
|
||||
uint8_t subframe,
|
||||
uint8_t pucch1_thres
|
||||
#ifdef Rel14
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
,uint8_t br_flag
|
||||
#endif
|
||||
)
|
||||
)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
|
||||
|
||||
static int first_call=1;
|
||||
LTE_eNB_COMMON *common_vars = &eNB->common_vars;
|
||||
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
|
||||
// PUCCH_CONFIG_DEDICATED *pucch_config_dedicated = &eNB->pucch_config_dedicated[UE_id];
|
||||
|
||||
int8_t sigma2_dB = max(eNB->measurements.n0_subband_power_tot_dB[0],
|
||||
eNB->measurements.n0_subband_power_tot_dB[eNB->frame_parms.N_RB_UL-1]);
|
||||
static int first_call = 1;
|
||||
LTE_eNB_COMMON *common_vars = &eNB->common_vars;
|
||||
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
|
||||
int8_t sigma2_dB = max(eNB->measurements.n0_subband_power_tot_dB[0], eNB->measurements.n0_subband_power_tot_dB[eNB->frame_parms.N_RB_UL-1]);
|
||||
|
||||
uint32_t u,v,n,aa;
|
||||
uint32_t z[12*14];
|
||||
@@ -770,7 +766,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
uint16_t Ret = 0;
|
||||
int16_t SubCarrierDeMapData[NB_ANTENNAS_RX][14][12][2]; //[Antenna][Symbol][Subcarrier][Complex]
|
||||
int16_t CshData_fmt3[NB_ANTENNAS_RX][14][12][2]; //[Antenna][Symbol][Subcarrier][Complex]
|
||||
double delta_theta[NB_ANTENNAS_RX][12]; //[Antenna][Subcarrier][Complex]
|
||||
double delta_theta[NB_ANTENNAS_RX][12]; //[Antenna][Subcarrier][Complex]
|
||||
int16_t ChestValue[NB_ANTENNAS_RX][2][12][2]; //[Antenna][Slot][Subcarrier][Complex]
|
||||
int16_t ChdetAfterValue_fmt3[NB_ANTENNAS_RX][14][12][2]; //[Antenna][Symbol][Subcarrier][Complex]
|
||||
int16_t RemoveFrqDev_fmt3[NB_ANTENNAS_RX][2][5][12][2]; //[Antenna][Slot][PUCCH_Symbol][Subcarrier][Complex]
|
||||
@@ -779,7 +775,6 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
int16_t Fmt3xDataAvgSym[2][12][2]; //[Slot][Subcarrier][Complex]
|
||||
int16_t IFFTOutData_Fmt3[2][12][2]; //[Slot][Subcarrier][Complex]
|
||||
int16_t b[48]; //[bit]
|
||||
//int16_t IP_CsData_allavg[NB_ANTENNAS_RX][12][4][2]; //[Antenna][Symbol][Nouse Cyclic Shift][Complex]
|
||||
int16_t payload_entity = -1;
|
||||
int16_t Interpw;
|
||||
int16_t payload_max;
|
||||
@@ -978,7 +973,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
m = (n1_pucch < thres) ? NRB2 : (((n1_pucch-thres)/(12*c/deltaPUCCH_Shift))+NRB2+((deltaPUCCH_Shift*Ncs1_div_deltaPUCCH_Shift)>>3)+rem);
|
||||
|
||||
#ifdef DEBUG_PUCCH_RX
|
||||
printf("[eNB] PUCCH: m %d\n",m);
|
||||
printf("[eNB] PUCCH: m %d, thres %d, NRB2 %d\n",m,thres,NRB2);
|
||||
#endif
|
||||
nsymb = N_UL_symb<<1;
|
||||
|
||||
@@ -989,7 +984,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
|
||||
//for (j=0,l=0;l<(nsymb-1);l++) {
|
||||
for (j=0,l=0; l<nsymb; l++) {
|
||||
#ifdef Rel14
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
if (br_flag > 0 ) {
|
||||
if ((m&1) == 0)
|
||||
re_offset = (m*6) + frame_parms->first_carrier_offset;
|
||||
@@ -1227,7 +1222,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
|
||||
stat_max/=(12); //normalize to energy per symbol and RE
|
||||
#ifdef DEBUG_PUCCH_RX
|
||||
printf("[eNB] PUCCH fmt1a/b: stat_max : %d, phase_max : %d\n",stat_max,phase_max);
|
||||
LOG_I(PHY,"[eNB] PUCCH fmt1a/b: stat_max : %d (%d : sigma2 %d), phase_max : %d\n",stat_max,dB_fixed(stat_max),sigma2_dB,phase_max);
|
||||
#endif
|
||||
|
||||
stat_re=0;
|
||||
@@ -1368,7 +1363,7 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
|
||||
LOG_D(PHY,"PUCCH 1a/b: subframe %d : stat %d,%d (pos %d)\n",subframe,stat_re,stat_im,
|
||||
(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe]));
|
||||
LOG_D(PHY,"PUCCH 1a/b: subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres);
|
||||
LOG_D(PHY,"In pucch.c PUCCH 1a/b: ACK subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres);
|
||||
|
||||
eNB->pucch1ab_stats[UE_id][(subframe<<11) + 2*(eNB->pucch1ab_stats_cnt[UE_id][subframe])] = (stat_re);
|
||||
eNB->pucch1ab_stats[UE_id][(subframe<<11) + 1+2*(eNB->pucch1ab_stats_cnt[UE_id][subframe])] = (stat_im);
|
||||
@@ -1385,8 +1380,9 @@ uint32_t rx_pucch(PHY_VARS_eNB *eNB,
|
||||
#if defined(USRP_REC_PLAY)
|
||||
LOG_D(PHY,"PUCCH 1a/b: NAK subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres);
|
||||
#else
|
||||
LOG_D(PHY,"PUCCH 1a/b: subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres);
|
||||
#endif
|
||||
LOG_D(PHY,"In pucch.c PUCCH 1a/b: NAK subframe %d : sigma2_dB %d, stat_max %d, pucch1_thres %d\n",subframe,sigma2_dB,dB_fixed(stat_max),pucch1_thres);
|
||||
#endif
|
||||
|
||||
*payload = 4; // DTX
|
||||
((int16_t*)&eNB->pucch1ab_stats[UE_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe])])[0] = (int16_t)(stat_re);
|
||||
((int16_t*)&eNB->pucch1ab_stats[UE_id][(subframe<<10) + (eNB->pucch1ab_stats_cnt[UE_id][subframe])])[1] = (int16_t)(stat_im);
|
||||
|
||||
@@ -153,6 +153,8 @@ typedef struct {
|
||||
#else
|
||||
uint8_t active;
|
||||
#endif
|
||||
/// indicator of UE type (0 = LTE, 1,2 = Cat-M)
|
||||
int ue_type;
|
||||
/// HARQ process mask, indicates which processes are currently active
|
||||
uint16_t harq_mask;
|
||||
/// Indicator of TX activation per subframe. Used during PUCCH detection for ACK/NAK.
|
||||
@@ -327,7 +329,7 @@ typedef struct {
|
||||
uint8_t subframe;
|
||||
/// corresponding UE RNTI
|
||||
uint16_t rnti;
|
||||
/// Type (SR,HARQ,CQI,HARQ_SR,HARQ_CQI,SR_CQI,HARQ_SR_CQI)
|
||||
/// Type (SR, HARQ, CQI, HARQ_SR, HARQ_CQI, SR_CQI, HARQ_SR_CQI)
|
||||
UCI_type_t type;
|
||||
/// SRS active flag
|
||||
uint8_t srs_active;
|
||||
|
||||
@@ -553,7 +553,11 @@ uint32_t rx_pucch(PHY_VARS_eNB *phy_vars_eNB,
|
||||
uint8_t *payload,
|
||||
int frame,
|
||||
uint8_t subframe,
|
||||
uint8_t pucch1_thres);
|
||||
uint8_t pucch1_thres
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
,int br_flag
|
||||
#endif
|
||||
);
|
||||
|
||||
|
||||
/*!
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -687,7 +687,7 @@ void ulsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
ul_ch_mag128_0[i] = _mm_adds_epi16(_mm_srai_epi16(ul_ch_mag128_0[i],1),_mm_srai_epi16(ul_ch_mag128_1[i],1));
|
||||
ul_ch_mag128_0b[i] = _mm_adds_epi16(_mm_srai_epi16(ul_ch_mag128_0b[i],1),_mm_srai_epi16(ul_ch_mag128_1b[i],1));
|
||||
rxdataF_comp128_0[i] = _mm_add_epi16(rxdataF_comp128_0[i],(*(__m128i*)&jitterc[0]));
|
||||
|
||||
}
|
||||
#elif defined(__arm__)
|
||||
rxdataF_comp128_0 = (int16x8_t *)&rxdataF_comp[0][symbol*frame_parms->N_RB_DL*12];
|
||||
rxdataF_comp128_1 = (int16x8_t *)&rxdataF_comp[1][symbol*frame_parms->N_RB_DL*12];
|
||||
@@ -702,10 +702,10 @@ void ulsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
ul_ch_mag128_0[i] = vhaddq_s16(ul_ch_mag128_0[i],ul_ch_mag128_1[i]);
|
||||
ul_ch_mag128_0b[i] = vhaddq_s16(ul_ch_mag128_0b[i],ul_ch_mag128_1b[i]);
|
||||
rxdataF_comp128_0[i] = vqaddq_s16(rxdataF_comp128_0[i],(*(int16x8_t*)&jitterc[0]));
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
@@ -1127,7 +1127,7 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
|
||||
int16_t *llrp;
|
||||
int subframe = proc->subframe_rx;
|
||||
|
||||
#ifdef Rel14
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
if (ulsch[UE_id]->ue_type > 0) harq_pid =0;
|
||||
else
|
||||
#endif
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
|
||||
//#define DEBUG_DCI
|
||||
|
||||
|
||||
#include "../LTE_TRANSPORT/dci_tools_common_extern.h"
|
||||
#include "../LTE_TRANSPORT/transport_proto.h"
|
||||
#include "transport_proto_ue.h"
|
||||
@@ -1281,7 +1282,7 @@ void compute_llr_offset(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
symbol_mod = (symbol >= (7-frame_parms->Ncp))? (symbol-(7-frame_parms->Ncp)) : symbol;
|
||||
if((symbol_mod == 0) || symbol_mod == (4-frame_parms->Ncp))
|
||||
{
|
||||
if (frame_parms->nb_antenna_ports_eNB == 2)
|
||||
if (frame_parms->nb_antenna_ports_eNB == 2)
|
||||
crs_re = 4;
|
||||
else
|
||||
crs_re = 2;
|
||||
@@ -2170,8 +2171,6 @@ int generate_ue_dlsch_params_from_dci(int frame,
|
||||
uint8_t beamforming_mode,
|
||||
uint16_t tc_rnti)
|
||||
{
|
||||
|
||||
uint8_t harq_pid=0;
|
||||
uint8_t frame_type=frame_parms->frame_type;
|
||||
uint8_t tpmi=0;
|
||||
LTE_UE_DLSCH_t *dlsch0=NULL,*dlsch1=NULL;
|
||||
@@ -2487,15 +2486,15 @@ int generate_ue_dlsch_params_from_dci(int frame,
|
||||
case format1E_2A_M10PRB:
|
||||
if (!dlsch[0]) return -1;
|
||||
|
||||
harq_pid = ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->harq_pid;
|
||||
dci_info_extarcted.harq_pid = ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->harq_pid;
|
||||
|
||||
if (harq_pid>=8) {
|
||||
LOG_E(PHY,"Format 1E_2A_M10PRB: harq_pid=%d >= 8\n", harq_pid);
|
||||
if (dci_info_extarcted.harq_pid>=8) {
|
||||
LOG_E(PHY,"Format 1E_2A_M10PRB: harq_pid=%d >= 8\n", dci_info_extarcted.harq_pid);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
dlsch[0]->current_harq_pid = harq_pid;
|
||||
dlsch[0]->harq_ack[subframe].harq_id = harq_pid;
|
||||
dlsch[0]->current_harq_pid = dci_info_extarcted.harq_pid;
|
||||
dlsch[0]->harq_ack[subframe].harq_id = dci_info_extarcted.harq_pid;
|
||||
|
||||
/*
|
||||
tbswap = ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->tb_swap;
|
||||
@@ -2510,7 +2509,7 @@ int generate_ue_dlsch_params_from_dci(int frame,
|
||||
*/
|
||||
dlsch0 = dlsch[0];
|
||||
|
||||
dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
|
||||
dlsch0_harq = dlsch[0]->harq_processes[dci_info_extarcted.harq_pid];
|
||||
// Needs to be checked
|
||||
dlsch0_harq->codeword=0;
|
||||
conv_rballoc(((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->rah,
|
||||
@@ -2626,7 +2625,7 @@ int generate_ue_dlsch_params_from_dci(int frame,
|
||||
// is NAK or an ACK was not received
|
||||
|
||||
dlsch0->harq_ack[subframe].ack = 1;
|
||||
dlsch0->harq_ack[subframe].harq_id = harq_pid;
|
||||
dlsch0->harq_ack[subframe].harq_id = dci_info_extarcted.harq_pid;
|
||||
dlsch0->harq_ack[subframe].send_harq_status = 1;
|
||||
dlsch0->active = 0;
|
||||
return(0);
|
||||
@@ -2682,7 +2681,7 @@ int generate_ue_dlsch_params_from_dci(int frame,
|
||||
{
|
||||
T(T_UE_PHY_DLSCH_UE_DCI, T_INT(0), T_INT(frame%1024), T_INT(subframe),
|
||||
T_INT(dlsch[0]->rnti), T_INT(dci_format),
|
||||
T_INT(harq_pid),
|
||||
T_INT(dci_info_extarcted.harq_pid),
|
||||
T_INT(dlsch0_harq->mcs),
|
||||
T_INT(dlsch0_harq->TBS));
|
||||
}
|
||||
|
||||
@@ -362,6 +362,10 @@ void pdcch_channel_level(int32_t **dl_ch_estimates_ext,
|
||||
#elif defined(__arm__)
|
||||
int16x8_t *dl_ch128;
|
||||
int32x4_t *avg128P;
|
||||
#else
|
||||
int16_t *dl_ch128;
|
||||
int32_t *avg128P;
|
||||
#error Unsupported CPU architecture, cannot build __FILE__
|
||||
#endif
|
||||
for (aatx=0; aatx<frame_parms->nb_antenna_ports_eNB; aatx++)
|
||||
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
||||
@@ -370,7 +374,11 @@ void pdcch_channel_level(int32_t **dl_ch_estimates_ext,
|
||||
avg128P = _mm_setzero_si128();
|
||||
dl_ch128=(__m128i *)&dl_ch_estimates_ext[(aatx<<1)+aarx][0];
|
||||
#elif defined(__arm__)
|
||||
|
||||
dl_ch128=&dl_ch_estimates_ext[(aatx<<1)+aarx][0];
|
||||
#error __arm__ not yet implemented, cannot build __FILE__
|
||||
#else
|
||||
dl_ch128=&dl_ch_estimates_ext[(aatx<<1)+aarx][0];
|
||||
#error Unsupported CPU architecture, cannot build __FILE__
|
||||
#endif
|
||||
for (rb=0; rb<nb_rb; rb++) {
|
||||
|
||||
@@ -379,7 +387,8 @@ void pdcch_channel_level(int32_t **dl_ch_estimates_ext,
|
||||
avg128P = _mm_add_epi32(avg128P,_mm_madd_epi16(dl_ch128[1],dl_ch128[1]));
|
||||
avg128P = _mm_add_epi32(avg128P,_mm_madd_epi16(dl_ch128[2],dl_ch128[2]));
|
||||
#elif defined(__arm__)
|
||||
|
||||
#else
|
||||
#error Unsupported CPU architecture, cannot build __FILE__
|
||||
#endif
|
||||
dl_ch128+=3;
|
||||
/*
|
||||
@@ -423,6 +432,8 @@ void pdcch_detection_mrc_i(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
__m128i *rxdataF_comp128_0,*rxdataF_comp128_1,*rxdataF_comp128_i0,*rxdataF_comp128_i1,*rho128_0,*rho128_1,*rho128_i0,*rho128_i1;
|
||||
#elif defined(__arm__)
|
||||
int16x8_t *rxdataF_comp128_0,*rxdataF_comp128_1,*rxdataF_comp128_i0,*rxdataF_comp128_i1,*rho128_0,*rho128_1,*rho128_i0,*rho128_i1;
|
||||
#else
|
||||
#error Unsupported CPU architecture, cannot build __FILE__
|
||||
#endif
|
||||
int32_t i;
|
||||
|
||||
@@ -436,6 +447,8 @@ void pdcch_detection_mrc_i(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
#elif defined(__arm__)
|
||||
rxdataF_comp128_0 = (int16x8_t *)&rxdataF_comp[(aatx<<1)][symbol*frame_parms->N_RB_DL*12];
|
||||
rxdataF_comp128_1 = (int16x8_t *)&rxdataF_comp[(aatx<<1)+1][symbol*frame_parms->N_RB_DL*12];
|
||||
#else
|
||||
#error Unsupported CPU architecture, cannot build __FILE__
|
||||
#endif
|
||||
// MRC on each re of rb on MF output
|
||||
for (i=0; i<frame_parms->N_RB_DL*3; i++) {
|
||||
|
||||
@@ -40,9 +40,7 @@
|
||||
//#define DEBUG_DLSCH_DECODING
|
||||
//#define UE_DEBUG_TRACE 1
|
||||
|
||||
void free_ue_dlsch(LTE_UE_DLSCH_t *dlsch)
|
||||
{
|
||||
|
||||
void free_ue_dlsch(LTE_UE_DLSCH_t *dlsch) {
|
||||
int i,r;
|
||||
|
||||
if (dlsch) {
|
||||
@@ -70,34 +68,30 @@ void free_ue_dlsch(LTE_UE_DLSCH_t *dlsch)
|
||||
}
|
||||
|
||||
free16(dlsch,sizeof(LTE_UE_DLSCH_t));
|
||||
dlsch = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_turbo_iterations,uint8_t N_RB_DL, uint8_t abstraction_flag)
|
||||
{
|
||||
|
||||
LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_turbo_iterations,uint8_t N_RB_DL, uint8_t abstraction_flag) {
|
||||
LTE_UE_DLSCH_t *dlsch;
|
||||
uint8_t exit_flag = 0,i,r;
|
||||
|
||||
unsigned char bw_scaling =1;
|
||||
|
||||
switch (N_RB_DL) {
|
||||
case 6:
|
||||
bw_scaling =16;
|
||||
break;
|
||||
case 6:
|
||||
bw_scaling =16;
|
||||
break;
|
||||
|
||||
case 25:
|
||||
bw_scaling =4;
|
||||
break;
|
||||
case 25:
|
||||
bw_scaling =4;
|
||||
break;
|
||||
|
||||
case 50:
|
||||
bw_scaling =2;
|
||||
break;
|
||||
case 50:
|
||||
bw_scaling =2;
|
||||
break;
|
||||
|
||||
default:
|
||||
bw_scaling =1;
|
||||
break;
|
||||
default:
|
||||
bw_scaling =1;
|
||||
break;
|
||||
}
|
||||
|
||||
dlsch = (LTE_UE_DLSCH_t *)malloc16(sizeof(LTE_UE_DLSCH_t));
|
||||
@@ -116,7 +110,7 @@ LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_
|
||||
if (dlsch->harq_processes[i]) {
|
||||
memset(dlsch->harq_processes[i],0,sizeof(LTE_DL_UE_HARQ_t));
|
||||
dlsch->harq_processes[i]->first_tx=1;
|
||||
dlsch->harq_processes[i]->b = (uint8_t*)malloc16(MAX_DLSCH_PAYLOAD_BYTES/bw_scaling);
|
||||
dlsch->harq_processes[i]->b = (uint8_t *)malloc16(MAX_DLSCH_PAYLOAD_BYTES/bw_scaling);
|
||||
|
||||
if (dlsch->harq_processes[i]->b)
|
||||
memset(dlsch->harq_processes[i]->b,0,MAX_DLSCH_PAYLOAD_BYTES/bw_scaling);
|
||||
@@ -125,14 +119,14 @@ LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_
|
||||
|
||||
if (abstraction_flag == 0) {
|
||||
for (r=0; r<MAX_NUM_DLSCH_SEGMENTS/bw_scaling; r++) {
|
||||
dlsch->harq_processes[i]->c[r] = (uint8_t*)malloc16(((r==0)?8:0) + 3+ 768);
|
||||
dlsch->harq_processes[i]->c[r] = (uint8_t *)malloc16(((r==0)?8:0) + 3+ 768);
|
||||
|
||||
if (dlsch->harq_processes[i]->c[r])
|
||||
memset(dlsch->harq_processes[i]->c[r],0,((r==0)?8:0) + 3+ 768);
|
||||
else
|
||||
exit_flag=2;
|
||||
|
||||
dlsch->harq_processes[i]->d[r] = (short*)malloc16(((3*8*6144)+12+96)*sizeof(short));
|
||||
dlsch->harq_processes[i]->d[r] = (short *)malloc16(((3*8*6144)+12+96)*sizeof(short));
|
||||
|
||||
if (dlsch->harq_processes[i]->d[r])
|
||||
memset(dlsch->harq_processes[i]->d[r],0,((3*8*6144)+12+96)*sizeof(short));
|
||||
@@ -151,7 +145,6 @@ LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_
|
||||
|
||||
printf("new_ue_dlsch with size %zu: exit_flag = %u\n",sizeof(LTE_DL_UE_HARQ_t), exit_flag);
|
||||
free_ue_dlsch(dlsch);
|
||||
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
@@ -164,9 +157,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
|
||||
uint8_t subframe,
|
||||
uint8_t harq_pid,
|
||||
uint8_t is_crnti,
|
||||
uint8_t llr8_flag)
|
||||
{
|
||||
|
||||
uint8_t llr8_flag) {
|
||||
#if UE_TIMING_TRACE
|
||||
time_stats_t *dlsch_rate_unmatching_stats=&phy_vars_ue->dlsch_rate_unmatching_stats;
|
||||
time_stats_t *dlsch_turbo_decoding_stats=&phy_vars_ue->dlsch_turbo_decoding_stats;
|
||||
@@ -186,26 +177,24 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
|
||||
#if 0
|
||||
int Kr_last,skipped_last=0;
|
||||
uint8_t (*tc_2cw)(int16_t *y,
|
||||
int16_t *y2,
|
||||
uint8_t *,
|
||||
uint8_t *,
|
||||
uint16_t,
|
||||
uint16_t,
|
||||
uint16_t,
|
||||
uint8_t,
|
||||
uint8_t,
|
||||
uint8_t,
|
||||
time_stats_t *,
|
||||
time_stats_t *,
|
||||
time_stats_t *,
|
||||
time_stats_t *,
|
||||
time_stats_t *,
|
||||
time_stats_t *,
|
||||
time_stats_t *);
|
||||
|
||||
int16_t *y2,
|
||||
uint8_t *,
|
||||
uint8_t *,
|
||||
uint16_t,
|
||||
uint16_t,
|
||||
uint16_t,
|
||||
uint8_t,
|
||||
uint8_t,
|
||||
uint8_t,
|
||||
time_stats_t *,
|
||||
time_stats_t *,
|
||||
time_stats_t *,
|
||||
time_stats_t *,
|
||||
time_stats_t *,
|
||||
time_stats_t *,
|
||||
time_stats_t *);
|
||||
#endif
|
||||
decoder_if_t *tc;
|
||||
|
||||
decoder_if_t *tc;
|
||||
|
||||
if (!dlsch_llr) {
|
||||
printf("dlsch_decoding.c: NULL dlsch_llr pointer\n");
|
||||
@@ -229,42 +218,32 @@ decoder_if_t *tc;
|
||||
|
||||
if (dlsch->harq_ack[subframe].ack != 2) {
|
||||
LOG_D(PHY, "[UE %d] DLSCH @ SF%d : ACK bit is %d instead of DTX even before PDSCH is decoded!\n",
|
||||
phy_vars_ue->Mod_id, subframe, dlsch->harq_ack[subframe].ack);
|
||||
phy_vars_ue->Mod_id, subframe, dlsch->harq_ack[subframe].ack);
|
||||
}
|
||||
|
||||
if (llr8_flag == 0) {
|
||||
tc = decoder16;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
AssertFatal (harq_process->TBS >= 256 , "Mismatch flag nbRB=%d TBS=%d mcs=%d Qm=%d RIV=%d round=%d \n",
|
||||
harq_process->nb_rb, harq_process->TBS,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round);
|
||||
harq_process->nb_rb, harq_process->TBS,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round);
|
||||
tc = decoder8;
|
||||
}
|
||||
|
||||
|
||||
// nb_rb = dlsch->nb_rb;
|
||||
|
||||
/*
|
||||
if (nb_rb > frame_parms->N_RB_DL) {
|
||||
printf("dlsch_decoding.c: Illegal nb_rb %d\n",nb_rb);
|
||||
return(max_turbo_iterations);
|
||||
}*/
|
||||
|
||||
/*harq_pid = dlsch->current_harq_pid[phy_vars_ue->current_thread_id[subframe]];
|
||||
if (harq_pid >= 8) {
|
||||
printf("dlsch_decoding.c: Illegal harq_pid %d\n",harq_pid);
|
||||
return(max_turbo_iterations);
|
||||
}
|
||||
*/
|
||||
|
||||
harq_process->trials[harq_process->round]++;
|
||||
|
||||
A = harq_process->TBS; //2072 for QPSK 1/3
|
||||
|
||||
ret = dlsch->max_turbo_iterations;
|
||||
|
||||
|
||||
G = harq_process->G;
|
||||
//get_G(frame_parms,nb_rb,dlsch->rb_alloc,mod_order,num_pdcch_symbols,phy_vars_ue->frame,subframe);
|
||||
|
||||
@@ -293,40 +272,37 @@ decoder_if_t *tc;
|
||||
*/
|
||||
err_flag = 0;
|
||||
r_offset = 0;
|
||||
|
||||
unsigned char bw_scaling =1;
|
||||
|
||||
switch (frame_parms->N_RB_DL) {
|
||||
case 6:
|
||||
bw_scaling =16;
|
||||
break;
|
||||
case 6:
|
||||
bw_scaling =16;
|
||||
break;
|
||||
|
||||
case 25:
|
||||
bw_scaling =4;
|
||||
break;
|
||||
case 25:
|
||||
bw_scaling =4;
|
||||
break;
|
||||
|
||||
case 50:
|
||||
bw_scaling =2;
|
||||
break;
|
||||
case 50:
|
||||
bw_scaling =2;
|
||||
break;
|
||||
|
||||
default:
|
||||
bw_scaling =1;
|
||||
break;
|
||||
default:
|
||||
bw_scaling =1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (harq_process->C > MAX_NUM_DLSCH_SEGMENTS/bw_scaling) {
|
||||
LOG_E(PHY,"Illegal harq_process->C %d > %d\n",harq_process->C,MAX_NUM_DLSCH_SEGMENTS/bw_scaling);
|
||||
return((1+dlsch->max_turbo_iterations));
|
||||
}
|
||||
|
||||
#ifdef DEBUG_DLSCH_DECODING
|
||||
printf("Segmentation: C %d, Cminus %d, Kminus %d, Kplus %d\n",harq_process->C,harq_process->Cminus,harq_process->Kminus,harq_process->Kplus);
|
||||
#endif
|
||||
|
||||
opp_enabled=1;
|
||||
|
||||
for (r=0; r<harq_process->C; r++) {
|
||||
|
||||
|
||||
// Get Turbo interleaver parameters
|
||||
if (r<harq_process->Cminus)
|
||||
Kr = harq_process->Kminus;
|
||||
@@ -334,15 +310,13 @@ decoder_if_t *tc;
|
||||
Kr = harq_process->Kplus;
|
||||
|
||||
Kr_bytes = Kr>>3;
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(dlsch_rate_unmatching_stats);
|
||||
#endif
|
||||
memset(&dummy_w[r][0],0,3*(6144+64)*sizeof(short));
|
||||
harq_process->RTC[r] = generate_dummy_w(4+(Kr_bytes*8),
|
||||
(uint8_t*) &dummy_w[r][0],
|
||||
(uint8_t *) &dummy_w[r][0],
|
||||
(r==0) ? harq_process->F : 0);
|
||||
|
||||
#ifdef DEBUG_DLSCH_DECODING
|
||||
LOG_D(PHY,"HARQ_PID %d Rate Matching Segment %d (coded bits %d,unpunctured/repeated bits %d, TBS %d, mod_order %d, nb_rb %d, Nl %d, rv %d, round %d)...\n",
|
||||
harq_pid,r, G,
|
||||
@@ -354,14 +328,14 @@ decoder_if_t *tc;
|
||||
harq_process->rvidx,
|
||||
harq_process->round);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_DLSCH_DECODING
|
||||
printf(" in decoding dlsch->harq_processes[harq_pid]->rvidx = %d\n", dlsch->harq_processes[harq_pid]->rvidx);
|
||||
#endif
|
||||
|
||||
if (lte_rate_matching_turbo_rx(harq_process->RTC[r],
|
||||
G,
|
||||
harq_process->w[r],
|
||||
(uint8_t*)&dummy_w[r][0],
|
||||
(uint8_t *)&dummy_w[r][0],
|
||||
dlsch_llr+r_offset,
|
||||
harq_process->C,
|
||||
dlsch->Nsoft,
|
||||
@@ -378,14 +352,13 @@ decoder_if_t *tc;
|
||||
#endif
|
||||
LOG_E(PHY,"dlsch_decoding.c: Problem in rate_matching\n");
|
||||
return(dlsch->max_turbo_iterations);
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(dlsch_rate_unmatching_stats);
|
||||
#endif
|
||||
}
|
||||
r_offset += E;
|
||||
|
||||
r_offset += E;
|
||||
/*
|
||||
printf("Subblock deinterleaving, d %p w %p\n",
|
||||
harq_process->d[r],
|
||||
@@ -396,7 +369,6 @@ decoder_if_t *tc;
|
||||
#endif
|
||||
sub_block_deinterleaving_turbo(4+Kr,
|
||||
&harq_process->d[r][96],
|
||||
|
||||
harq_process->w[r]);
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(dlsch_deinterleaving_stats);
|
||||
@@ -413,8 +385,6 @@ decoder_if_t *tc;
|
||||
printf("%d : %d\n",i,harq_process->d[r][96+i]);
|
||||
printf("\n");*/
|
||||
#endif
|
||||
|
||||
|
||||
// printf("Clearing c, %p\n",harq_process->c[r]);
|
||||
memset(harq_process->c[r],0,Kr_bytes);
|
||||
|
||||
@@ -432,21 +402,22 @@ decoder_if_t *tc;
|
||||
printf("%d : %d\n",i,harq_process->d[r][96+i]);
|
||||
printf("\n");
|
||||
*/
|
||||
|
||||
//#ifndef __AVX2__
|
||||
#if 1
|
||||
|
||||
if (err_flag == 0) {
|
||||
/*
|
||||
LOG_I(PHY, "turbo algo Kr=%d cb_cnt=%d C=%d nbRB=%d crc_type %d TBSInput=%d TBSHarq=%d TBSplus24=%d mcs=%d Qm=%d RIV=%d round=%d maxIter %d\n",
|
||||
Kr,r,harq_process->C,harq_process->nb_rb,crc_type,A,harq_process->TBS,
|
||||
harq_process->B,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round,dlsch->max_turbo_iterations);
|
||||
*/
|
||||
if (llr8_flag) {
|
||||
AssertFatal (Kr >= 256, "turbo algo issue Kr=%d cb_cnt=%d C=%d nbRB=%d TBSInput=%d TBSHarq=%d TBSplus24=%d mcs=%d Qm=%d RIV=%d round=%d\n",
|
||||
Kr,r,harq_process->C,harq_process->nb_rb,A,harq_process->TBS,harq_process->B,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round);
|
||||
}
|
||||
/*
|
||||
LOG_I(PHY, "turbo algo Kr=%d cb_cnt=%d C=%d nbRB=%d crc_type %d TBSInput=%d TBSHarq=%d TBSplus24=%d mcs=%d Qm=%d RIV=%d round=%d maxIter %d\n",
|
||||
Kr,r,harq_process->C,harq_process->nb_rb,crc_type,A,harq_process->TBS,
|
||||
harq_process->B,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round,dlsch->max_turbo_iterations);
|
||||
*/
|
||||
if (llr8_flag) {
|
||||
AssertFatal (Kr >= 256, "turbo algo issue Kr=%d cb_cnt=%d C=%d nbRB=%d TBSInput=%d TBSHarq=%d TBSplus24=%d mcs=%d Qm=%d RIV=%d round=%d\n",
|
||||
Kr,r,harq_process->C,harq_process->nb_rb,A,harq_process->TBS,harq_process->B,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round);
|
||||
}
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(dlsch_turbo_decoding_stats);
|
||||
start_meas(dlsch_turbo_decoding_stats);
|
||||
#endif
|
||||
LOG_D(PHY,"AbsSubframe %d.%d Start turbo segment %d/%d \n",frame%1024,subframe,r,harq_process->C-1);
|
||||
ret = tc
|
||||
@@ -465,17 +436,17 @@ decoder_if_t *tc;
|
||||
&phy_vars_ue->dlsch_tc_ext_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl1_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(dlsch_turbo_decoding_stats);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
if ((harq_process->C == 1) ||
|
||||
((r==harq_process->C-1) && (skipped_last==0))) { // last segment with odd number of segments
|
||||
|
||||
#else
|
||||
|
||||
if ((harq_process->C == 1) ||
|
||||
((r==harq_process->C-1) && (skipped_last==0))) { // last segment with odd number of segments
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(dlsch_turbo_decoding_stats);
|
||||
start_meas(dlsch_turbo_decoding_stats);
|
||||
#endif
|
||||
ret = tc
|
||||
(&harq_process->d[r][96],
|
||||
@@ -491,123 +462,115 @@ decoder_if_t *tc;
|
||||
&phy_vars_ue->dlsch_tc_ext_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl1_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
|
||||
#if UE_TIMING_TRACE
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(dlsch_turbo_decoding_stats);
|
||||
#endif
|
||||
// printf("single decode, exit\n");
|
||||
// exit(-1);
|
||||
}
|
||||
else {
|
||||
// we can merge code segments
|
||||
} else {
|
||||
// we can merge code segments
|
||||
if ((skipped_last == 0) && (r<harq_process->C-1)) {
|
||||
skipped_last = 1;
|
||||
Kr_last = Kr;
|
||||
}
|
||||
else {
|
||||
skipped_last=0;
|
||||
skipped_last = 1;
|
||||
Kr_last = Kr;
|
||||
} else {
|
||||
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
|
||||
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]);
|
||||
#endif
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(dlsch_turbo_decoding_stats);
|
||||
start_meas(dlsch_turbo_decoding_stats);
|
||||
#endif
|
||||
#ifdef DEBUG_DLSCH_DECODING
|
||||
printf("double decoding segments %d,%d (%p,%p)\n",r-1,r,&harq_process->d[r-1][96],&harq_process->d[r][96]);
|
||||
printf("double decoding segments %d,%d (%p,%p)\n",r-1,r,&harq_process->d[r-1][96],&harq_process->d[r][96]);
|
||||
#endif
|
||||
ret = tc_2cw
|
||||
(&harq_process->d[r-1][96],
|
||||
&harq_process->d[r][96],
|
||||
harq_process->c[r-1],
|
||||
harq_process->c[r],
|
||||
Kr,
|
||||
dlsch->max_turbo_iterations,
|
||||
crc_type,
|
||||
(r==0) ? harq_process->F : 0,
|
||||
&phy_vars_ue->dlsch_tc_init_stats,
|
||||
&phy_vars_ue->dlsch_tc_alpha_stats,
|
||||
&phy_vars_ue->dlsch_tc_beta_stats,
|
||||
&phy_vars_ue->dlsch_tc_gamma_stats,
|
||||
&phy_vars_ue->dlsch_tc_ext_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl1_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
|
||||
/*
|
||||
ret = tc
|
||||
(&harq_process->d[r-1][96],
|
||||
harq_process->c[r-1],
|
||||
Kr_last,
|
||||
dlsch->max_turbo_iterations,
|
||||
crc_type,
|
||||
(r==0) ? harq_process->F : 0,
|
||||
&phy_vars_ue->dlsch_tc_init_stats,
|
||||
&phy_vars_ue->dlsch_tc_alpha_stats,
|
||||
&phy_vars_ue->dlsch_tc_beta_stats,
|
||||
&phy_vars_ue->dlsch_tc_gamma_stats,
|
||||
&phy_vars_ue->dlsch_tc_ext_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl1_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
|
||||
ret = tc_2cw
|
||||
(&harq_process->d[r-1][96],
|
||||
&harq_process->d[r][96],
|
||||
harq_process->c[r-1],
|
||||
harq_process->c[r],
|
||||
Kr,
|
||||
dlsch->max_turbo_iterations,
|
||||
crc_type,
|
||||
(r==0) ? harq_process->F : 0,
|
||||
&phy_vars_ue->dlsch_tc_init_stats,
|
||||
&phy_vars_ue->dlsch_tc_alpha_stats,
|
||||
&phy_vars_ue->dlsch_tc_beta_stats,
|
||||
&phy_vars_ue->dlsch_tc_gamma_stats,
|
||||
&phy_vars_ue->dlsch_tc_ext_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl1_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
|
||||
/*
|
||||
ret = tc
|
||||
(&harq_process->d[r-1][96],
|
||||
harq_process->c[r-1],
|
||||
Kr_last,
|
||||
dlsch->max_turbo_iterations,
|
||||
crc_type,
|
||||
(r==0) ? harq_process->F : 0,
|
||||
&phy_vars_ue->dlsch_tc_init_stats,
|
||||
&phy_vars_ue->dlsch_tc_alpha_stats,
|
||||
&phy_vars_ue->dlsch_tc_beta_stats,
|
||||
&phy_vars_ue->dlsch_tc_gamma_stats,
|
||||
&phy_vars_ue->dlsch_tc_ext_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl1_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
|
||||
|
||||
exit(-1);*/
|
||||
exit(-1);*/
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(dlsch_turbo_decoding_stats);
|
||||
stop_meas(dlsch_turbo_decoding_stats);
|
||||
#endif
|
||||
}
|
||||
else { // Kr_last != Kr
|
||||
} else { // Kr_last != Kr
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(dlsch_turbo_decoding_stats);
|
||||
start_meas(dlsch_turbo_decoding_stats);
|
||||
#endif
|
||||
ret = tc
|
||||
(&harq_process->d[r-1][96],
|
||||
harq_process->c[r-1],
|
||||
Kr_last,
|
||||
dlsch->max_turbo_iterations,
|
||||
crc_type,
|
||||
(r==0) ? harq_process->F : 0,
|
||||
&phy_vars_ue->dlsch_tc_init_stats,
|
||||
&phy_vars_ue->dlsch_tc_alpha_stats,
|
||||
&phy_vars_ue->dlsch_tc_beta_stats,
|
||||
&phy_vars_ue->dlsch_tc_gamma_stats,
|
||||
&phy_vars_ue->dlsch_tc_ext_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl1_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
|
||||
ret = tc
|
||||
(&harq_process->d[r-1][96],
|
||||
harq_process->c[r-1],
|
||||
Kr_last,
|
||||
dlsch->max_turbo_iterations,
|
||||
crc_type,
|
||||
(r==0) ? harq_process->F : 0,
|
||||
&phy_vars_ue->dlsch_tc_init_stats,
|
||||
&phy_vars_ue->dlsch_tc_alpha_stats,
|
||||
&phy_vars_ue->dlsch_tc_beta_stats,
|
||||
&phy_vars_ue->dlsch_tc_gamma_stats,
|
||||
&phy_vars_ue->dlsch_tc_ext_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl1_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(dlsch_turbo_decoding_stats);
|
||||
|
||||
start_meas(dlsch_turbo_decoding_stats);
|
||||
stop_meas(dlsch_turbo_decoding_stats);
|
||||
start_meas(dlsch_turbo_decoding_stats);
|
||||
#endif
|
||||
|
||||
ret = tc
|
||||
(&harq_process->d[r][96],
|
||||
harq_process->c[r],
|
||||
Kr,
|
||||
dlsch->max_turbo_iterations,
|
||||
crc_type,
|
||||
(r==0) ? harq_process->F : 0,
|
||||
&phy_vars_ue->dlsch_tc_init_stats,
|
||||
&phy_vars_ue->dlsch_tc_alpha_stats,
|
||||
&phy_vars_ue->dlsch_tc_beta_stats,
|
||||
&phy_vars_ue->dlsch_tc_gamma_stats,
|
||||
&phy_vars_ue->dlsch_tc_ext_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl1_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
|
||||
|
||||
ret = tc
|
||||
(&harq_process->d[r][96],
|
||||
harq_process->c[r],
|
||||
Kr,
|
||||
dlsch->max_turbo_iterations,
|
||||
crc_type,
|
||||
(r==0) ? harq_process->F : 0,
|
||||
&phy_vars_ue->dlsch_tc_init_stats,
|
||||
&phy_vars_ue->dlsch_tc_alpha_stats,
|
||||
&phy_vars_ue->dlsch_tc_beta_stats,
|
||||
&phy_vars_ue->dlsch_tc_gamma_stats,
|
||||
&phy_vars_ue->dlsch_tc_ext_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl1_stats,
|
||||
&phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1);
|
||||
#if UE_TIMING_TRACE
|
||||
|
||||
stop_meas(dlsch_turbo_decoding_stats);
|
||||
|
||||
/*printf("Segmentation: C %d r %d, dlsch_rate_unmatching_stats %5.3f dlsch_deinterleaving_stats %5.3f dlsch_turbo_decoding_stats %5.3f \n",
|
||||
harq_process->C,
|
||||
r,
|
||||
dlsch_rate_unmatching_stats->p_time/(cpuf*1000.0),
|
||||
dlsch_deinterleaving_stats->p_time/(cpuf*1000.0),
|
||||
dlsch_turbo_decoding_stats->p_time/(cpuf*1000.0));*/
|
||||
stop_meas(dlsch_turbo_decoding_stats);
|
||||
/*printf("Segmentation: C %d r %d, dlsch_rate_unmatching_stats %5.3f dlsch_deinterleaving_stats %5.3f dlsch_turbo_decoding_stats %5.3f \n",
|
||||
harq_process->C,
|
||||
r,
|
||||
dlsch_rate_unmatching_stats->p_time/(cpuf*1000.0),
|
||||
dlsch_deinterleaving_stats->p_time/(cpuf*1000.0),
|
||||
dlsch_turbo_decoding_stats->p_time/(cpuf*1000.0));*/
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
if ((err_flag == 0) && (ret>=(1+dlsch->max_turbo_iterations))) {// a Code segment is in error so break;
|
||||
LOG_D(PHY,"AbsSubframe %d.%d CRC failed, segment %d/%d \n",frame%1024,subframe,r,harq_process->C-1);
|
||||
@@ -617,16 +580,18 @@ decoder_if_t *tc;
|
||||
|
||||
int32_t frame_rx_prev = frame;
|
||||
int32_t subframe_rx_prev = subframe - 1;
|
||||
|
||||
if (subframe_rx_prev < 0) {
|
||||
frame_rx_prev--;
|
||||
subframe_rx_prev += 10;
|
||||
}
|
||||
|
||||
frame_rx_prev = frame_rx_prev%1024;
|
||||
|
||||
if (err_flag == 1) {
|
||||
#if UE_DEBUG_TRACE
|
||||
LOG_D(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d) Kr %d r %d harq_process->round %d\n",
|
||||
phy_vars_ue->Mod_id, frame, subframe, harq_pid,harq_process->status, harq_process->round,harq_process->TBS,harq_process->mcs,Kr,r,harq_process->round);
|
||||
phy_vars_ue->Mod_id, frame, subframe, harq_pid,harq_process->status, harq_process->round,harq_process->TBS,harq_process->mcs,Kr,r,harq_process->round);
|
||||
#endif
|
||||
dlsch->harq_ack[subframe].ack = 0;
|
||||
dlsch->harq_ack[subframe].harq_id = harq_pid;
|
||||
@@ -634,39 +599,36 @@ decoder_if_t *tc;
|
||||
harq_process->errors[harq_process->round]++;
|
||||
harq_process->round++;
|
||||
|
||||
|
||||
// printf("Rate: [UE %d] DLSCH: Setting NACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round);
|
||||
if (harq_process->round >= dlsch->Mdlharq) {
|
||||
harq_process->status = SCH_IDLE;
|
||||
harq_process->round = 0;
|
||||
}
|
||||
if(is_crnti)
|
||||
{
|
||||
LOG_D(PHY,"[UE %d] DLSCH: Setting NACK for subframe %d (pid %d, pid status %d, round %d/Max %d, TBS %d)\n",
|
||||
phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->status,harq_process->round,dlsch->Mdlharq,harq_process->TBS);
|
||||
|
||||
if(is_crnti) {
|
||||
LOG_D(PHY,"[UE %d] DLSCH: Setting NACK for subframe %d (pid %d, pid status %d, round %d/Max %d, TBS %d)\n",
|
||||
phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->status,harq_process->round,dlsch->Mdlharq,harq_process->TBS);
|
||||
}
|
||||
|
||||
return((1+dlsch->max_turbo_iterations));
|
||||
} else {
|
||||
#if UE_DEBUG_TRACE
|
||||
LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d TBS %d mcs %d nb_rb %d\n",
|
||||
phy_vars_ue->Mod_id,subframe,harq_process->TBS,harq_process->mcs,harq_process->nb_rb);
|
||||
LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d TBS %d mcs %d nb_rb %d\n",
|
||||
phy_vars_ue->Mod_id,subframe,harq_process->TBS,harq_process->mcs,harq_process->nb_rb);
|
||||
#endif
|
||||
|
||||
harq_process->status = SCH_IDLE;
|
||||
harq_process->round = 0;
|
||||
dlsch->harq_ack[subframe].ack = 1;
|
||||
dlsch->harq_ack[subframe].harq_id = harq_pid;
|
||||
dlsch->harq_ack[subframe].send_harq_status = 1;
|
||||
//LOG_I(PHY,"[UE %d] DLSCH: Setting ACK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d)\n",
|
||||
// phy_vars_ue->Mod_id, frame, subframe, harq_pid, harq_process->status, harq_process->round,harq_process->TBS,harq_process->mcs);
|
||||
// phy_vars_ue->Mod_id, frame, subframe, harq_pid, harq_process->status, harq_process->round,harq_process->TBS,harq_process->mcs);
|
||||
|
||||
if(is_crnti)
|
||||
{
|
||||
LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d (pid %d, round %d, TBS %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round,harq_process->TBS);
|
||||
if(is_crnti) {
|
||||
LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d (pid %d, round %d, TBS %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round,harq_process->TBS);
|
||||
}
|
||||
//LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round);
|
||||
|
||||
//LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round);
|
||||
}
|
||||
|
||||
// Reassembly of Transport block here
|
||||
@@ -706,24 +668,20 @@ decoder_if_t *tc;
|
||||
}
|
||||
|
||||
dlsch->last_iteration_cnt = ret;
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int dlsch_encoding_SIC(PHY_VARS_UE *ue,
|
||||
unsigned char *a,
|
||||
uint8_t num_pdcch_symbols,
|
||||
LTE_eNB_DLSCH_t *dlsch,
|
||||
int frame,
|
||||
uint8_t subframe,
|
||||
time_stats_t *rm_stats,
|
||||
time_stats_t *te_stats,
|
||||
time_stats_t *i_stats)
|
||||
{
|
||||
|
||||
unsigned char *a,
|
||||
uint8_t num_pdcch_symbols,
|
||||
LTE_eNB_DLSCH_t *dlsch,
|
||||
int frame,
|
||||
uint8_t subframe,
|
||||
time_stats_t *rm_stats,
|
||||
time_stats_t *te_stats,
|
||||
time_stats_t *i_stats) {
|
||||
unsigned int G;
|
||||
unsigned int crc=1;
|
||||
|
||||
LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
|
||||
unsigned char harq_pid = ue->dlsch[subframe&2][0][0]->rnti;
|
||||
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb;
|
||||
@@ -732,9 +690,7 @@ int dlsch_encoding_SIC(PHY_VARS_UE *ue,
|
||||
unsigned int Kr=0,Kr_bytes,r,r_offset=0;
|
||||
// unsigned short m=dlsch->harq_processes[harq_pid]->mcs;
|
||||
uint8_t beamforming_mode=0;
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN);
|
||||
|
||||
A = dlsch->harq_processes[harq_pid]->TBS; //6228
|
||||
// printf("Encoder: A: %d\n",A);
|
||||
mod_order = dlsch->harq_processes[harq_pid]->Qm;
|
||||
@@ -745,13 +701,13 @@ int dlsch_encoding_SIC(PHY_VARS_UE *ue,
|
||||
beamforming_mode = 8;
|
||||
else if(dlsch->harq_processes[harq_pid]->mimo_mode == TM9_10)
|
||||
beamforming_mode = 9;
|
||||
G = get_G(frame_parms,nb_rb,dlsch->harq_processes[harq_pid]->rb_alloc,mod_order,dlsch->harq_processes[harq_pid]->Nl,num_pdcch_symbols,frame,subframe,beamforming_mode);
|
||||
|
||||
G = get_G(frame_parms,nb_rb,dlsch->harq_processes[harq_pid]->rb_alloc,mod_order,dlsch->harq_processes[harq_pid]->Nl,num_pdcch_symbols,frame,subframe,beamforming_mode);
|
||||
|
||||
// if (dlsch->harq_processes[harq_pid]->Ndi == 1) { // this is a new packet
|
||||
if (dlsch->harq_processes[harq_pid]->round == 0) { // this is a new packet
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
printf("SIC encoding thinks this is a new packet \n");
|
||||
printf("SIC encoding thinks this is a new packet \n");
|
||||
#endif
|
||||
/*
|
||||
int i;
|
||||
@@ -763,11 +719,10 @@ int dlsch_encoding_SIC(PHY_VARS_UE *ue,
|
||||
// Add 24-bit crc (polynomial A) to payload
|
||||
crc = crc24a(a,
|
||||
A)>>8;
|
||||
a[A>>3] = ((uint8_t*)&crc)[2];
|
||||
a[1+(A>>3)] = ((uint8_t*)&crc)[1];
|
||||
a[2+(A>>3)] = ((uint8_t*)&crc)[0];
|
||||
a[A>>3] = ((uint8_t *)&crc)[2];
|
||||
a[1+(A>>3)] = ((uint8_t *)&crc)[1];
|
||||
a[2+(A>>3)] = ((uint8_t *)&crc)[0];
|
||||
// printf("CRC %x (A %d)\n",crc,A);
|
||||
|
||||
dlsch->harq_processes[harq_pid]->B = A+24;
|
||||
// dlsch->harq_processes[harq_pid]->b = a;
|
||||
memcpy(dlsch->harq_processes[harq_pid]->b,a,(A/8)+4);
|
||||
@@ -784,25 +739,20 @@ int dlsch_encoding_SIC(PHY_VARS_UE *ue,
|
||||
return(-1);
|
||||
|
||||
for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
|
||||
|
||||
if (r<dlsch->harq_processes[harq_pid]->Cminus)
|
||||
Kr = dlsch->harq_processes[harq_pid]->Kminus;
|
||||
else
|
||||
Kr = dlsch->harq_processes[harq_pid]->Kplus;
|
||||
|
||||
Kr_bytes = Kr>>3;
|
||||
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
printf("Generating Code Segment %d (%d bits)\n",r,Kr);
|
||||
printf("Generating Code Segment %u (%u bits)\n",r,Kr);
|
||||
// generate codewords
|
||||
|
||||
printf("bits_per_codeword (Kr)= %d, A %d\n",Kr,A);
|
||||
printf("bits_per_codeword (Kr)= %u, A %u\n",Kr,A);
|
||||
printf("N_RB = %d\n",nb_rb);
|
||||
printf("Ncp %d\n",frame_parms->Ncp);
|
||||
printf("mod_order %d\n",mod_order);
|
||||
#endif
|
||||
|
||||
|
||||
start_meas(te_stats);
|
||||
encoder(dlsch->harq_processes[harq_pid]->c[r],
|
||||
Kr>>3,
|
||||
@@ -823,7 +773,6 @@ int dlsch_encoding_SIC(PHY_VARS_UE *ue,
|
||||
dlsch->harq_processes[harq_pid]->w[r]);
|
||||
stop_meas(i_stats);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Fill in the "e"-sequence from 36-212, V8.6 2009-03, p. 16-17 (for each "e") and concatenate the
|
||||
@@ -831,13 +780,12 @@ int dlsch_encoding_SIC(PHY_VARS_UE *ue,
|
||||
|
||||
for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
printf("Rate Matching, Code segment %d (coded bits (G) %d,unpunctured/repeated bits per code segment %d,mod_order %d, nb_rb %d)...\n",
|
||||
r,
|
||||
G,
|
||||
Kr*3,
|
||||
mod_order,nb_rb);
|
||||
printf("Rate Matching, Code segment %u (coded bits (G) %u,unpunctured/repeated bits per code segment %u,mod_order %d, nb_rb %d)...\n",
|
||||
r,
|
||||
G,
|
||||
Kr*3,
|
||||
mod_order,nb_rb);
|
||||
#endif
|
||||
|
||||
start_meas(rm_stats);
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
printf("rvidx in SIC encoding = %d\n", dlsch->harq_processes[harq_pid]->rvidx);
|
||||
@@ -866,6 +814,5 @@ int dlsch_encoding_SIC(PHY_VARS_UE *ue,
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -672,7 +672,7 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
len = (nb_rb*12) - pbch_pss_sss_adjust;
|
||||
}
|
||||
|
||||
|
||||
|
||||
LOG_D(PHY,"[p %d : symb %d / FirstSym %d / Length %d]: @LLR Buff %p, @LLR Buff(symb) %p \n",
|
||||
frame_parms->nb_antenna_ports_eNB,
|
||||
symbol,
|
||||
@@ -680,7 +680,7 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
len,
|
||||
dlsch_llr,
|
||||
llr32);
|
||||
|
||||
|
||||
|
||||
qpsk_llr((short *)rxF,
|
||||
(short *)llr32,
|
||||
|
||||
@@ -48,7 +48,7 @@ int init_ue_paging_info(PHY_VARS_UE *ue, long defaultPagingCycle, long nB) {
|
||||
else if (Ns==4)
|
||||
ue->PO = (fp->frame_type==FDD) ? (4*(i_s&1)+(5*(i_s>>1))) : ((i_s&1)+(5*(i_s>>1)));
|
||||
else
|
||||
AssertFatal(1==0,"init_ue_paging_info: Ns is %d\n",Ns);
|
||||
AssertFatal(1==0,"init_ue_paging_info: Ns is %u\n",Ns);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -1375,7 +1375,7 @@ void init_ul_hopping(LTE_DL_FRAME_PARMS *frame_parms);
|
||||
@param nB nB from 36.304 (0=4T,1=2T,2=T,3=T/2,4=T/4,5=T/8,6=T/16,7=T/32*/
|
||||
int init_ue_paging_info(PHY_VARS_UE *ue, long defaultPagingCycle, long nB);
|
||||
|
||||
#ifdef Rel14
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
void init_mpdcch(PHY_VARS_eNB *eNB);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -80,7 +80,6 @@ void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch)
|
||||
}
|
||||
}
|
||||
free16(ulsch,sizeof(LTE_UE_ULSCH_t));
|
||||
ulsch = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ int f_read(char *calibF_fname, int nb_ant, int nb_freq, int32_t **tdd_calib_coef
|
||||
}
|
||||
printf("%d\n",(int)tdd_calib_coeffs[0][0]);
|
||||
printf("%d\n",(int)tdd_calib_coeffs[1][599]);
|
||||
fclose(calibF_fd);
|
||||
} else
|
||||
printf("%s not found, running with defaults\n",calibF_fname);
|
||||
/* TODO: what to return? is this code used at all? */
|
||||
|
||||
@@ -33,9 +33,7 @@ int slot_fep(PHY_VARS_UE *ue,
|
||||
unsigned char Ns,
|
||||
int sample_offset,
|
||||
int no_prefix,
|
||||
int reset_freq_est)
|
||||
{
|
||||
|
||||
int reset_freq_est) {
|
||||
LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
|
||||
LTE_UE_COMMON *common_vars = &ue->common_vars;
|
||||
uint8_t eNB_id = 0;//ue_common_vars->eNb_id;
|
||||
@@ -48,43 +46,41 @@ int slot_fep(PHY_VARS_UE *ue,
|
||||
int i;
|
||||
unsigned int frame_length_samples = frame_parms->samples_per_tti * 10;
|
||||
unsigned int rx_offset;
|
||||
|
||||
/*LTE_UE_DLSCH_t **dlsch_ue = phy_vars_ue->dlsch_ue[eNB_id];
|
||||
unsigned char harq_pid = dlsch_ue[0]->current_harq_pid;
|
||||
unsigned char harq_pid = dlsch_ue[0]->current_harq_pid;
|
||||
LTE_DL_UE_HARQ_t *dlsch0_harq = dlsch_ue[0]->harq_processes[harq_pid];
|
||||
int uespec_pilot[9][1200];*/
|
||||
|
||||
void (*dft)(int16_t *,int16_t *, int);
|
||||
int tmp_dft_in[2048] __attribute__ ((aligned (32))); // This is for misalignment issues for 6 and 15 PRBs
|
||||
|
||||
switch (frame_parms->ofdm_symbol_size) {
|
||||
case 128:
|
||||
dft = dft128;
|
||||
break;
|
||||
case 128:
|
||||
dft = dft128;
|
||||
break;
|
||||
|
||||
case 256:
|
||||
dft = dft256;
|
||||
break;
|
||||
case 256:
|
||||
dft = dft256;
|
||||
break;
|
||||
|
||||
case 512:
|
||||
dft = dft512;
|
||||
break;
|
||||
case 512:
|
||||
dft = dft512;
|
||||
break;
|
||||
|
||||
case 1024:
|
||||
dft = dft1024;
|
||||
break;
|
||||
case 1024:
|
||||
dft = dft1024;
|
||||
break;
|
||||
|
||||
case 1536:
|
||||
dft = dft1536;
|
||||
break;
|
||||
case 1536:
|
||||
dft = dft1536;
|
||||
break;
|
||||
|
||||
case 2048:
|
||||
dft = dft2048;
|
||||
break;
|
||||
case 2048:
|
||||
dft = dft2048;
|
||||
break;
|
||||
|
||||
default:
|
||||
dft = dft512;
|
||||
break;
|
||||
default:
|
||||
dft = dft512;
|
||||
break;
|
||||
}
|
||||
|
||||
if (no_prefix) {
|
||||
@@ -97,7 +93,6 @@ int slot_fep(PHY_VARS_UE *ue,
|
||||
|
||||
// subframe_offset_F = frame_parms->ofdm_symbol_size * frame_parms->symbols_per_tti * (Ns>>1);
|
||||
|
||||
|
||||
if (l<0 || l>=7-frame_parms->Ncp) {
|
||||
printf("slot_fep: l must be between 0 and %d\n",7-frame_parms->Ncp);
|
||||
return(-1);
|
||||
@@ -108,17 +103,13 @@ int slot_fep(PHY_VARS_UE *ue,
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
|
||||
memset(&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int));
|
||||
|
||||
rx_offset = sample_offset + slot_offset + nb_prefix_samples0 + subframe_offset - SOFFSET;
|
||||
// Align with 256 bit
|
||||
// rx_offset = rx_offset&0xfffffff8;
|
||||
|
||||
if (l==0) {
|
||||
|
||||
if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size))
|
||||
memcpy((short *)&common_vars->rxdata[aa][frame_length_samples],
|
||||
(short *)&common_vars->rxdata[aa][0],
|
||||
@@ -132,30 +123,29 @@ int slot_fep(PHY_VARS_UE *ue,
|
||||
(int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
|
||||
} else { // use dft input from RX buffer directly
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(&ue->rx_dft_stats);
|
||||
start_meas(&ue->rx_dft_stats);
|
||||
#endif
|
||||
|
||||
dft((int16_t *)&common_vars->rxdata[aa][(rx_offset) % frame_length_samples],
|
||||
(int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(&ue->rx_dft_stats);
|
||||
#endif
|
||||
|
||||
}
|
||||
} else {
|
||||
rx_offset += (frame_parms->ofdm_symbol_size+nb_prefix_samples)*l;// +
|
||||
// (frame_parms->ofdm_symbol_size+nb_prefix_samples)*(l-1);
|
||||
|
||||
#ifdef DEBUG_FEP
|
||||
// if (ue->frame <100)
|
||||
LOG_I(PHY,"slot_fep: frame %d: slot %d, symbol %d, nb_prefix_samples %d, nb_prefix_samples0 %d, slot_offset %d, subframe_offset %d, sample_offset %d,rx_offset %d, frame_length_samples %d\n", ue->proc.proc_rxtx[(Ns>>1)&1].frame_rx,Ns, symbol,
|
||||
nb_prefix_samples,nb_prefix_samples0,slot_offset,subframe_offset,sample_offset,rx_offset,frame_length_samples);
|
||||
LOG_I(PHY,"slot_fep: frame %d: slot %d, symbol %d, nb_prefix_samples %d, nb_prefix_samples0 %d, slot_offset %d, subframe_offset %d, sample_offset %d,rx_offset %d, frame_length_samples %d\n",
|
||||
ue->proc.proc_rxtx[(Ns>>1)&1].frame_rx,Ns, symbol,
|
||||
nb_prefix_samples,nb_prefix_samples0,slot_offset,subframe_offset,sample_offset,rx_offset,frame_length_samples);
|
||||
#endif
|
||||
|
||||
if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size))
|
||||
memcpy((void *)&common_vars->rxdata[aa][frame_length_samples],
|
||||
(void *)&common_vars->rxdata[aa][0],
|
||||
frame_parms->ofdm_symbol_size*sizeof(int));
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(&ue->rx_dft_stats);
|
||||
#endif
|
||||
@@ -167,27 +157,25 @@ int slot_fep(PHY_VARS_UE *ue,
|
||||
dft((int16_t *)tmp_dft_in,
|
||||
(int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
|
||||
} else { // use dft input from RX buffer directly
|
||||
|
||||
dft((int16_t *)&common_vars->rxdata[aa][(rx_offset) % frame_length_samples],
|
||||
(int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
|
||||
}
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(&ue->rx_dft_stats);
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
#ifdef DEBUG_FEP
|
||||
// if (ue->frame <100)
|
||||
printf("slot_fep: frame %d: symbol %d rx_offset %d\n", ue->proc.proc_rxtx[(Ns>>1)&1].frame_rx, symbol,rx_offset);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_FEP
|
||||
// if (ue->frame <100)
|
||||
printf("slot_fep: frame %d: symbol %d rx_offset %u\n", ue->proc.proc_rxtx[(Ns>>1)&1].frame_rx, symbol,rx_offset);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (ue->perfect_ce == 0) {
|
||||
if ((l==0) || (l==(4-frame_parms->Ncp))) {
|
||||
for (aa=0; aa<frame_parms->nb_antenna_ports_eNB; aa++) {
|
||||
|
||||
#ifdef DEBUG_FEP
|
||||
printf("Channel estimation eNB %d, aatx %d, slot %d, symbol %d\n",eNB_id,aa,Ns,l);
|
||||
#endif
|
||||
@@ -212,7 +200,6 @@ int slot_fep(PHY_VARS_UE *ue,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// do frequency offset estimation here!
|
||||
// use channel estimates from current symbol (=ch_t) and last symbol (ch_{t-1})
|
||||
#ifdef DEBUG_FEP
|
||||
@@ -220,23 +207,19 @@ int slot_fep(PHY_VARS_UE *ue,
|
||||
#endif
|
||||
|
||||
if (l==(4-frame_parms->Ncp)) {
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(&ue->dlsch_freq_offset_estimation_stats);
|
||||
start_meas(&ue->dlsch_freq_offset_estimation_stats);
|
||||
#endif
|
||||
|
||||
lte_est_freq_offset(common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].dl_ch_estimates[0],
|
||||
frame_parms,
|
||||
l,
|
||||
&common_vars->freq_offset,
|
||||
reset_freq_est);
|
||||
reset_freq_est);
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(&ue->dlsch_freq_offset_estimation_stats);
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#ifdef DEBUG_FEP
|
||||
@@ -246,11 +229,10 @@ int slot_fep(PHY_VARS_UE *ue,
|
||||
}
|
||||
|
||||
int front_end_fft(PHY_VARS_UE *ue,
|
||||
unsigned char l,
|
||||
unsigned char Ns,
|
||||
int sample_offset,
|
||||
int no_prefix)
|
||||
{
|
||||
unsigned char l,
|
||||
unsigned char Ns,
|
||||
int sample_offset,
|
||||
int no_prefix) {
|
||||
LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
|
||||
LTE_UE_COMMON *common_vars = &ue->common_vars;
|
||||
unsigned char aa;
|
||||
@@ -262,43 +244,41 @@ int front_end_fft(PHY_VARS_UE *ue,
|
||||
unsigned int frame_length_samples = frame_parms->samples_per_tti * 10;
|
||||
unsigned int rx_offset;
|
||||
uint8_t threadId;
|
||||
|
||||
/*LTE_UE_DLSCH_t **dlsch_ue = phy_vars_ue->dlsch_ue[eNB_id];
|
||||
unsigned char harq_pid = dlsch_ue[0]->current_harq_pid;
|
||||
LTE_DL_UE_HARQ_t *dlsch0_harq = dlsch_ue[0]->harq_processes[harq_pid];
|
||||
int uespec_pilot[9][1200];*/
|
||||
|
||||
void (*dft)(int16_t *,int16_t *, int);
|
||||
int tmp_dft_in[2048] __attribute__ ((aligned (32))); // This is for misalignment issues for 6 and 15 PRBs
|
||||
|
||||
switch (frame_parms->ofdm_symbol_size) {
|
||||
case 128:
|
||||
dft = dft128;
|
||||
break;
|
||||
case 128:
|
||||
dft = dft128;
|
||||
break;
|
||||
|
||||
case 256:
|
||||
dft = dft256;
|
||||
break;
|
||||
case 256:
|
||||
dft = dft256;
|
||||
break;
|
||||
|
||||
case 512:
|
||||
dft = dft512;
|
||||
break;
|
||||
case 512:
|
||||
dft = dft512;
|
||||
break;
|
||||
|
||||
case 1024:
|
||||
dft = dft1024;
|
||||
break;
|
||||
case 1024:
|
||||
dft = dft1024;
|
||||
break;
|
||||
|
||||
case 1536:
|
||||
dft = dft1536;
|
||||
break;
|
||||
case 1536:
|
||||
dft = dft1536;
|
||||
break;
|
||||
|
||||
case 2048:
|
||||
dft = dft2048;
|
||||
break;
|
||||
case 2048:
|
||||
dft = dft2048;
|
||||
break;
|
||||
|
||||
default:
|
||||
dft = dft512;
|
||||
break;
|
||||
default:
|
||||
dft = dft512;
|
||||
break;
|
||||
}
|
||||
|
||||
if (no_prefix) {
|
||||
@@ -311,7 +291,6 @@ int front_end_fft(PHY_VARS_UE *ue,
|
||||
|
||||
// subframe_offset_F = frame_parms->ofdm_symbol_size * frame_parms->symbols_per_tti * (Ns>>1);
|
||||
|
||||
|
||||
if (l<0 || l>=7-frame_parms->Ncp) {
|
||||
printf("slot_fep: l must be between 0 and %d\n",7-frame_parms->Ncp);
|
||||
return(-1);
|
||||
@@ -322,19 +301,16 @@ int front_end_fft(PHY_VARS_UE *ue,
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
threadId = ue->current_thread_id[Ns>>1];
|
||||
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
|
||||
// change thread index
|
||||
memset(&common_vars->common_vars_rx_data_per_thread[threadId].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int));
|
||||
|
||||
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
|
||||
// change thread index
|
||||
memset(&common_vars->common_vars_rx_data_per_thread[threadId].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int));
|
||||
rx_offset = sample_offset + slot_offset + nb_prefix_samples0 + subframe_offset - SOFFSET;
|
||||
// Align with 256 bit
|
||||
// rx_offset = rx_offset&0xfffffff8;
|
||||
|
||||
if (l==0) {
|
||||
|
||||
if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size))
|
||||
memcpy((short *)&common_vars->rxdata[aa][frame_length_samples],
|
||||
(short *)&common_vars->rxdata[aa][0],
|
||||
@@ -348,21 +324,19 @@ int front_end_fft(PHY_VARS_UE *ue,
|
||||
(int16_t *)&common_vars->common_vars_rx_data_per_thread[threadId].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
|
||||
} else { // use dft input from RX buffer directly
|
||||
start_meas(&ue->rx_dft_stats);
|
||||
|
||||
dft((int16_t *)&common_vars->rxdata[aa][(rx_offset) % frame_length_samples],
|
||||
(int16_t *)&common_vars->common_vars_rx_data_per_thread[threadId].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
|
||||
stop_meas(&ue->rx_dft_stats);
|
||||
|
||||
}
|
||||
} else {
|
||||
rx_offset += (frame_parms->ofdm_symbol_size+nb_prefix_samples)*l;// +
|
||||
// (frame_parms->ofdm_symbol_size+nb_prefix_samples)*(l-1);
|
||||
|
||||
#ifdef DEBUG_FEP
|
||||
// if (ue->frame <100)
|
||||
LOG_I(PHY,"slot_fep: frame %d: slot %d, threadId %d, symbol %d, nb_prefix_samples %d, nb_prefix_samples0 %d, slot_offset %d, subframe_offset %d, sample_offset %d,rx_offset %d, frame_length_samples %d\n",
|
||||
ue->proc.proc_rxtx[threadId].frame_rx,Ns, threadId,symbol,
|
||||
nb_prefix_samples,nb_prefix_samples0,slot_offset,subframe_offset,sample_offset,rx_offset,frame_length_samples);
|
||||
LOG_I(PHY,
|
||||
"slot_fep: frame %d: slot %d, threadId %d, symbol %d, nb_prefix_samples %d, nb_prefix_samples0 %d, slot_offset %d, subframe_offset %d, sample_offset %d,rx_offset %d, frame_length_samples %d\n",
|
||||
ue->proc.proc_rxtx[threadId].frame_rx,Ns, threadId,symbol,
|
||||
nb_prefix_samples,nb_prefix_samples0,slot_offset,subframe_offset,sample_offset,rx_offset,frame_length_samples);
|
||||
#endif
|
||||
|
||||
if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size))
|
||||
@@ -379,29 +353,27 @@ int front_end_fft(PHY_VARS_UE *ue,
|
||||
dft((int16_t *)tmp_dft_in,
|
||||
(int16_t *)&common_vars->common_vars_rx_data_per_thread[threadId].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
|
||||
} else { // use dft input from RX buffer directly
|
||||
|
||||
dft((int16_t *)&common_vars->rxdata[aa][(rx_offset) % frame_length_samples],
|
||||
(int16_t *)&common_vars->common_vars_rx_data_per_thread[threadId].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
|
||||
}
|
||||
|
||||
stop_meas(&ue->rx_dft_stats);
|
||||
|
||||
|
||||
}
|
||||
|
||||
#ifdef DEBUG_FEP
|
||||
// if (ue->frame <100)
|
||||
printf("slot_fep: frame %d: symbol %d rx_offset %d\n", ue->proc.proc_rxtx[threadId].frame_rx, symbol,rx_offset);
|
||||
#endif
|
||||
#ifdef DEBUG_FEP
|
||||
// if (ue->frame <100)
|
||||
printf("slot_fep: frame %d: symbol %d rx_offset %u\n", ue->proc.proc_rxtx[threadId].frame_rx, symbol,rx_offset);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int front_end_chanEst(PHY_VARS_UE *ue,
|
||||
unsigned char l,
|
||||
unsigned char Ns,
|
||||
int reset_freq_est)
|
||||
{
|
||||
unsigned char l,
|
||||
unsigned char Ns,
|
||||
int reset_freq_est) {
|
||||
LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
|
||||
LTE_UE_COMMON *common_vars = &ue->common_vars;
|
||||
uint8_t eNB_id = 0;//ue_common_vars->eNb_id;
|
||||
@@ -417,7 +389,6 @@ int front_end_chanEst(PHY_VARS_UE *ue,
|
||||
if (ue->perfect_ce == 0) {
|
||||
if ((l==0) || (l==(4-frame_parms->Ncp))) {
|
||||
for (aa=0; aa<frame_parms->nb_antenna_ports_eNB; aa++) {
|
||||
|
||||
#ifdef DEBUG_FEP
|
||||
printf("Channel estimation eNB %d, aatx %d, slot %d, symbol %d\n",eNB_id,aa,Ns,l);
|
||||
#endif
|
||||
@@ -438,7 +409,6 @@ int front_end_chanEst(PHY_VARS_UE *ue,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// do frequency offset estimation here!
|
||||
// use channel estimates from current symbol (=ch_t) and last symbol (ch_{t-1})
|
||||
#ifdef DEBUG_FEP
|
||||
@@ -451,12 +421,11 @@ int front_end_chanEst(PHY_VARS_UE *ue,
|
||||
frame_parms,
|
||||
l,
|
||||
&common_vars->freq_offset,
|
||||
reset_freq_est);
|
||||
reset_freq_est);
|
||||
stop_meas(&ue->dlsch_freq_offset_estimation_stats);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -9494,7 +9494,7 @@ int main(int argc, char**argv)
|
||||
LOG_M("x24576.m","x24576",x,24576,1,1);
|
||||
|
||||
int dftsizes[33]={24,36,48,60,72,96,108,120,144,180,192,216,240,288,300,324,360,384,432,480,540,576,600,648,720,768,864,900,960,972,1080,1152,1200};
|
||||
void (*dft[33])(int16_t *x,int16_t *y,uint8_t scale) = {dft24,dft36,dft48,dft60,dft72,dft96,dft108,dft120,dft144,dft180,dft192,dft216,dft240,dft288,dft300,dft324,dft360,dft384,dft432,dft480,dft540,dft576,dft600,dft648,dft720,dft768,dft864,dft900,dft960,dft972,dft1080,dft1152,dft1200};
|
||||
void (*dft)(int16_t *x,int16_t *y,uint8_t scale)[33] = {dft24,dft36,dft48,dft60,dft72,dft96,dft108,dft120,dft144,dft180,dft192,dft216,dft240,dft288,dft300,dft324,dft360,dft384,dft432,dft480,dft540,dft576,dft600,dft648,dft720,dft768,dft864,dft900,dft960,dft972,dft1080,dft1152,dft1200};
|
||||
for (int n=0;n<33;n++) {
|
||||
// 4xN-point DFT
|
||||
memset((void*)x,0,dftsizes[n]*8*sizeof(int16_t));
|
||||
|
||||
@@ -812,9 +812,6 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
|
||||
free(bit1);
|
||||
free(bit_pdcch);
|
||||
free(llr_pdcch);
|
||||
for (arx=0;arx<nb_antennas_rx;arx++) {
|
||||
free(chest_t_abs[arx]);
|
||||
}
|
||||
|
||||
//This is done to avoid plotting old data when TB0 is disabled, and TB1 is mapped onto CW0
|
||||
/*if (phy_vars_ue->transmission_mode[eNB_id]==3 && phy_vars_ue->transmission_mode[eNB_id]==4){
|
||||
|
||||
@@ -19,6 +19,7 @@ int f_read(char *calibF_fname, int nb_antM, int nb_freq, int16_t (*calibF_mtx)[n
|
||||
}
|
||||
printf("%d\n",(int)calibF_mtx[0][0]);
|
||||
printf("%d\n",(int)calibF_mtx[1][599]);
|
||||
fclose(calibF_fd);
|
||||
} else
|
||||
printf("%s not found, running with defaults\n",calibF_fname);
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@ int smbv_init_config(const char* fname, uint16_t sequence_length)
|
||||
|
||||
if (sequence_length>4) {
|
||||
msg("ERROR invalid sequence length: %d, maximum is 4\n", sequence_length);
|
||||
fclose(f_ptr);
|
||||
return -1;
|
||||
} else
|
||||
slen = sequence_length;
|
||||
@@ -448,13 +449,6 @@ int smbv_send_config (const char* fname, char* smbv_ip)
|
||||
int bytes_sent, status, sockfd;
|
||||
char buf[BUFFER_LENGTH];
|
||||
|
||||
if (fopen(fname,"r")!=NULL) {
|
||||
msg("Configuration file: %s\n",fname);
|
||||
} else {
|
||||
msg("ERROR: can't open SMBV config file: %s\n",fname);
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(buf,0,BUFFER_LENGTH);
|
||||
|
||||
// first, load up address structs with getaddrinfo():
|
||||
|
||||
@@ -29,7 +29,6 @@ int opp_enabled = 0;
|
||||
|
||||
|
||||
double get_cpu_freq_GHz(void) {
|
||||
|
||||
time_stats_t ts = {0};
|
||||
reset_meas(&ts);
|
||||
ts.trials++;
|
||||
@@ -38,32 +37,40 @@ double get_cpu_freq_GHz(void) {
|
||||
ts.diff = (rdtsc_oai()-ts.in);
|
||||
cpu_freq_GHz = (double)ts.diff/1000000000;
|
||||
printf("CPU Freq is %f \n", cpu_freq_GHz);
|
||||
return cpu_freq_GHz;
|
||||
return cpu_freq_GHz;
|
||||
}
|
||||
int cpumeas(int action) {
|
||||
switch (action) {
|
||||
case CPUMEAS_ENABLE:
|
||||
opp_enabled = 1;
|
||||
break;
|
||||
|
||||
void print_meas_now(time_stats_t *ts, const char* name, FILE* file_name){
|
||||
case CPUMEAS_DISABLE:
|
||||
opp_enabled = 0;
|
||||
break;
|
||||
|
||||
case CPUMEAS_GETSTATE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return opp_enabled;
|
||||
}
|
||||
void print_meas_now(time_stats_t *ts, const char *name, FILE *file_name) {
|
||||
if (opp_enabled) {
|
||||
|
||||
//static double cpu_freq_GHz = 3.2;
|
||||
|
||||
//if (cpu_freq_GHz == 0.0)
|
||||
//cpu_freq_GHz = get_cpu_freq_GHz(); // super slow
|
||||
|
||||
//cpu_freq_GHz = get_cpu_freq_GHz(); // super slow
|
||||
if (ts->trials>0) {
|
||||
|
||||
//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->p_time/(cpu_freq_GHz*1000.0)),(double)ts->p_time);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_time, time_stats_t * sf_exec_time)
|
||||
{
|
||||
|
||||
void print_meas(time_stats_t *ts, const char *name, time_stats_t *total_exec_time, time_stats_t *sf_exec_time) {
|
||||
if (opp_enabled) {
|
||||
|
||||
static int first_time = 0;
|
||||
static double cpu_freq_GHz = 0.0;
|
||||
|
||||
@@ -81,7 +88,6 @@ void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_ti
|
||||
|
||||
if (ts->trials>0) {
|
||||
//printf("%20s: total: %10.3f ms, average: %10.3f us (%10d trials)\n", name, ts->diff/cpu_freq_GHz/1000000.0, ts->diff/ts->trials/cpu_freq_GHz/1000.0, ts->trials);
|
||||
|
||||
if ((total_exec_time == NULL) || (sf_exec_time== NULL)) {
|
||||
fprintf(stderr, "%25s: %15.3f us; %15d;\n",
|
||||
name,
|
||||
@@ -98,12 +104,9 @@ void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_ti
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
double get_time_meas_us(time_stats_t *ts)
|
||||
{
|
||||
|
||||
double get_time_meas_us(time_stats_t *ts) {
|
||||
static double cpu_freq_GHz = 0.0;
|
||||
|
||||
if (cpu_freq_GHz == 0.0)
|
||||
|
||||
@@ -61,23 +61,21 @@ static inline void start_meas(time_stats_t *ts) __attribute__((always_inline));
|
||||
static inline void stop_meas(time_stats_t *ts) __attribute__((always_inline));
|
||||
|
||||
|
||||
void print_meas_now(time_stats_t *ts, const char* name, FILE* file_name);
|
||||
void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_time, time_stats_t * sf_exec_time);
|
||||
void print_meas_now(time_stats_t *ts, const char *name, FILE *file_name);
|
||||
void print_meas(time_stats_t *ts, const char *name, time_stats_t *total_exec_time, time_stats_t *sf_exec_time);
|
||||
double get_time_meas_us(time_stats_t *ts);
|
||||
double get_cpu_freq_GHz(void);
|
||||
|
||||
#if defined(__i386__)
|
||||
static inline unsigned long long rdtsc_oai(void) __attribute__((always_inline));
|
||||
static inline unsigned long long rdtsc_oai(void)
|
||||
{
|
||||
static inline unsigned long long rdtsc_oai(void) {
|
||||
unsigned long long int x;
|
||||
__asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
|
||||
return x;
|
||||
}
|
||||
#elif defined(__x86_64__)
|
||||
static inline unsigned long long rdtsc_oai(void) __attribute__((always_inline));
|
||||
static inline unsigned long long rdtsc_oai(void)
|
||||
{
|
||||
static inline unsigned long long rdtsc_oai(void) {
|
||||
unsigned long long a, d;
|
||||
__asm__ volatile ("rdtsc" : "=a" (a), "=d" (d));
|
||||
return (d<<32) | a;
|
||||
@@ -85,61 +83,54 @@ static inline unsigned long long rdtsc_oai(void)
|
||||
|
||||
#elif defined(__arm__)
|
||||
static inline uint32_t rdtsc_oai(void) __attribute__((always_inline));
|
||||
static inline uint32_t rdtsc_oai(void)
|
||||
{
|
||||
static inline uint32_t rdtsc_oai(void) {
|
||||
uint32_t r = 0;
|
||||
asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r"(r) );
|
||||
return r;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void start_meas(time_stats_t *ts)
|
||||
{
|
||||
|
||||
#define CPUMEAS_DISABLE 0
|
||||
#define CPUMEAS_ENABLE 1
|
||||
#define CPUMEAS_GETSTATE 2
|
||||
int cpumeas(int action);
|
||||
static inline void start_meas(time_stats_t *ts) {
|
||||
if (opp_enabled) {
|
||||
if (ts->meas_flag==0) {
|
||||
ts->trials++;
|
||||
ts->in = rdtsc_oai();
|
||||
ts->meas_flag=1;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ts->in = rdtsc_oai();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void stop_meas(time_stats_t *ts)
|
||||
{
|
||||
|
||||
static inline void stop_meas(time_stats_t *ts) {
|
||||
if (opp_enabled) {
|
||||
long long out = rdtsc_oai();
|
||||
|
||||
ts->diff += (out-ts->in);
|
||||
/// process duration is the difference between two clock points
|
||||
ts->p_time = (out-ts->in);
|
||||
ts->diff_square += (out-ts->in)*(out-ts->in);
|
||||
|
||||
|
||||
if ((out-ts->in) > ts->max)
|
||||
ts->max = out-ts->in;
|
||||
|
||||
ts->meas_flag=0;
|
||||
ts->meas_flag=0;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void reset_meas(time_stats_t *ts) {
|
||||
|
||||
ts->trials=0;
|
||||
ts->diff=0;
|
||||
ts->p_time=0;
|
||||
ts->diff_square=0;
|
||||
ts->max=0;
|
||||
ts->meas_flag=0;
|
||||
|
||||
}
|
||||
|
||||
static inline void copy_meas(time_stats_t *dst_ts,time_stats_t *src_ts)
|
||||
{
|
||||
|
||||
static inline void copy_meas(time_stats_t *dst_ts,time_stats_t *src_ts) {
|
||||
if (opp_enabled) {
|
||||
dst_ts->trials=src_ts->trials;
|
||||
dst_ts->diff=src_ts->diff;
|
||||
|
||||
+21
-2
@@ -312,6 +312,10 @@ typedef struct RU_t_s{
|
||||
LTE_DL_FRAME_PARMS frame_parms;
|
||||
///timing offset used in TDD
|
||||
int N_TA_offset;
|
||||
/// SF extension used in TDD (unit: number of samples at 30.72MHz) (this is an expert option)
|
||||
int sf_extension;
|
||||
/// "end of burst delay" used in TDD (unit: number of samples at 30.72MHz) (this is an expert option)
|
||||
int end_of_burst_delay;
|
||||
/// RF device descriptor
|
||||
openair0_device rfdevice;
|
||||
/// HW configuration
|
||||
@@ -971,6 +975,22 @@ typedef struct PHY_VARS_eNB_s {
|
||||
uint32_t lte_gold_mbsfn_khz_1dot25_table[10][150];
|
||||
#endif
|
||||
|
||||
// PRACH energy detection parameters
|
||||
/// Detection threshold for LTE PRACH
|
||||
int prach_DTX_threshold;
|
||||
/// Detection threshold for LTE-M PRACH per CE-level
|
||||
int prach_DTX_threshold_emtc[4];
|
||||
/// counter to average prach energh over first 100 prach opportunities
|
||||
int prach_energy_counter;
|
||||
// PUCCH1 energy detection parameters
|
||||
int pucch1_DTX_threshold;
|
||||
// PUCCH1 energy detection parameters for eMTC per CE-level
|
||||
int pucch1_DTX_threshold_emtc[4];
|
||||
// PUCCH1a/b energy detection parameters
|
||||
int pucch1ab_DTX_threshold;
|
||||
// PUCCH1a/b energy detection parameters for eMTC per CE-level
|
||||
int pucch1ab_DTX_threshold_emtc[4];
|
||||
|
||||
uint32_t X_u[64][839];
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
uint32_t X_u_br[4][64][839];
|
||||
@@ -1007,8 +1027,7 @@ typedef struct PHY_VARS_eNB_s {
|
||||
|
||||
/// if ==0 enables phy only test mode
|
||||
int mac_enabled;
|
||||
/// counter to average prach energh over first 100 prach opportunities
|
||||
int prach_energy_counter;
|
||||
|
||||
|
||||
// PDSCH Varaibles
|
||||
PDSCH_CONFIG_DEDICATED pdsch_config_dedicated[NUMBER_OF_UE_MAX];
|
||||
|
||||
+5
-5
@@ -9,7 +9,7 @@ General remarks: every directory contains at least defs.h (for declaration of st
|
||||
| |-- INIT // variables defined in vars.h are initialzed here (memory allocation)
|
||||
| |-- LTE_ESTIMATION // estimation for LTE
|
||||
| |-- LTE_REFSIG // reference signals for LTE (sync and pilot sequences) reference signals from 36-211
|
||||
| |-- NR_REFSIG // reference signals for NR (sync and pilot sequences) reference signals from 38-211
|
||||
| |-- NR_REFSIG // reference signals for NR (sync and pilot sequences) reference signals from 38-211
|
||||
| |-- LTE_TRANSPORT // these are the top level routines for different transport and physical channels (for example DL-SCH, PSS) implements a subset of 36-211,36-212
|
||||
| |-- LTE_UE_TRANSPORT // these are the top level routines for different transport and physical channels (for example DL-SCH, PSS) implements a subset of 36-211,36-212
|
||||
| |-- NR_TRANSPORT // these are the top level routines for different transport and physical channels (for example DL-SCH, PSS) implements a subset of 38-211,38-212
|
||||
@@ -27,18 +27,18 @@ General remarks: every directory contains at least defs.h (for declaration of st
|
||||
| |-- spec_defs_top.h
|
||||
| |-- types.h
|
||||
| `-- vars.h
|
||||
|-- SCHED // schedules the different LTE eNB functions
|
||||
|-- SCHED // schedules the different LTE eNB functions
|
||||
| |-- defs.h
|
||||
| |-- extern.h
|
||||
| |-- phy_procedures_lte_eNb.c // LTE PHY procedures for eNB (from 36-213)
|
||||
| |-- phy_procedures_lte_common.c // LTE PHY procedures common for UE and eNB (from 36-213)
|
||||
| |-- prach_procedures.c //LTE PRACH procedures (from 36-213)
|
||||
| |-- ru_procedures.c //RU procedures
|
||||
| |-- ru_procedures.c //RU procedures
|
||||
| |-- fapi_l1.c //L1 side of the FAPI interface
|
||||
| |-- phy_mac_stub.c //MAC stub that generates channels when used in phy-test-mode
|
||||
| |-- rt_compat.h
|
||||
| `-- vars.h
|
||||
|-- SCHED_UE // schedules the different LTE UE functions
|
||||
|-- SCHED_UE // schedules the different LTE UE functions
|
||||
| |-- phy_procedures_lte_ue.c // LTE PHY procedures for UE (from 36-213)
|
||||
| |-- pucch_pc.c // power control for PUCCH
|
||||
| |-- pusch_pc.c // power control for PUSCH
|
||||
@@ -53,7 +53,7 @@ General remarks: every directory contains at least defs.h (for declaration of st
|
||||
| | |-- dlsim.c // PDSCH simulation testbench
|
||||
| | |-- ulsim.c // PUSCH simulation testbench
|
||||
| | |-- pucchsim.c // PUCCH simulation testbench
|
||||
| |-- RF // RF simulation tools
|
||||
| |-- RF // RF simulation tools
|
||||
| |-- ETH_TRANSPORT
|
||||
| `-- TOOLS
|
||||
|
||||
|
||||
+329
-385
File diff suppressed because it is too large
Load Diff
+1196
-1252
File diff suppressed because it is too large
Load Diff
@@ -37,6 +37,7 @@
|
||||
#include "fapi_l1.h"
|
||||
#include "nfapi_pnf.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
|
||||
|
||||
@@ -46,91 +47,86 @@
|
||||
#include <time.h>
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
# include "intertask_interface.h"
|
||||
#include "intertask_interface.h"
|
||||
#endif
|
||||
|
||||
extern uint32_t nfapi_mode;
|
||||
|
||||
extern int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind);
|
||||
|
||||
void prach_procedures(PHY_VARS_eNB *eNB
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
,
|
||||
int br_flag
|
||||
,
|
||||
int br_flag
|
||||
#endif
|
||||
) {
|
||||
) {
|
||||
uint16_t max_preamble[4],max_preamble_energy[4],max_preamble_delay[4];
|
||||
uint16_t i;
|
||||
int frame,subframe;
|
||||
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
|
||||
if (br_flag==1) {
|
||||
subframe = eNB->proc.subframe_prach_br;
|
||||
frame = eNB->proc.frame_prach_br;
|
||||
pthread_mutex_lock(&eNB->UL_INFO_mutex);
|
||||
eNB->UL_INFO.rach_ind_br.rach_indication_body.number_of_preambles=0;
|
||||
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
|
||||
}
|
||||
else
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
pthread_mutex_lock(&eNB->UL_INFO_mutex);
|
||||
eNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles=0;
|
||||
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
|
||||
subframe = eNB->proc.subframe_prach;
|
||||
frame = eNB->proc.frame_prach;
|
||||
}
|
||||
{
|
||||
pthread_mutex_lock(&eNB->UL_INFO_mutex);
|
||||
eNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles=0;
|
||||
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
|
||||
subframe = eNB->proc.subframe_prach;
|
||||
frame = eNB->proc.frame_prach;
|
||||
}
|
||||
|
||||
RU_t *ru;
|
||||
int aa=0;
|
||||
int ru_aa;
|
||||
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,1);
|
||||
|
||||
|
||||
|
||||
for (i=0;i<eNB->num_RU;i++) {
|
||||
for (i=0; i<eNB->num_RU; i++) {
|
||||
ru=eNB->RU_list[i];
|
||||
for (ru_aa=0,aa=0;ru_aa<ru->nb_rx;ru_aa++,aa++) {
|
||||
|
||||
for (ru_aa=0,aa=0; ru_aa<ru->nb_rx; ru_aa++,aa++) {
|
||||
eNB->prach_vars.rxsigF[0][aa] = eNB->RU_list[i]->prach_rxsigF[ru_aa];
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
int ce_level;
|
||||
|
||||
if (br_flag==1)
|
||||
for (ce_level=0;ce_level<4;ce_level++) eNB->prach_vars_br.rxsigF[ce_level][aa] = eNB->RU_list[i]->prach_rxsigF_br[ce_level][ru_aa];
|
||||
for (ce_level=0; ce_level<4; ce_level++) eNB->prach_vars_br.rxsigF[ce_level][aa] = eNB->RU_list[i]->prach_rxsigF_br[ce_level][ru_aa];
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// run PRACH detection for CE-level 0 only for now when br_flag is set
|
||||
rx_prach(eNB,
|
||||
eNB->RU_list[0],
|
||||
&max_preamble[0],
|
||||
&max_preamble_energy[0],
|
||||
&max_preamble_delay[0],
|
||||
frame,
|
||||
0
|
||||
eNB->RU_list[0],
|
||||
&max_preamble[0],
|
||||
&max_preamble_energy[0],
|
||||
&max_preamble_delay[0],
|
||||
frame,
|
||||
0
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
,br_flag
|
||||
,br_flag
|
||||
#endif
|
||||
);
|
||||
|
||||
LOG_D(PHY,"[RAPROC] Frame %d, subframe %d : Most likely preamble %d, energy %d dB delay %d (prach_energy counter %d)\n",
|
||||
frame,subframe,
|
||||
);
|
||||
LOG_D(PHY,"[RAPROC] Frame %d, subframe %d : BR %d Most likely preamble %d, energy %d dB delay %d (prach_energy counter %d)\n",
|
||||
frame,subframe,br_flag,
|
||||
max_preamble[0],
|
||||
max_preamble_energy[0]/10,
|
||||
max_preamble_delay[0],
|
||||
eNB->prach_energy_counter);
|
||||
|
||||
eNB->prach_energy_counter);
|
||||
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
|
||||
|
||||
if (br_flag==1) {
|
||||
int prach_mask;
|
||||
|
||||
prach_mask = is_prach_subframe (&eNB->frame_parms, eNB->proc.frame_prach_br, eNB->proc.subframe_prach_br);
|
||||
|
||||
eNB->UL_INFO.rach_ind_br.rach_indication_body.preamble_list = eNB->preamble_list_br;
|
||||
int ind = 0;
|
||||
int ce_level = 0;
|
||||
/* Save for later, it doesn't work
|
||||
/* Save for later, it doesn't work
|
||||
for (int ind=0,ce_level=0;ce_level<4;ce_level++) {
|
||||
|
||||
if ((eNB->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[ce_level]==1)&&
|
||||
@@ -141,9 +137,8 @@ void prach_procedures(PHY_VARS_eNB *eNB
|
||||
*/
|
||||
|
||||
if (eNB->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_CElevel_enable[0] == 1) {
|
||||
if ((eNB->prach_energy_counter == 100) && (max_preamble_energy[0] > eNB->measurements.prach_I0 + 200)) {
|
||||
if ((eNB->prach_energy_counter == 100) && (max_preamble_energy[0] > eNB->measurements.prach_I0 + eNB->prach_DTX_threshold_emtc[0])) {
|
||||
eNB->UL_INFO.rach_ind_br.rach_indication_body.number_of_preambles++;
|
||||
|
||||
eNB->preamble_list_br[ind].preamble_rel8.timing_advance = max_preamble_delay[ind]; //
|
||||
eNB->preamble_list_br[ind].preamble_rel8.preamble = max_preamble[ind];
|
||||
// note: fid is implicitly 0 here, this is the rule for eMTC RA-RNTI from 36.321, Section 5.1.4
|
||||
@@ -158,69 +153,61 @@ void prach_procedures(PHY_VARS_eNB *eNB
|
||||
eNB->preamble_list_br[ind].preamble_rel8.preamble, eNB->preamble_list_br[ind].preamble_rel8.rnti, eNB->preamble_list_br[ind].preamble_rel13.rach_resource_type);
|
||||
}
|
||||
}
|
||||
/*
|
||||
ind++;
|
||||
}
|
||||
} */// ce_level
|
||||
}
|
||||
else
|
||||
|
||||
/*
|
||||
ind++;
|
||||
}
|
||||
} */// ce_level
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if ((eNB->prach_energy_counter == 100) &&
|
||||
(max_preamble_energy[0] > eNB->measurements.prach_I0+eNB->prach_DTX_threshold)) {
|
||||
LOG_I(PHY,"[eNB %d/%d][RAPROC] Frame %d, subframe %d Initiating RA procedure with preamble %d, energy %d.%d dB, delay %d\n",
|
||||
eNB->Mod_id,
|
||||
eNB->CC_id,
|
||||
frame,
|
||||
subframe,
|
||||
max_preamble[0],
|
||||
max_preamble_energy[0]/10,
|
||||
max_preamble_energy[0]%10,
|
||||
max_preamble_delay[0]);
|
||||
T(T_ENB_PHY_INITIATE_RA_PROCEDURE, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe),
|
||||
T_INT(max_preamble[0]), T_INT(max_preamble_energy[0]), T_INT(max_preamble_delay[0]));
|
||||
pthread_mutex_lock(&eNB->UL_INFO_mutex);
|
||||
eNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles = 1;
|
||||
eNB->UL_INFO.rach_ind.rach_indication_body.preamble_list = &eNB->preamble_list[0];
|
||||
eNB->UL_INFO.rach_ind.rach_indication_body.tl.tag = NFAPI_RACH_INDICATION_BODY_TAG;
|
||||
eNB->UL_INFO.rach_ind.header.message_id = NFAPI_RACH_INDICATION;
|
||||
eNB->UL_INFO.rach_ind.sfn_sf = frame<<4 | subframe;
|
||||
eNB->preamble_list[0].preamble_rel8.tl.tag = NFAPI_PREAMBLE_REL8_TAG;
|
||||
eNB->preamble_list[0].preamble_rel8.timing_advance = max_preamble_delay[0];
|
||||
eNB->preamble_list[0].preamble_rel8.preamble = max_preamble[0];
|
||||
eNB->preamble_list[0].preamble_rel8.rnti = 1+subframe; // note: fid is implicitly 0 here
|
||||
eNB->preamble_list[0].preamble_rel13.rach_resource_type = 0;
|
||||
eNB->preamble_list[0].instance_length = 0; //don't know exactly what this is
|
||||
|
||||
{
|
||||
if ((eNB->prach_energy_counter == 100) &&
|
||||
(max_preamble_energy[0] > eNB->measurements.prach_I0+100)) {
|
||||
|
||||
LOG_I(PHY,"[eNB %d/%d][RAPROC] Frame %d, subframe %d Initiating RA procedure with preamble %d, energy %d.%d dB, delay %d\n",
|
||||
eNB->Mod_id,
|
||||
eNB->CC_id,
|
||||
frame,
|
||||
subframe,
|
||||
max_preamble[0],
|
||||
max_preamble_energy[0]/10,
|
||||
max_preamble_energy[0]%10,
|
||||
max_preamble_delay[0]);
|
||||
|
||||
T(T_ENB_PHY_INITIATE_RA_PROCEDURE, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe),
|
||||
T_INT(max_preamble[0]), T_INT(max_preamble_energy[0]), T_INT(max_preamble_delay[0]));
|
||||
|
||||
pthread_mutex_lock(&eNB->UL_INFO_mutex);
|
||||
|
||||
eNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles = 1;
|
||||
eNB->UL_INFO.rach_ind.rach_indication_body.preamble_list = &eNB->preamble_list[0];
|
||||
eNB->UL_INFO.rach_ind.rach_indication_body.tl.tag = NFAPI_RACH_INDICATION_BODY_TAG;
|
||||
eNB->UL_INFO.rach_ind.header.message_id = NFAPI_RACH_INDICATION;
|
||||
eNB->UL_INFO.rach_ind.sfn_sf = frame<<4 | subframe;
|
||||
|
||||
eNB->preamble_list[0].preamble_rel8.tl.tag = NFAPI_PREAMBLE_REL8_TAG;
|
||||
eNB->preamble_list[0].preamble_rel8.timing_advance = max_preamble_delay[0];
|
||||
eNB->preamble_list[0].preamble_rel8.preamble = max_preamble[0];
|
||||
eNB->preamble_list[0].preamble_rel8.rnti = 1+subframe; // note: fid is implicitly 0 here
|
||||
eNB->preamble_list[0].preamble_rel13.rach_resource_type = 0;
|
||||
eNB->preamble_list[0].instance_length = 0; //don't know exactly what this is
|
||||
|
||||
if (nfapi_mode == 1) { // If NFAPI PNF then we need to send the message to the VNF
|
||||
|
||||
LOG_D(PHY,"Filling NFAPI indication for RACH : SFN_SF:%d TA %d, Preamble %d, rnti %x, rach_resource_type %d\n",
|
||||
NFAPI_SFNSF2DEC(eNB->UL_INFO.rach_ind.sfn_sf),
|
||||
eNB->preamble_list[0].preamble_rel8.timing_advance,
|
||||
eNB->preamble_list[0].preamble_rel8.preamble,
|
||||
eNB->preamble_list[0].preamble_rel8.rnti,
|
||||
eNB->preamble_list[0].preamble_rel13.rach_resource_type);
|
||||
|
||||
oai_nfapi_rach_ind(&eNB->UL_INFO.rach_ind);
|
||||
|
||||
eNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles = 0;
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
|
||||
|
||||
} // max_preamble_energy > prach_I0 + 100
|
||||
else {
|
||||
eNB->measurements.prach_I0 = ((eNB->measurements.prach_I0*900)>>10) + ((max_preamble_energy[0]*124)>>10);
|
||||
if (frame==0) LOG_I(PHY,"prach_I0 = %d.%d dB\n",eNB->measurements.prach_I0/10,eNB->measurements.prach_I0%10);
|
||||
if (eNB->prach_energy_counter < 100) eNB->prach_energy_counter++;
|
||||
if (NFAPI_MODE==NFAPI_MODE_PNF) { // If NFAPI PNF then we need to send the message to the VNF
|
||||
LOG_D(PHY,"Filling NFAPI indication for RACH : SFN_SF:%d TA %d, Preamble %d, rnti %x, rach_resource_type %d\n",
|
||||
NFAPI_SFNSF2DEC(eNB->UL_INFO.rach_ind.sfn_sf),
|
||||
eNB->preamble_list[0].preamble_rel8.timing_advance,
|
||||
eNB->preamble_list[0].preamble_rel8.preamble,
|
||||
eNB->preamble_list[0].preamble_rel8.rnti,
|
||||
eNB->preamble_list[0].preamble_rel13.rach_resource_type);
|
||||
oai_nfapi_rach_ind(&eNB->UL_INFO.rach_ind);
|
||||
eNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles = 0;
|
||||
}
|
||||
} // else br_flag
|
||||
|
||||
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
|
||||
} // max_preamble_energy > prach_I0 + 100
|
||||
else {
|
||||
eNB->measurements.prach_I0 = ((eNB->measurements.prach_I0*900)>>10) + ((max_preamble_energy[0]*124)>>10);
|
||||
|
||||
if (frame==0) LOG_I(PHY,"prach_I0 = %d.%d dB\n",eNB->measurements.prach_I0/10,eNB->measurements.prach_I0%10);
|
||||
|
||||
if (eNB->prach_energy_counter < 100) eNB->prach_energy_counter++;
|
||||
}
|
||||
} // else br_flag
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,0);
|
||||
}
|
||||
|
||||
@@ -1518,15 +1518,19 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
|
||||
ue->ulsch[eNB_id]->harq_processes[harq_pid]->O_ACK = ack_status_cw0 + ack_status_cw1;
|
||||
}
|
||||
|
||||
if (ue->ulsch[eNB_id]->o_ACK[0]) {
|
||||
T(T_UE_PHY_DLSCH_UE_ACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti),
|
||||
T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->current_harq_pid));
|
||||
} else {
|
||||
T(T_UE_PHY_DLSCH_UE_NACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti),
|
||||
T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->current_harq_pid));
|
||||
}
|
||||
|
||||
if ( LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) {
|
||||
if(ue->ulsch[eNB_id]->o_ACK[0]) {
|
||||
LOG_I(PHY,"PUSCH ACK\n");
|
||||
T(T_UE_PHY_DLSCH_UE_ACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti),
|
||||
T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->current_harq_pid));
|
||||
} else {
|
||||
LOG_I(PHY,"PUSCH NACK\n");
|
||||
T(T_UE_PHY_DLSCH_UE_NACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti),
|
||||
T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->current_harq_pid));
|
||||
}
|
||||
|
||||
LOG_I(PHY,"[UE %d][PDSCH %x] AbsSubFrame %d.%d Generating ACK (%d,%d) for %d bits on PUSCH\n",
|
||||
@@ -1901,16 +1905,6 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
|
||||
uint8_t isShortenPucch = (pSoundingrs_ul_config_dedicated->srsCellSubframe && frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission);
|
||||
bundling_flag = ue->pucch_config_dedicated[eNB_id].tdd_AckNackFeedbackMode;
|
||||
|
||||
if ((frame_parms->frame_type==FDD) ||
|
||||
(bundling_flag==bundling) ||
|
||||
((frame_parms->frame_type==TDD)&&(frame_parms->tdd_config==1)&&((subframe_tx!=2)||(subframe_tx!=7)))) {
|
||||
format = pucch_format1a;
|
||||
// LOG_D(PHY,"[UE] PUCCH 1a\n");
|
||||
} else {
|
||||
format = pucch_format1b;
|
||||
// LOG_D(PHY,"[UE] PUCCH 1b\n");
|
||||
}
|
||||
|
||||
// Part - I
|
||||
// Collect feedback that should be transmitted at this subframe
|
||||
// - SR
|
||||
@@ -2046,14 +2040,12 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
|
||||
}
|
||||
}
|
||||
|
||||
if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) {
|
||||
if(pucch_payload[0]) {
|
||||
T(T_UE_PHY_DLSCH_UE_ACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti),
|
||||
T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->current_harq_pid));
|
||||
} else {
|
||||
T(T_UE_PHY_DLSCH_UE_NACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti),
|
||||
T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->current_harq_pid));
|
||||
}
|
||||
if (pucch_payload[0]) {
|
||||
T(T_UE_PHY_DLSCH_UE_ACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti),
|
||||
T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->current_harq_pid));
|
||||
} else {
|
||||
T(T_UE_PHY_DLSCH_UE_NACK, T_INT(eNB_id), T_INT(frame_tx%1024), T_INT(subframe_tx), T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->rnti),
|
||||
T_INT(ue->dlsch[ue->current_thread_id[proc->subframe_rx]][eNB_id][0]->current_harq_pid));
|
||||
}
|
||||
|
||||
generate_pucch1x(ue->common_vars.txdataF,
|
||||
@@ -2774,18 +2766,21 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
|
||||
CBA_RNTI,
|
||||
eNB_id,
|
||||
0)==0)) {
|
||||
int harq_pid = subframe2harq_pid(&ue->frame_parms,
|
||||
pdcch_alloc2ul_frame(&ue->frame_parms,proc->frame_rx,proc->subframe_rx),
|
||||
pdcch_alloc2ul_subframe(&ue->frame_parms,proc->subframe_rx));
|
||||
T(T_UE_PHY_ULSCH_UE_DCI, T_INT(eNB_id), T_INT(proc->frame_rx%1024), T_INT(proc->subframe_rx),
|
||||
T_INT(dci_alloc_rx[i].rnti),
|
||||
T_INT(harq_pid),
|
||||
T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->mcs),
|
||||
T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->round),
|
||||
T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb),
|
||||
T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb),
|
||||
T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS));
|
||||
if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) {
|
||||
LOG_USEDINLOG_VAR(int8_t,harq_pid) = subframe2harq_pid(&ue->frame_parms,
|
||||
pdcch_alloc2ul_frame(&ue->frame_parms,proc->frame_rx,proc->subframe_rx),
|
||||
pdcch_alloc2ul_subframe(&ue->frame_parms,proc->subframe_rx));
|
||||
T(T_UE_PHY_ULSCH_UE_DCI, T_INT(eNB_id), T_INT(proc->frame_rx%1024), T_INT(proc->subframe_rx),
|
||||
T_INT(dci_alloc_rx[i].rnti),
|
||||
T_INT(harq_pid),
|
||||
T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->mcs),
|
||||
T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->round),
|
||||
T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->first_rb),
|
||||
T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb),
|
||||
T_INT(ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS));
|
||||
LOG_D(PHY,"[UE %d] Generate UE ULSCH C_RNTI format 0 (subframe %d)\n",ue->Mod_id,subframe_rx);
|
||||
}
|
||||
}
|
||||
@@ -3085,7 +3080,7 @@ void ue_pdsch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, int eNB_id, PDSC
|
||||
int i_mod,eNB_id_i,dual_stream_UE;
|
||||
int first_symbol_flag=0;
|
||||
|
||||
if (dlsch0->active == 0)
|
||||
if (dlsch0 && dlsch0->active == 0)
|
||||
return;
|
||||
|
||||
for (m=s0; m<=s1; m++) {
|
||||
@@ -4313,7 +4308,7 @@ int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *pr
|
||||
ue->dlsch_ra[eNB_id]->active = 0;
|
||||
}
|
||||
|
||||
if (LOG_DEBUGFLAG(UE_TIMING)
|
||||
if (LOG_DEBUGFLAG(UE_TIMING)) {
|
||||
stop_meas(&ue->dlsch_procedures_stat[ue->current_thread_id[subframe_rx]]);
|
||||
LOG_I(PHY, "[AbsSFN %d.%d] Channel Decoder: %5.2f \n",frame_rx,subframe_rx,ue->dlsch_procedures_stat[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0));
|
||||
}
|
||||
|
||||
@@ -36,12 +36,10 @@
|
||||
#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
|
||||
#include "PHY/phy_extern_ue.h"
|
||||
#include "PHY/LTE_ESTIMATION/lte_estimation.h"
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
|
||||
extern uint8_t nfapi_mode;
|
||||
|
||||
int16_t get_hundred_times_delta_IF(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t harq_pid)
|
||||
{
|
||||
|
||||
int16_t get_hundred_times_delta_IF(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t harq_pid) {
|
||||
uint32_t Nre = 2*ue->ulsch[eNB_id]->harq_processes[harq_pid]->Nsymb_initial *
|
||||
ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb*12;
|
||||
|
||||
@@ -51,9 +49,8 @@ int16_t get_hundred_times_delta_IF(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t harq_p
|
||||
uint32_t MPR_x100 = 100*ue->ulsch[eNB_id]->harq_processes[harq_pid]->TBS/Nre;
|
||||
// Note: MPR=is the effective spectral efficiency of the PUSCH
|
||||
// FK 20140908 sumKr is only set after the ulsch_encoding
|
||||
|
||||
uint16_t beta_offset_pusch = (ue->ulsch[eNB_id]->harq_processes[harq_pid]->control_only == 1) ?
|
||||
ue->ulsch[eNB_id]->beta_offset_cqi_times8:8;
|
||||
ue->ulsch[eNB_id]->beta_offset_cqi_times8:8;
|
||||
|
||||
if (ue->ul_power_control_dedicated[eNB_id].deltaMCS_Enabled == 1) {
|
||||
// This is the formula from Section 5.1.1.1 in 36.213 10*log10(deltaIF_PUSCH = (2^(MPR*Ks)-1)*beta_offset_pusch)
|
||||
@@ -67,34 +64,24 @@ int16_t get_hundred_times_delta_IF(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t harq_p
|
||||
|
||||
uint8_t alpha_lut[8] = {0,40,50,60,70,80,90,100};
|
||||
|
||||
void pusch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t j, uint8_t abstraction_flag)
|
||||
{
|
||||
|
||||
|
||||
void pusch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t j, uint8_t abstraction_flag) {
|
||||
uint8_t harq_pid = subframe2harq_pid(&ue->frame_parms,
|
||||
proc->frame_tx,
|
||||
proc->subframe_tx);
|
||||
|
||||
uint8_t nb_rb = ue->ulsch[eNB_id]->harq_processes[harq_pid]->nb_rb;
|
||||
int16_t PL;
|
||||
|
||||
|
||||
// P_pusch = 10*log10(nb_rb + P_opusch(j)+ alpha(u)*PL + delta_TF(i) + f(i))
|
||||
//
|
||||
// P_opusch(0) = P_oPTR + deltaP_Msg3 if PUSCH is transporting Msg3
|
||||
// else
|
||||
// P_opusch(0) = PO_NOMINAL_PUSCH(j) + P_O_UE_PUSCH(j)
|
||||
PL = get_PL(ue->Mod_id,ue->CC_id,eNB_id);
|
||||
|
||||
ue->ulsch[eNB_id]->Po_PUSCH = (hundred_times_log10_NPRB[nb_rb-1]+
|
||||
get_hundred_times_delta_IF(ue,eNB_id,harq_pid) +
|
||||
100*ue->ulsch[eNB_id]->f_pusch)/100;
|
||||
get_hundred_times_delta_IF(ue,eNB_id,harq_pid) +
|
||||
100*ue->ulsch[eNB_id]->f_pusch)/100;
|
||||
|
||||
if(ue->ulsch_Msg3_active[eNB_id] == 1) { // Msg3 PUSCH
|
||||
|
||||
ue->ulsch[eNB_id]->Po_PUSCH += (get_Po_NOMINAL_PUSCH(ue->Mod_id,0) + PL);
|
||||
|
||||
|
||||
LOG_I(PHY,"[UE %d][RAPROC] frame %d, subframe %d: Msg3 Po_PUSCH %d dBm (%d,%d,100*PL=%d,%d,%d)\n",
|
||||
ue->Mod_id,proc->frame_tx,proc->subframe_tx,ue->ulsch[eNB_id]->Po_PUSCH,
|
||||
100*get_Po_NOMINAL_PUSCH(ue->Mod_id,0),
|
||||
@@ -104,10 +91,9 @@ void pusch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_
|
||||
100*ue->ulsch[eNB_id]->f_pusch);
|
||||
} else if (j==0) { // SPS PUSCH
|
||||
} else if (j==1) { // Normal PUSCH
|
||||
|
||||
ue->ulsch[eNB_id]->Po_PUSCH += ((alpha_lut[ue->frame_parms.ul_power_control_config_common.alpha]*PL)/100);
|
||||
ue->ulsch[eNB_id]->Po_PUSCH += ue->frame_parms.ul_power_control_config_common.p0_NominalPUSCH;
|
||||
ue->ulsch[eNB_id]->PHR = ue->tx_power_max_dBm-ue->ulsch[eNB_id]->Po_PUSCH;
|
||||
ue->ulsch[eNB_id]->PHR = ue->tx_power_max_dBm-ue->ulsch[eNB_id]->Po_PUSCH;
|
||||
|
||||
if (ue->ulsch[eNB_id]->PHR < -23)
|
||||
ue->ulsch[eNB_id]->PHR = -23;
|
||||
@@ -126,13 +112,11 @@ void pusch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_
|
||||
get_hundred_times_delta_IF(ue,eNB_id,harq_pid)/100.0,
|
||||
ue->ulsch[eNB_id]->f_pusch);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int8_t get_PHR(uint8_t Mod_id, uint8_t CC_id,uint8_t eNB_index)
|
||||
{
|
||||
if(nfapi_mode!=3)
|
||||
return PHY_vars_UE_g[Mod_id][CC_id]->ulsch[eNB_index]->PHR;
|
||||
else
|
||||
return 40; // For nfapi_mode=3 consider ideal conditions
|
||||
int8_t get_PHR(uint8_t Mod_id, uint8_t CC_id,uint8_t eNB_index) {
|
||||
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF)
|
||||
return PHY_vars_UE_g[Mod_id][CC_id]->ulsch[eNB_index]->PHR;
|
||||
else
|
||||
return 40; // l1l2 simulator => ideal conditions
|
||||
}
|
||||
|
||||
@@ -39,13 +39,14 @@
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include "platform_constants.h"
|
||||
#ifdef UE_NAS_USE_TUN
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/if_tun.h>
|
||||
#include "openairinterface5g_limits.h"
|
||||
#endif
|
||||
|
||||
#include "pdcp.h"
|
||||
|
||||
char nl_rx_buf[NL_MAX_PAYLOAD];
|
||||
|
||||
@@ -54,20 +55,15 @@ struct nlmsghdr *nas_nlh_tx = NULL;
|
||||
struct nlmsghdr *nas_nlh_rx = NULL;
|
||||
struct iovec nas_iov_tx;
|
||||
struct iovec nas_iov_rx = {nl_rx_buf, sizeof(nl_rx_buf)};
|
||||
#ifdef UE_NAS_USE_TUN
|
||||
int nas_sock_fd[NUMBER_OF_UE_MAX];
|
||||
#else
|
||||
int nas_sock_fd;
|
||||
#endif
|
||||
|
||||
int nas_sock_fd[MAX_MOBILES_PER_ENB];
|
||||
|
||||
struct msghdr nas_msg_tx;
|
||||
struct msghdr nas_msg_rx;
|
||||
|
||||
#define GRAAL_NETLINK_ID 31
|
||||
|
||||
#ifdef UE_NAS_USE_TUN
|
||||
|
||||
static int tun_alloc(char *dev)
|
||||
{
|
||||
static int tun_alloc(char *dev) {
|
||||
struct ifreq ifr;
|
||||
int fd, err;
|
||||
|
||||
@@ -77,66 +73,58 @@ static int tun_alloc(char *dev)
|
||||
}
|
||||
|
||||
memset(&ifr, 0, sizeof(ifr));
|
||||
|
||||
/* Flags: IFF_TUN - TUN device (no Ethernet headers)
|
||||
* IFF_TAP - TAP device
|
||||
*
|
||||
* IFF_NO_PI - Do not provide packet information
|
||||
*/
|
||||
ifr.ifr_flags = IFF_TUN | IFF_NO_PI;
|
||||
if( *dev )
|
||||
strncpy(ifr.ifr_name, dev, IFNAMSIZ);
|
||||
|
||||
if( (err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0 ){
|
||||
close(fd);
|
||||
return err;
|
||||
if( *dev )
|
||||
strncpy(ifr.ifr_name, dev, IFNAMSIZ);
|
||||
|
||||
if( (err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0 ) {
|
||||
close(fd);
|
||||
return err;
|
||||
}
|
||||
|
||||
strcpy(dev, ifr.ifr_name);
|
||||
return fd;
|
||||
}
|
||||
|
||||
int netlink_init(void)
|
||||
{
|
||||
int i;
|
||||
int netlink_init_tun(char *ifprefix, int num_if) {
|
||||
int ret;
|
||||
|
||||
char ifname[64];
|
||||
for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
|
||||
sprintf(ifname, "oip%d", i+1);
|
||||
|
||||
for (int i = 0; i < num_if; i++) {
|
||||
sprintf(ifname, "oaitun_%.3s%d",ifprefix,i+1);
|
||||
nas_sock_fd[i] = tun_alloc(ifname);
|
||||
|
||||
if (nas_sock_fd[i] == -1) {
|
||||
printf("[NETLINK] Error opening socket %d (%d:%s)\n",nas_sock_fd[i],errno, strerror(errno));
|
||||
printf("[NETLINK] Error opening socket %s (%d:%s)\n",ifname,errno, strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
printf("[NETLINK]Opened socket with fd %d\n",nas_sock_fd[i]);
|
||||
|
||||
#if !defined(PDCP_USE_NETLINK_QUEUES)
|
||||
printf("[NETLINK]Opened socket %s with fd %d\n",ifname,nas_sock_fd[i]);
|
||||
ret = fcntl(nas_sock_fd[i],F_SETFL,O_NONBLOCK);
|
||||
|
||||
if (ret == -1) {
|
||||
printf("[NETLINK] Error fcntl (%d:%s)\n",errno, strerror(errno));
|
||||
#if defined(LINK_ENB_PDCP_TO_IP_DRIVER)
|
||||
exit(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
if (LINK_ENB_PDCP_TO_IP_DRIVER) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
memset(&nas_src_addr, 0, sizeof(nas_src_addr));
|
||||
nas_src_addr.nl_family = AF_NETLINK;
|
||||
nas_src_addr.nl_pid = 1;//getpid(); /* self pid */
|
||||
nas_src_addr.nl_groups = 0; /* not in mcast groups */
|
||||
ret = bind(nas_sock_fd[i], (struct sockaddr*)&nas_src_addr, sizeof(nas_src_addr));
|
||||
|
||||
|
||||
|
||||
ret = bind(nas_sock_fd[i], (struct sockaddr *)&nas_src_addr, sizeof(nas_src_addr));
|
||||
memset(&nas_dest_addr, 0, sizeof(nas_dest_addr));
|
||||
nas_dest_addr.nl_family = AF_NETLINK;
|
||||
nas_dest_addr.nl_pid = 0; /* For Linux Kernel */
|
||||
nas_dest_addr.nl_groups = 0; /* unicast */
|
||||
|
||||
// TX PART
|
||||
nas_nlh_tx=(struct nlmsghdr *)malloc(NLMSG_SPACE(NL_MAX_PAYLOAD));
|
||||
memset(nas_nlh_tx, 0, NLMSG_SPACE(NL_MAX_PAYLOAD));
|
||||
@@ -144,7 +132,6 @@ int netlink_init(void)
|
||||
nas_nlh_tx->nlmsg_len = NLMSG_SPACE(NL_MAX_PAYLOAD);
|
||||
nas_nlh_tx->nlmsg_pid = 1;//getpid(); /* self pid */
|
||||
nas_nlh_tx->nlmsg_flags = 0;
|
||||
|
||||
nas_iov_tx.iov_base = (void *)nas_nlh_tx;
|
||||
nas_iov_tx.iov_len = nas_nlh_tx->nlmsg_len;
|
||||
memset(&nas_msg_tx,0,sizeof(nas_msg_tx));
|
||||
@@ -152,62 +139,50 @@ int netlink_init(void)
|
||||
nas_msg_tx.msg_namelen = sizeof(nas_dest_addr);
|
||||
nas_msg_tx.msg_iov = &nas_iov_tx;
|
||||
nas_msg_tx.msg_iovlen = 1;
|
||||
|
||||
|
||||
// RX PART
|
||||
memset(&nas_msg_rx,0,sizeof(nas_msg_rx));
|
||||
nas_msg_rx.msg_name = (void *)&nas_src_addr;
|
||||
nas_msg_rx.msg_namelen = sizeof(nas_src_addr);
|
||||
nas_msg_rx.msg_iov = &nas_iov_rx;
|
||||
nas_msg_rx.msg_iovlen = 1;
|
||||
}
|
||||
} /* for */
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else /* UE_NAS_USE_TUN */
|
||||
|
||||
int netlink_init(void)
|
||||
{
|
||||
int netlink_init(void) {
|
||||
int ret;
|
||||
nas_sock_fd[0] = socket(PF_NETLINK, SOCK_RAW,GRAAL_NETLINK_ID);
|
||||
|
||||
if (nas_sock_fd[0] == -1) {
|
||||
printf("[NETLINK] Error opening socket %d (%d:%s)\n",nas_sock_fd[0],errno, strerror(errno));
|
||||
|
||||
nas_sock_fd = socket(PF_NETLINK, SOCK_RAW,GRAAL_NETLINK_ID);
|
||||
|
||||
if (nas_sock_fd == -1) {
|
||||
printf("[NETLINK] Error opening socket %d (%d:%s)\n",nas_sock_fd,errno, strerror(errno));
|
||||
#if defined(LINK_ENB_PDCP_TO_IP_DRIVER)
|
||||
exit(1);
|
||||
#endif
|
||||
if (LINK_ENB_PDCP_TO_IP_DRIVER) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
printf("[NETLINK]Opened socket with fd %d\n",nas_sock_fd);
|
||||
|
||||
#if !defined(PDCP_USE_NETLINK_QUEUES)
|
||||
ret = fcntl(nas_sock_fd,F_SETFL,O_NONBLOCK);
|
||||
printf("[NETLINK]Opened socket with fd %d\n",nas_sock_fd[0]);
|
||||
ret = fcntl(nas_sock_fd[0],F_SETFL,O_NONBLOCK);
|
||||
|
||||
if (ret == -1) {
|
||||
printf("[NETLINK] Error fcntl (%d:%s)\n",errno, strerror(errno));
|
||||
#if defined(LINK_ENB_PDCP_TO_IP_DRIVER)
|
||||
exit(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
if (LINK_ENB_PDCP_TO_IP_DRIVER) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
memset(&nas_src_addr, 0, sizeof(nas_src_addr));
|
||||
nas_src_addr.nl_family = AF_NETLINK;
|
||||
nas_src_addr.nl_pid = 1;//getpid(); /* self pid */
|
||||
nas_src_addr.nl_groups = 0; /* not in mcast groups */
|
||||
ret = bind(nas_sock_fd, (struct sockaddr*)&nas_src_addr, sizeof(nas_src_addr));
|
||||
|
||||
|
||||
|
||||
ret = bind(nas_sock_fd[0], (struct sockaddr *)&nas_src_addr, sizeof(nas_src_addr));
|
||||
memset(&nas_dest_addr, 0, sizeof(nas_dest_addr));
|
||||
nas_dest_addr.nl_family = AF_NETLINK;
|
||||
nas_dest_addr.nl_pid = 0; /* For Linux Kernel */
|
||||
nas_dest_addr.nl_groups = 0; /* unicast */
|
||||
|
||||
// TX PART
|
||||
nas_nlh_tx=(struct nlmsghdr *)malloc(NLMSG_SPACE(NL_MAX_PAYLOAD));
|
||||
memset(nas_nlh_tx, 0, NLMSG_SPACE(NL_MAX_PAYLOAD));
|
||||
@@ -215,7 +190,6 @@ int netlink_init(void)
|
||||
nas_nlh_tx->nlmsg_len = NLMSG_SPACE(NL_MAX_PAYLOAD);
|
||||
nas_nlh_tx->nlmsg_pid = 1;//getpid(); /* self pid */
|
||||
nas_nlh_tx->nlmsg_flags = 0;
|
||||
|
||||
nas_iov_tx.iov_base = (void *)nas_nlh_tx;
|
||||
nas_iov_tx.iov_len = nas_nlh_tx->nlmsg_len;
|
||||
memset(&nas_msg_tx,0,sizeof(nas_msg_tx));
|
||||
@@ -223,16 +197,12 @@ int netlink_init(void)
|
||||
nas_msg_tx.msg_namelen = sizeof(nas_dest_addr);
|
||||
nas_msg_tx.msg_iov = &nas_iov_tx;
|
||||
nas_msg_tx.msg_iovlen = 1;
|
||||
|
||||
|
||||
// RX PART
|
||||
memset(&nas_msg_rx,0,sizeof(nas_msg_rx));
|
||||
nas_msg_rx.msg_name = (void *)&nas_src_addr;
|
||||
nas_msg_rx.msg_namelen = sizeof(nas_src_addr);
|
||||
nas_msg_rx.msg_iov = &nas_iov_rx;
|
||||
nas_msg_rx.msg_iovlen = 1;
|
||||
|
||||
return(nas_sock_fd);
|
||||
return(nas_sock_fd[0]);
|
||||
}
|
||||
|
||||
#endif /* UE_NAS_USE_TUN */
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#define EMU_PROTO_H_
|
||||
|
||||
void init_bypass (void);
|
||||
void bypass_init ( unsigned int (*tx_handlerP) (unsigned char,char*, unsigned int*, unsigned int*),unsigned int (*rx_handlerP) (unsigned char,char*,unsigned int));
|
||||
void bypass_init ( unsigned int (*tx_handlerP) (unsigned char,char *, unsigned int *, unsigned int *),unsigned int (*rx_handlerP) (unsigned char,char *,unsigned int));
|
||||
int bypass_rx_data(unsigned int frame, unsigned int last_slot,
|
||||
unsigned int next_slot, uint8_t is_master);
|
||||
void bypass_signal_mac_phy(unsigned int frame, unsigned int last_slot,
|
||||
@@ -43,7 +43,7 @@ void bypass_tx_data (emu_transport_info_t Type, unsigned int frame, unsigned int
|
||||
|
||||
void emulation_tx_rx(void);
|
||||
|
||||
unsigned int emul_tx_handler(unsigned char Mode,char *Tx_buffer,unsigned int* Nbytes,unsigned int *Nb_flows);
|
||||
unsigned int emul_tx_handler(unsigned char Mode,char *Tx_buffer,unsigned int *Nbytes,unsigned int *Nb_flows);
|
||||
unsigned int emul_rx_handler(unsigned char Mode,char *rx_buffer, unsigned int Nbytes);
|
||||
|
||||
unsigned int emul_rx_data(void);
|
||||
@@ -62,5 +62,6 @@ int multicast_link_read_data_from_sock(uint8_t eNB_flag);
|
||||
void clear_eNB_transport_info(uint8_t);
|
||||
void clear_UE_transport_info(uint8_t);
|
||||
int netlink_init(void);
|
||||
int netlink_init_tun(char *ifsuffix, int num_if);
|
||||
|
||||
#endif /* EMU_PROTO_H_ */
|
||||
|
||||
@@ -25,7 +25,7 @@ void dumpVarArray(varArray_t *input) {
|
||||
printf("\n");
|
||||
}
|
||||
void sumUpStats(time_stats_t * res, time_stats_t * src, int lastActive) {
|
||||
reset_meas(res);
|
||||
reset_meas(res);
|
||||
for (int i=0; i<RX_NB_TH; i++) {
|
||||
res->diff+=src[i].diff;
|
||||
res->diff_square+=src[i].diff_square;
|
||||
@@ -36,7 +36,7 @@ void sumUpStats(time_stats_t * res, time_stats_t * src, int lastActive) {
|
||||
res->p_time=src[lastActive].p_time;
|
||||
}
|
||||
void sumUpStatsSlot(time_stats_t *res, time_stats_t src[RX_NB_TH][2], int lastActive) {
|
||||
reset_meas(res);
|
||||
reset_meas(res);
|
||||
for (int i=0; i<RX_NB_TH; i++) {
|
||||
res->diff+=src[i][0].diff+src[i][1].diff;
|
||||
res->diff_square+=src[i][0].diff_square+src[i][1].diff_square;
|
||||
@@ -94,7 +94,7 @@ void logDistribution(FILE* fd, time_stats_t *ptr, varArray_t *sortedList, int dr
|
||||
squareRoot(ptr),
|
||||
(double)ptr->max, *(double*)dataArray(sortedList),
|
||||
median(sortedList),q1(sortedList),q3(sortedList),
|
||||
dropped);
|
||||
dropped);
|
||||
}
|
||||
|
||||
struct option * parse_oai_options(paramdef_t *options) {
|
||||
@@ -125,7 +125,7 @@ struct option * parse_oai_options(paramdef_t *options) {
|
||||
case TYPE_UINT16:
|
||||
*options[i].u16ptr=options[i].defintval;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
printf("not parsed type for default value %s\n", options[i].optname );
|
||||
exit(1);
|
||||
@@ -155,11 +155,11 @@ void display_options_values(paramdef_t *options, int verbose) {
|
||||
case TYPE_UINT8:
|
||||
sprintf(varText,"%d",(int)*ptr->u8ptr);
|
||||
break;
|
||||
|
||||
|
||||
case TYPE_UINT16:
|
||||
sprintf(varText,"%d",(int)*ptr->u16ptr);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
printf("not decoded type\n");
|
||||
exit(1);
|
||||
|
||||
+716
-853
File diff suppressed because it is too large
Load Diff
+1857
-2034
File diff suppressed because it is too large
Load Diff
@@ -36,7 +36,7 @@
|
||||
#include "LAYER2/MAC/vars.h"
|
||||
|
||||
#ifdef XFORMS
|
||||
#include "PHY/TOOLS/lte_phy_scope.h"
|
||||
#include "PHY/TOOLS/lte_phy_scope.h"
|
||||
#endif //XFORMS
|
||||
|
||||
|
||||
@@ -52,11 +52,8 @@ double cpuf;
|
||||
DCI1E_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu2_1E[2];
|
||||
#define UL_RB_ALLOC 0x1ff;
|
||||
#define CCCH_RB_ALLOC computeRIV(eNB->frame_parms.N_RB_UL,0,2)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
char c;
|
||||
|
||||
int i,l,l2,aa,aarx,k;
|
||||
double sigma2, sigma2_dB=0,SNR,snr0=-2.0,snr1=0.0;
|
||||
uint8_t snr1set=0;
|
||||
@@ -64,48 +61,34 @@ int main(int argc, char **argv)
|
||||
int **txdata;
|
||||
double s_re0[2*30720],s_im0[2*30720],s_re1[2*30720],s_im1[2*30720];
|
||||
double r_re0[2*30720],r_im0[2*30720],r_re1[2*30720],r_im1[2*30720];
|
||||
double *s_re[2]={s_re0,s_re1},*s_im[2]={s_im0,s_im1},*r_re[2]={r_re0,r_re1},*r_im[2]={r_im0,r_im1};
|
||||
double *s_re[2]= {s_re0,s_re1},*s_im[2]= {s_im0,s_im1},*r_re[2]= {r_re0,r_re1},*r_im[2]= {r_im0,r_im1};
|
||||
double iqim = 0.0;
|
||||
int subframe=1;
|
||||
char fname[40];//, vname[40];
|
||||
uint8_t transmission_mode = 1,n_tx=1,n_rx=2;
|
||||
uint16_t Nid_cell=0;
|
||||
|
||||
FILE *fd;
|
||||
|
||||
int eNB_id = 0;
|
||||
unsigned char mcs=0,awgn_flag=0,round;
|
||||
|
||||
int n_frames=1;
|
||||
channel_desc_t *eNB2UE;
|
||||
uint32_t nsymb,tx_lev,tx_lev_dB;
|
||||
uint8_t extended_prefix_flag=1;
|
||||
LTE_DL_FRAME_PARMS *frame_parms;
|
||||
int hold_channel=0;
|
||||
|
||||
|
||||
uint16_t NB_RB=25;
|
||||
|
||||
int tdd_config=3;
|
||||
|
||||
SCM_t channel_model=MBSFN;
|
||||
|
||||
|
||||
unsigned char *input_buffer;
|
||||
unsigned short input_buffer_length;
|
||||
unsigned int ret;
|
||||
|
||||
unsigned int trials,errs[4]= {0,0,0,0}; //,round_trials[4]={0,0,0,0};
|
||||
|
||||
uint8_t N_RB_DL=25,osf=1;
|
||||
uint32_t perfect_ce = 0;
|
||||
|
||||
lte_frame_type_t frame_type = FDD;
|
||||
|
||||
uint32_t Nsoft = 1827072;
|
||||
|
||||
/*
|
||||
#ifdef XFORMS
|
||||
#ifdef XFORMS
|
||||
FD_lte_phy_scope_ue *form_ue;
|
||||
char title[255];
|
||||
|
||||
@@ -113,114 +96,110 @@ int main(int argc, char **argv)
|
||||
form_ue = create_lte_phy_scope_ue();
|
||||
sprintf (title, "LTE DL SCOPE UE");
|
||||
fl_show_form (form_ue->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
|
||||
#endif
|
||||
#endif
|
||||
*/
|
||||
|
||||
cpuf = get_cpu_freq_GHz();
|
||||
|
||||
logInit();
|
||||
number_of_cards = 1;
|
||||
|
||||
while ((c = getopt (argc, argv, "ahA:Cp:n:s:S:t:x:y:z:N:F:R:O:dm:i:Y")) != -1) {
|
||||
switch (c) {
|
||||
case 'a':
|
||||
awgn_flag=1;
|
||||
break;
|
||||
case 'a':
|
||||
awgn_flag=1;
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
frame_type = 0;
|
||||
break;
|
||||
case 'd':
|
||||
frame_type = 0;
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
n_frames = atoi(optarg);
|
||||
break;
|
||||
case 'n':
|
||||
n_frames = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
mcs=atoi(optarg);
|
||||
break;
|
||||
case 'm':
|
||||
mcs=atoi(optarg);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
snr0 = atof(optarg);
|
||||
msg("Setting SNR0 to %f\n",snr0);
|
||||
break;
|
||||
case 's':
|
||||
snr0 = atof(optarg);
|
||||
msg("Setting SNR0 to %f\n",snr0);
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
input_snr_step = atof(optarg);
|
||||
break;
|
||||
case 'i':
|
||||
input_snr_step = atof(optarg);
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
snr1 = atof(optarg);
|
||||
snr1set=1;
|
||||
msg("Setting SNR1 to %f\n",snr1);
|
||||
break;
|
||||
case 'S':
|
||||
snr1 = atof(optarg);
|
||||
snr1set=1;
|
||||
msg("Setting SNR1 to %f\n",snr1);
|
||||
break;
|
||||
|
||||
case 'p': // subframe no;
|
||||
subframe=atoi(optarg);
|
||||
break;
|
||||
case 'p': // subframe no;
|
||||
subframe=atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
n_rx=atoi(optarg);
|
||||
case 'z':
|
||||
n_rx=atoi(optarg);
|
||||
|
||||
if ((n_rx==0) || (n_rx>2)) {
|
||||
msg("Unsupported number of rx antennas %d\n",n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
if ((n_rx==0) || (n_rx>2)) {
|
||||
msg("Unsupported number of rx antennas %d\n",n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
Nid_cell = atoi(optarg);
|
||||
break;
|
||||
case 'N':
|
||||
Nid_cell = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
N_RB_DL = atoi(optarg);
|
||||
case 'R':
|
||||
N_RB_DL = atoi(optarg);
|
||||
|
||||
if ((N_RB_DL!=6) && (N_RB_DL!=25) && (N_RB_DL!=50) && (N_RB_DL!=100)) {
|
||||
printf("Unsupported Bandwidth %d\n",N_RB_DL);
|
||||
exit(-1);
|
||||
}
|
||||
if ((N_RB_DL!=6) && (N_RB_DL!=25) && (N_RB_DL!=50) && (N_RB_DL!=100)) {
|
||||
printf("Unsupported Bandwidth %d\n",N_RB_DL);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'O':
|
||||
osf = atoi(optarg);
|
||||
break;
|
||||
case 'O':
|
||||
osf = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'Y':
|
||||
perfect_ce = 1;
|
||||
break;
|
||||
case 'Y':
|
||||
perfect_ce = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
case 'h':
|
||||
printf("%s -h(elp) -p(subframe) -N cell_id -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -i snr increment -z RXant \n",argv[0]);
|
||||
printf("-h This message\n");
|
||||
printf("-a Use AWGN Channel\n");
|
||||
printf("-p Use extended prefix mode\n");
|
||||
printf("-d Use TDD\n");
|
||||
printf("-n Number of frames to simulate\n");
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n");
|
||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||
printf("-t Delay spread for multipath channel\n");
|
||||
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
|
||||
printf("-x Transmission mode (1,2,6 for the moment)\n");
|
||||
printf("-y Number of TX antennas used in eNB\n");
|
||||
printf("-z Number of RX antennas used in UE\n");
|
||||
printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
|
||||
printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
|
||||
printf("-N Nid_cell\n");
|
||||
printf("-R N_RB_DL\n");
|
||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
printf("-A Interpolation_filname Run with Abstraction to generate Scatter plot using interpolation polynomial in file\n");
|
||||
printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n");
|
||||
printf("-f Output filename (.txt format) for Pe/SNR results\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
exit (-1);
|
||||
break;
|
||||
default:
|
||||
case 'h':
|
||||
printf("%s -h(elp) -p(subframe) -N cell_id -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -i snr increment -z RXant \n",argv[0]);
|
||||
printf("-h This message\n");
|
||||
printf("-a Use AWGN Channel\n");
|
||||
printf("-p Use extended prefix mode\n");
|
||||
printf("-d Use TDD\n");
|
||||
printf("-n Number of frames to simulate\n");
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n");
|
||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||
printf("-t Delay spread for multipath channel\n");
|
||||
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
|
||||
printf("-x Transmission mode (1,2,6 for the moment)\n");
|
||||
printf("-y Number of TX antennas used in eNB\n");
|
||||
printf("-z Number of RX antennas used in UE\n");
|
||||
printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
|
||||
printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
|
||||
printf("-N Nid_cell\n");
|
||||
printf("-R N_RB_DL\n");
|
||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
printf("-A Interpolation_filname Run with Abstraction to generate Scatter plot using interpolation polynomial in file\n");
|
||||
printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n");
|
||||
printf("-f Output filename (.txt format) for Pe/SNR results\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
exit (-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (awgn_flag == 1)
|
||||
channel_model = AWGN;
|
||||
|
||||
@@ -229,7 +208,6 @@ int main(int argc, char **argv)
|
||||
if ((subframe == 0) || (subframe == 5) || // TDD and FDD SFn 0,5;
|
||||
((frame_type == FDD) && ((subframe == 4) || (subframe == 9))) || // FDD SFn 4,9;
|
||||
((frame_type == TDD ) && ((subframe<3) || (subframe==6)))) { // TDD SFn 1,2,6;
|
||||
|
||||
printf("Illegal subframe %d for eMBMS transmission (frame_type %d)\n",subframe,frame_type);
|
||||
exit(-1);
|
||||
}
|
||||
@@ -239,16 +217,16 @@ int main(int argc, char **argv)
|
||||
|
||||
lte_param_init(n_tx,
|
||||
n_tx,
|
||||
n_rx,
|
||||
transmission_mode,
|
||||
extended_prefix_flag,
|
||||
frame_type,
|
||||
Nid_cell,
|
||||
tdd_config,
|
||||
N_RB_DL,
|
||||
0,
|
||||
osf,
|
||||
perfect_ce);
|
||||
n_rx,
|
||||
transmission_mode,
|
||||
extended_prefix_flag,
|
||||
frame_type,
|
||||
Nid_cell,
|
||||
tdd_config,
|
||||
N_RB_DL,
|
||||
0,
|
||||
osf,
|
||||
perfect_ce);
|
||||
|
||||
if (snr1set==0) {
|
||||
if (n_frames==1)
|
||||
@@ -258,7 +236,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
printf("SNR0 %f, SNR1 %f\n",snr0,snr1);
|
||||
|
||||
frame_parms = &eNB->frame_parms;
|
||||
|
||||
if (awgn_flag == 0)
|
||||
@@ -270,7 +247,6 @@ int main(int argc, char **argv)
|
||||
printf("Cannot open %s, check permissions\n",fname);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
||||
if (awgn_flag==0)
|
||||
fprintf(fd,"SNR_%d_%d=[];errs_mch_%d_%d=[];mch_trials_%d_%d=[];\n",
|
||||
@@ -284,23 +260,18 @@ int main(int argc, char **argv)
|
||||
mcs,N_RB_DL);
|
||||
|
||||
fflush(fd);
|
||||
|
||||
txdata = eNB->common_vars.txdata[0];
|
||||
|
||||
nsymb = 12;
|
||||
|
||||
printf("FFT Size %d, Extended Prefix %d, Samples per subframe %d, Symbols per subframe %d, AWGN %d\n",NUMBER_OF_OFDM_CARRIERS,
|
||||
frame_parms->Ncp,frame_parms->samples_per_tti,nsymb,awgn_flag);
|
||||
|
||||
eNB2UE = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx,
|
||||
UE->frame_parms.nb_antennas_rx,
|
||||
channel_model,
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
|
||||
// Create transport channel structures for 2 transport blocks (MIMO)
|
||||
eNB->dlsch_MCH = new_eNB_dlsch(1,8,Nsoft,N_RB_DL,0,&eNB->frame_parms);
|
||||
|
||||
@@ -310,7 +281,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
UE->dlsch_MCH[0] = new_ue_dlsch(1,8,Nsoft,MAX_TURBO_ITERATIONS_MBSFN,N_RB_DL,0);
|
||||
|
||||
eNB->frame_parms.num_MBSFN_config = 1;
|
||||
eNB->frame_parms.MBSFN_config[0].radioframeAllocationPeriod = 0;
|
||||
eNB->frame_parms.MBSFN_config[0].radioframeAllocationOffset = 0;
|
||||
@@ -321,7 +291,6 @@ int main(int argc, char **argv)
|
||||
UE->frame_parms.MBSFN_config[0].radioframeAllocationOffset = 0;
|
||||
UE->frame_parms.MBSFN_config[0].fourFrames_flag = 0;
|
||||
UE->frame_parms.MBSFN_config[0].mbsfn_SubframeConfig=0xff; // activate all possible subframes
|
||||
|
||||
fill_eNB_dlsch_MCH(eNB,mcs,1,0);
|
||||
fill_UE_dlsch_MCH(UE,mcs,1,0,0);
|
||||
|
||||
@@ -333,7 +302,6 @@ int main(int argc, char **argv)
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
||||
input_buffer_length = eNB->dlsch_MCH->harq_processes[0]->TBS/8;
|
||||
input_buffer = (unsigned char *)malloc(input_buffer_length+4);
|
||||
memset(input_buffer,0,input_buffer_length+4);
|
||||
@@ -342,14 +310,12 @@ int main(int argc, char **argv)
|
||||
input_buffer[i]= (unsigned char)(taus()&0xff);
|
||||
}
|
||||
|
||||
|
||||
snr_step = input_snr_step;
|
||||
|
||||
for (SNR=snr0; SNR<snr1; SNR+=snr_step) {
|
||||
UE->proc.proc_rxtx[0].frame_tx=0;
|
||||
eNB->proc.proc_rxtx[0].frame_tx=0;
|
||||
eNB->proc.proc_rxtx[0].subframe_tx=subframe;
|
||||
|
||||
errs[0]=0;
|
||||
errs[1]=0;
|
||||
errs[2]=0;
|
||||
@@ -365,14 +331,11 @@ int main(int argc, char **argv)
|
||||
// printf("Trial %d\n",trials);
|
||||
fflush(stdout);
|
||||
round=0;
|
||||
|
||||
//if (trials%100==0)
|
||||
//eNB2UE[0]->first_run = 1;
|
||||
eNB2UE->first_run = 1;
|
||||
memset(&eNB->common_vars.txdataF[0][0][0],0,FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX*sizeof(int32_t));
|
||||
generate_mch(eNB,&eNB->proc.proc_rxtx[0],input_buffer);
|
||||
|
||||
|
||||
PHY_ofdm_mod(eNB->common_vars.txdataF[0][0], // input,
|
||||
txdata[0], // output
|
||||
frame_parms->ofdm_symbol_size,
|
||||
@@ -382,7 +345,7 @@ int main(int argc, char **argv)
|
||||
|
||||
if (n_frames==1) {
|
||||
LOG_M("txsigF0.m","txsF0", &eNB->common_vars.txdataF[0][0][subframe*nsymb*eNB->frame_parms.ofdm_symbol_size],
|
||||
nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
|
||||
nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
|
||||
//if (eNB->frame_parms.nb_antennas_tx>1)
|
||||
//LOG_M("txsigF1.m","txsF1", &eNB->lte_eNB_common_vars.txdataF[eNB_id][1][subframe*nsymb*eNB->frame_parms.ofdm_symbol_size],nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
|
||||
}
|
||||
@@ -400,11 +363,9 @@ int main(int argc, char **argv)
|
||||
if (n_frames==1) {
|
||||
printf("tx_lev = %d (%d dB)\n",tx_lev,tx_lev_dB);
|
||||
// LOG_M("txsig0.m","txs0", &eNB->common_vars.txdata[0][0][subframe* eNB->frame_parms.samples_per_tti],
|
||||
|
||||
// eNB->frame_parms.samples_per_tti,1,1);
|
||||
}
|
||||
|
||||
|
||||
for (i=0; i<2*frame_parms->samples_per_tti; i++) {
|
||||
for (aa=0; aa<eNB->frame_parms.nb_antennas_tx; aa++) {
|
||||
s_re[aa][i] = ((double)(((short *)eNB->common_vars.txdata[0][aa]))[(2*subframe*UE->frame_parms.samples_per_tti) + (i<<1)]);
|
||||
@@ -415,7 +376,6 @@ int main(int argc, char **argv)
|
||||
//Multipath channel
|
||||
multipath_channel(eNB2UE,s_re,s_im,r_re,r_im,
|
||||
2*frame_parms->samples_per_tti,hold_channel);
|
||||
|
||||
//AWGN
|
||||
sigma2_dB = 10*log10((double)tx_lev) +10*log10((double)eNB->frame_parms.ofdm_symbol_size/(NB_RB*12)) - SNR;
|
||||
sigma2 = pow(10,sigma2_dB/10);
|
||||
@@ -426,67 +386,70 @@ int main(int argc, char **argv)
|
||||
for (i=0; i<2*frame_parms->samples_per_tti; i++) {
|
||||
for (aa=0; aa<eNB->frame_parms.nb_antennas_rx; aa++) {
|
||||
//printf("s_re[0][%d]=> %f , r_re[0][%d]=> %f\n",i,s_re[aa][i],i,r_re[aa][i]);
|
||||
((short*) UE->common_vars.rxdata[aa])[(2*subframe*UE->frame_parms.samples_per_tti)+2*i] =
|
||||
((short *) UE->common_vars.rxdata[aa])[(2*subframe*UE->frame_parms.samples_per_tti)+2*i] =
|
||||
(short) (r_re[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0));
|
||||
((short*) UE->common_vars.rxdata[aa])[(2*subframe*UE->frame_parms.samples_per_tti)+2*i+1] =
|
||||
((short *) UE->common_vars.rxdata[aa])[(2*subframe*UE->frame_parms.samples_per_tti)+2*i+1] =
|
||||
(short) (r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0));
|
||||
}
|
||||
}
|
||||
|
||||
for (l=2; l<12; l++) {
|
||||
|
||||
slot_fep_mbsfn(UE,
|
||||
l,
|
||||
subframe%10,
|
||||
0,
|
||||
0);
|
||||
if (UE->perfect_ce==1) {
|
||||
// fill in perfect channel estimates
|
||||
freq_channel(eNB2UE,UE->frame_parms.N_RB_DL,12*UE->frame_parms.N_RB_DL + 1);
|
||||
for(k=0; k<NUMBER_OF_eNB_MAX; k++) {
|
||||
for(aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
|
||||
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
||||
for (i=0; i<frame_parms->N_RB_DL*12; i++) {
|
||||
((int16_t *) UE->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[k][(aa<<1)+aarx])[2*i+(l*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(int16_t)(eNB2UE->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].x*AMP);
|
||||
((int16_t *) UE->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[k][(aa<<1)+aarx])[2*i+1+(l*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(int16_t)(eNB2UE->chF[aarx+(aa*frame_parms->nb_antennas_rx)][i].y*AMP);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (l==6)
|
||||
for (l2=2;l2<7;l2++)
|
||||
rx_pmch(UE,
|
||||
0,
|
||||
subframe%10,
|
||||
l2);
|
||||
if (l==6)
|
||||
for (l2=2;l2<7;l2++)
|
||||
rx_pmch(UE,
|
||||
0,
|
||||
subframe%10,
|
||||
l2);
|
||||
if (l==11)
|
||||
for (l2=7;l2<12;l2++)
|
||||
rx_pmch(UE,
|
||||
0,
|
||||
subframe%10,
|
||||
l2);
|
||||
if (UE->perfect_ce==1) {
|
||||
// fill in perfect channel estimates
|
||||
freq_channel(eNB2UE,UE->frame_parms.N_RB_DL,12*UE->frame_parms.N_RB_DL + 1);
|
||||
|
||||
for(k=0; k<NUMBER_OF_eNB_MAX; k++) {
|
||||
for(aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
|
||||
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
|
||||
for (i=0; i<frame_parms->N_RB_DL*12; i++) {
|
||||
((int16_t *) UE->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[k][(aa<<1)+aarx])[2*i+(l*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(int16_t)(eNB2UE->chF[aarx+
|
||||
(aa*frame_parms->nb_antennas_rx)][i].x*AMP);
|
||||
((int16_t *) UE->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[k][(aa<<1)+aarx])[2*i+1+(l*frame_parms->ofdm_symbol_size+LTE_CE_FILTER_LENGTH)*2]=(int16_t)(eNB2UE->chF[aarx+
|
||||
(aa*frame_parms->nb_antennas_rx)][i].y*AMP);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (l==6)
|
||||
for (l2=2; l2<7; l2++)
|
||||
rx_pmch(UE,
|
||||
0,
|
||||
subframe%10,
|
||||
l2);
|
||||
|
||||
if (l==6)
|
||||
for (l2=2; l2<7; l2++)
|
||||
rx_pmch(UE,
|
||||
0,
|
||||
subframe%10,
|
||||
l2);
|
||||
|
||||
if (l==11)
|
||||
for (l2=7; l2<12; l2++)
|
||||
rx_pmch(UE,
|
||||
0,
|
||||
subframe%10,
|
||||
l2);
|
||||
}
|
||||
|
||||
UE->dlsch_MCH[0]->harq_processes[0]->G = get_G(&UE->frame_parms,
|
||||
UE->dlsch_MCH[0]->harq_processes[0]->nb_rb,
|
||||
UE->dlsch_MCH[0]->harq_processes[0]->rb_alloc_even,
|
||||
get_Qm(UE->dlsch_MCH[0]->harq_processes[0]->mcs),
|
||||
1,2,
|
||||
UE->proc.proc_rxtx[0].frame_tx,subframe,0);
|
||||
UE->dlsch_MCH[0]->harq_processes[0]->nb_rb,
|
||||
UE->dlsch_MCH[0]->harq_processes[0]->rb_alloc_even,
|
||||
get_Qm(UE->dlsch_MCH[0]->harq_processes[0]->mcs),
|
||||
1,2,
|
||||
UE->proc.proc_rxtx[0].frame_tx,subframe,0);
|
||||
UE->dlsch_MCH[0]->harq_processes[0]->Qm = get_Qm(UE->dlsch_MCH[0]->harq_processes[0]->mcs);
|
||||
|
||||
dlsch_unscrambling(&UE->frame_parms,1,UE->dlsch_MCH[0],
|
||||
UE->dlsch_MCH[0]->harq_processes[0]->G,
|
||||
UE->pdsch_vars_MCH[0]->llr[0],0,subframe<<1);
|
||||
|
||||
ret = dlsch_decoding(UE,
|
||||
UE->pdsch_vars_MCH[0]->llr[0],
|
||||
&UE->frame_parms,
|
||||
@@ -497,7 +460,7 @@ int main(int argc, char **argv)
|
||||
0,0,0);
|
||||
|
||||
if (n_frames==1)
|
||||
printf("MCH decoding returns %d\n",ret);
|
||||
printf("MCH decoding returns %u\n",ret);
|
||||
|
||||
if (ret == (1+UE->dlsch_MCH[0]->max_turbo_iterations))
|
||||
errs[0]++;
|
||||
@@ -506,15 +469,15 @@ int main(int argc, char **argv)
|
||||
eNB->proc.proc_rxtx[0].frame_tx++;
|
||||
}
|
||||
|
||||
printf("errors %d/%d (Pe %e)\n",errs[round],trials,(double)errs[round]/trials);
|
||||
printf("errors %u/%u (Pe %e)\n",errs[round],trials,(double)errs[round]/trials);
|
||||
|
||||
if (awgn_flag==0)
|
||||
fprintf(fd,"SNR_%d_%d = [SNR_%d_%d %f]; errs_mch_%d_%d =[errs_mch_%d_%d %d]; mch_trials_%d_%d =[mch_trials_%d_%d %d];\n",
|
||||
fprintf(fd,"SNR_%d_%d = [SNR_%d_%d %f]; errs_mch_%d_%d =[errs_mch_%d_%d %u]; mch_trials_%d_%d =[mch_trials_%d_%d %u];\n",
|
||||
mcs,N_RB_DL,mcs,N_RB_DL,SNR,
|
||||
mcs,N_RB_DL,mcs,N_RB_DL,errs[0],
|
||||
mcs,N_RB_DL,mcs,N_RB_DL,trials);
|
||||
else
|
||||
fprintf(fd,"SNR_awgn_%d = [SNR_awgn_%d %f]; errs_mch_awgn_%d =[errs_mch_awgn_%d %d]; mch_trials_awgn_%d =[mch_trials_awgn_%d %d];\n",
|
||||
fprintf(fd,"SNR_awgn_%d = [SNR_awgn_%d %f]; errs_mch_awgn_%d =[errs_mch_awgn_%d %u]; mch_trials_awgn_%d =[mch_trials_awgn_%d %u];\n",
|
||||
N_RB_DL,N_RB_DL,SNR,
|
||||
N_RB_DL,N_RB_DL,errs[0],
|
||||
N_RB_DL,N_RB_DL,trials);
|
||||
@@ -525,7 +488,6 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (n_frames==1) {
|
||||
printf("Dumping PMCH files ( G %d)\n",UE->dlsch_MCH[0]->harq_processes[0]->G);
|
||||
dump_mch(UE,0,
|
||||
@@ -536,9 +498,7 @@ int main(int argc, char **argv)
|
||||
printf("Freeing dlsch structures\n");
|
||||
free_eNB_dlsch(eNB->dlsch_MCH);
|
||||
free_ue_dlsch(UE->dlsch_MCH[0]);
|
||||
|
||||
fclose(fd);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include "LAYER2/MAC/vars.h"
|
||||
|
||||
#ifdef XFORMS
|
||||
#include "PHY/TOOLS/lte_phy_scope.h"
|
||||
#include "PHY/TOOLS/lte_phy_scope.h"
|
||||
#endif
|
||||
|
||||
#include "OCG_vars.h"
|
||||
@@ -58,11 +58,8 @@ int32_t dummy2[2048*14];
|
||||
int32_t dummy3[2048*14];
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
char c;
|
||||
|
||||
int i,l,aa;
|
||||
double sigma2, sigma2_dB=0,SNR,snr0=-2.0,snr1;
|
||||
uint8_t snr1set=0;
|
||||
@@ -81,127 +78,119 @@ int main(int argc, char **argv)
|
||||
int trial, n_trials, ntrials=1, n_errors,n_errors2,n_alamouti;
|
||||
uint8_t transmission_mode = 1,n_tx=1,n_rx=1;
|
||||
uint16_t Nid_cell=0;
|
||||
|
||||
int n_frames=1;
|
||||
channel_desc_t *eNB2UE,*eNB2UE1 = NULL,*eNB2UE2 = NULL;
|
||||
uint32_t nsymb,tx_lev,tx_lev1 = 0,tx_lev2 = 0;
|
||||
uint8_t extended_prefix_flag=0;
|
||||
int8_t interf1=-21,interf2=-21;
|
||||
LTE_DL_FRAME_PARMS *frame_parms;
|
||||
|
||||
FILE *input_fd=NULL,*pbch_file_fd=NULL;
|
||||
char input_val_str[50],input_val_str2[50];
|
||||
// double input_val1,input_val2;
|
||||
// uint16_t amask=0;
|
||||
uint8_t frame_mod4,num_pdcch_symbols = 0;
|
||||
uint16_t NB_RB=25;
|
||||
|
||||
SCM_t channel_model=AWGN;//Rayleigh1_anticorr;
|
||||
|
||||
//DCI_ALLOC_t dci_alloc[8];
|
||||
uint8_t abstraction_flag=0;//,calibration_flag=0;
|
||||
double pbch_sinr;
|
||||
int pbch_tx_ant;
|
||||
uint8_t N_RB_DL=25,osf=1;
|
||||
|
||||
unsigned char frame_type = 0;
|
||||
unsigned char pbch_phase = 0;
|
||||
|
||||
#ifdef XFORMS
|
||||
FD_lte_phy_scope_ue *form_ue;
|
||||
char title[255];
|
||||
#endif
|
||||
|
||||
cpuf = get_cpu_freq_GHz();
|
||||
|
||||
logInit();
|
||||
number_of_cards = 1;
|
||||
|
||||
while ((c = getopt (argc, argv, "f:hA:pf:g:i:j:n:s:S:t:x:y:z:N:F:GR:O:dP:")) != -1) {
|
||||
switch (c) {
|
||||
case 'f':
|
||||
write_output_file=1;
|
||||
output_fd = fopen(optarg,"w");
|
||||
case 'f':
|
||||
write_output_file=1;
|
||||
output_fd = fopen(optarg,"w");
|
||||
|
||||
if (output_fd==NULL) {
|
||||
printf("Error opening %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
if (output_fd==NULL) {
|
||||
printf("Error opening %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
frame_type = 1;
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
switch((char)*optarg) {
|
||||
case 'A':
|
||||
channel_model=SCM_A;
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
channel_model=SCM_B;
|
||||
case 'd':
|
||||
frame_type = 1;
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
channel_model=SCM_C;
|
||||
case 'g':
|
||||
switch((char)*optarg) {
|
||||
case 'A':
|
||||
channel_model=SCM_A;
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
channel_model=SCM_B;
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
channel_model=SCM_C;
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
channel_model=SCM_D;
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
channel_model=EPA;
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
channel_model=EVA;
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
channel_model=ETU;
|
||||
break;
|
||||
|
||||
default:
|
||||
msg("Unsupported channel model!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
channel_model=SCM_D;
|
||||
case 'i':
|
||||
interf1=atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
channel_model=EPA;
|
||||
case 'j':
|
||||
interf2=atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
channel_model=EVA;
|
||||
case 'n':
|
||||
n_frames = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
channel_model=ETU;
|
||||
case 's':
|
||||
snr0 = atof(optarg);
|
||||
msg("Setting SNR0 to %f\n",snr0);
|
||||
break;
|
||||
|
||||
default:
|
||||
msg("Unsupported channel model!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
interf1=atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'j':
|
||||
interf2=atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
n_frames = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
snr0 = atof(optarg);
|
||||
msg("Setting SNR0 to %f\n",snr0);
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
snr1 = atof(optarg);
|
||||
snr1set=1;
|
||||
msg("Setting SNR1 to %f\n",snr1);
|
||||
break;
|
||||
case 'S':
|
||||
snr1 = atof(optarg);
|
||||
snr1set=1;
|
||||
msg("Setting SNR1 to %f\n",snr1);
|
||||
break;
|
||||
|
||||
/*
|
||||
case 't':
|
||||
Td= atof(optarg);
|
||||
break;
|
||||
*/
|
||||
case 'p':
|
||||
extended_prefix_flag=1;
|
||||
break;
|
||||
case 'p':
|
||||
extended_prefix_flag=1;
|
||||
break;
|
||||
|
||||
/*
|
||||
case 'r':
|
||||
@@ -212,111 +201,111 @@ int main(int argc, char **argv)
|
||||
}
|
||||
break;
|
||||
*/
|
||||
case 'x':
|
||||
transmission_mode=atoi(optarg);
|
||||
case 'x':
|
||||
transmission_mode=atoi(optarg);
|
||||
|
||||
if ((transmission_mode!=1) &&
|
||||
(transmission_mode!=2) &&
|
||||
(transmission_mode!=6)) {
|
||||
msg("Unsupported transmission mode %d\n",transmission_mode);
|
||||
exit(-1);
|
||||
}
|
||||
if ((transmission_mode!=1) &&
|
||||
(transmission_mode!=2) &&
|
||||
(transmission_mode!=6)) {
|
||||
msg("Unsupported transmission mode %d\n",transmission_mode);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
n_tx=atoi(optarg);
|
||||
case 'y':
|
||||
n_tx=atoi(optarg);
|
||||
|
||||
if ((n_tx==0) || (n_tx>2)) {
|
||||
msg("Unsupported number of tx antennas %d\n",n_tx);
|
||||
exit(-1);
|
||||
}
|
||||
if ((n_tx==0) || (n_tx>2)) {
|
||||
msg("Unsupported number of tx antennas %d\n",n_tx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
n_rx=atoi(optarg);
|
||||
case 'z':
|
||||
n_rx=atoi(optarg);
|
||||
|
||||
if ((n_rx==0) || (n_rx>2)) {
|
||||
msg("Unsupported number of rx antennas %d\n",n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
if ((n_rx==0) || (n_rx>2)) {
|
||||
msg("Unsupported number of rx antennas %d\n",n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'A':
|
||||
abstraction_flag=1;
|
||||
ntrials=10000;
|
||||
msg("Running Abstraction test\n");
|
||||
pbch_file_fd=fopen(optarg,"r");
|
||||
case 'A':
|
||||
abstraction_flag=1;
|
||||
ntrials=10000;
|
||||
msg("Running Abstraction test\n");
|
||||
pbch_file_fd=fopen(optarg,"r");
|
||||
|
||||
if (pbch_file_fd==NULL) {
|
||||
printf("Problem with filename %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
if (pbch_file_fd==NULL) {
|
||||
printf("Problem with filename %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
// case 'C':
|
||||
// calibration_flag=1;
|
||||
// msg("Running Abstraction calibration for Bias removal\n");
|
||||
// break;
|
||||
case 'N':
|
||||
Nid_cell = atoi(optarg);
|
||||
break;
|
||||
case 'N':
|
||||
Nid_cell = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
N_RB_DL = atoi(optarg);
|
||||
break;
|
||||
case 'R':
|
||||
N_RB_DL = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'O':
|
||||
osf = atoi(optarg);
|
||||
break;
|
||||
case 'O':
|
||||
osf = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
input_fd = fopen(optarg,"r");
|
||||
case 'F':
|
||||
input_fd = fopen(optarg,"r");
|
||||
|
||||
if (input_fd==NULL) {
|
||||
printf("Problem with filename %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
if (input_fd==NULL) {
|
||||
printf("Problem with filename %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
pbch_phase = atoi(optarg);
|
||||
case 'P':
|
||||
pbch_phase = atoi(optarg);
|
||||
|
||||
if (pbch_phase>3)
|
||||
printf("Illegal PBCH phase (0-3) got %d\n",pbch_phase);
|
||||
if (pbch_phase>3)
|
||||
printf("Illegal PBCH phase (0-3) got %d\n",pbch_phase);
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
case 'h':
|
||||
printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n",
|
||||
argv[0]);
|
||||
printf("-h This message\n");
|
||||
printf("-p Use extended prefix mode\n");
|
||||
printf("-d Use TDD\n");
|
||||
printf("-n Number of frames to simulate\n");
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n");
|
||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||
printf("-t Delay spread for multipath channel\n");
|
||||
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
|
||||
printf("-x Transmission mode (1,2,6 for the moment)\n");
|
||||
printf("-y Number of TX antennas used in eNB\n");
|
||||
printf("-z Number of RX antennas used in UE\n");
|
||||
printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
|
||||
printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
|
||||
printf("-N Nid_cell\n");
|
||||
printf("-R N_RB_DL\n");
|
||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
printf("-A Interpolation_filname Run with Abstraction to generate Scatter plot using interpolation polynomial in file\n");
|
||||
// printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n");
|
||||
printf("-f Output filename (.txt format) for Pe/SNR results\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
exit (-1);
|
||||
break;
|
||||
default:
|
||||
case 'h':
|
||||
printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n",
|
||||
argv[0]);
|
||||
printf("-h This message\n");
|
||||
printf("-p Use extended prefix mode\n");
|
||||
printf("-d Use TDD\n");
|
||||
printf("-n Number of frames to simulate\n");
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n");
|
||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||
printf("-t Delay spread for multipath channel\n");
|
||||
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
|
||||
printf("-x Transmission mode (1,2,6 for the moment)\n");
|
||||
printf("-y Number of TX antennas used in eNB\n");
|
||||
printf("-z Number of RX antennas used in UE\n");
|
||||
printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
|
||||
printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
|
||||
printf("-N Nid_cell\n");
|
||||
printf("-R N_RB_DL\n");
|
||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
printf("-A Interpolation_filname Run with Abstraction to generate Scatter plot using interpolation polynomial in file\n");
|
||||
// printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n");
|
||||
printf("-f Output filename (.txt format) for Pe/SNR results\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
exit (-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,7 +313,6 @@ int main(int argc, char **argv)
|
||||
n_tx=2;
|
||||
|
||||
lte_param_init(n_tx, n_tx,n_rx,transmission_mode,extended_prefix_flag,frame_type,Nid_cell,3,N_RB_DL,0,osf,0);
|
||||
|
||||
eNB1 = malloc(sizeof(PHY_VARS_eNB));
|
||||
eNB2 = malloc(sizeof(PHY_VARS_eNB));
|
||||
UE->measurements.n_adj_cells=2;
|
||||
@@ -334,19 +322,16 @@ int main(int argc, char **argv)
|
||||
for (i=0; i<3; i++)
|
||||
lte_gold(&eNB->frame_parms,UE->lte_gold_table[i],Nid_cell+i);
|
||||
|
||||
memcpy((void*)&eNB1->frame_parms,(void*)&eNB->frame_parms,sizeof(LTE_DL_FRAME_PARMS));
|
||||
memcpy((void *)&eNB1->frame_parms,(void *)&eNB->frame_parms,sizeof(LTE_DL_FRAME_PARMS));
|
||||
eNB1->frame_parms.Nid_cell=Nid_cell+1;
|
||||
eNB1->frame_parms.nushift=(Nid_cell+1)%6;
|
||||
eNB1->Mod_id=1;
|
||||
|
||||
memcpy((void*)&eNB2->frame_parms,(void*)&eNB->frame_parms,sizeof(LTE_DL_FRAME_PARMS));
|
||||
memcpy((void *)&eNB2->frame_parms,(void *)&eNB->frame_parms,sizeof(LTE_DL_FRAME_PARMS));
|
||||
eNB2->frame_parms.Nid_cell=Nid_cell+2;
|
||||
eNB2->frame_parms.nushift=(Nid_cell+2)%6;
|
||||
eNB2->Mod_id=2;
|
||||
|
||||
phy_init_lte_eNB(eNB1,0,0);
|
||||
phy_init_lte_eNB(eNB2,0,0);
|
||||
|
||||
#ifdef XFORMS
|
||||
fl_initialize (&argc, argv, NULL, 0, 0);
|
||||
form_ue = create_lte_phy_scope_ue();
|
||||
@@ -362,38 +347,27 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
printf("SNR0 %f, SNR1 %f\n",snr0,snr1);
|
||||
|
||||
frame_parms = &eNB->frame_parms;
|
||||
|
||||
|
||||
|
||||
txdata = eNB->common_vars.txdata[0];
|
||||
txdata1 = eNB1->common_vars.txdata[0];
|
||||
txdata2 = eNB2->common_vars.txdata[0];
|
||||
|
||||
|
||||
s_re = malloc(2*sizeof(double*));
|
||||
s_im = malloc(2*sizeof(double*));
|
||||
s_re1 = malloc(2*sizeof(double*));
|
||||
s_im1 = malloc(2*sizeof(double*));
|
||||
s_re2 = malloc(2*sizeof(double*));
|
||||
s_im2 = malloc(2*sizeof(double*));
|
||||
r_re = malloc(2*sizeof(double*));
|
||||
r_im = malloc(2*sizeof(double*));
|
||||
r_re1 = malloc(2*sizeof(double*));
|
||||
r_im1 = malloc(2*sizeof(double*));
|
||||
r_re2 = malloc(2*sizeof(double*));
|
||||
r_im2 = malloc(2*sizeof(double*));
|
||||
|
||||
s_re = malloc(2*sizeof(double *));
|
||||
s_im = malloc(2*sizeof(double *));
|
||||
s_re1 = malloc(2*sizeof(double *));
|
||||
s_im1 = malloc(2*sizeof(double *));
|
||||
s_re2 = malloc(2*sizeof(double *));
|
||||
s_im2 = malloc(2*sizeof(double *));
|
||||
r_re = malloc(2*sizeof(double *));
|
||||
r_im = malloc(2*sizeof(double *));
|
||||
r_re1 = malloc(2*sizeof(double *));
|
||||
r_im1 = malloc(2*sizeof(double *));
|
||||
r_re2 = malloc(2*sizeof(double *));
|
||||
r_im2 = malloc(2*sizeof(double *));
|
||||
nsymb = (frame_parms->Ncp == 0) ? 14 : 12;
|
||||
|
||||
printf("FFT Size %d, Extended Prefix %d, Samples per subframe %d, Symbols per subframe %d, interf (%d,%d)\n",NUMBER_OF_OFDM_CARRIERS,
|
||||
frame_parms->Ncp,frame_parms->samples_per_tti,nsymb,interf1,interf2);
|
||||
|
||||
printf("eNB1->common_vars.txdataF[0][0] = %p\n",
|
||||
eNB1->common_vars.txdataF[0][0]);
|
||||
|
||||
|
||||
DLSCH_alloc_pdu2.rah = 0;
|
||||
DLSCH_alloc_pdu2.rballoc = DLSCH_RB_ALLOC;
|
||||
DLSCH_alloc_pdu2.TPC = 0;
|
||||
@@ -405,12 +379,11 @@ int main(int argc, char **argv)
|
||||
DLSCH_alloc_pdu2.rv1 = 0;
|
||||
// Forget second codeword
|
||||
DLSCH_alloc_pdu2.tpmi = (transmission_mode==6 ? 5 : 0) ; // precoding
|
||||
|
||||
eNB2UE = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx,
|
||||
UE->frame_parms.nb_antennas_rx,
|
||||
channel_model,
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
@@ -419,8 +392,8 @@ int main(int argc, char **argv)
|
||||
eNB2UE1 = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx,
|
||||
UE->frame_parms.nb_antennas_rx,
|
||||
channel_model,
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
0,
|
||||
4,
|
||||
0);
|
||||
@@ -429,20 +402,18 @@ int main(int argc, char **argv)
|
||||
eNB2UE2 = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx,
|
||||
UE->frame_parms.nb_antennas_rx,
|
||||
channel_model,
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_DL),
|
||||
0,
|
||||
8,
|
||||
0);
|
||||
|
||||
|
||||
if (eNB2UE==NULL) {
|
||||
msg("Problem generating channel model. Exiting.\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
for (i=0; i<2; i++) {
|
||||
|
||||
s_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
bzero(s_re[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
s_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
@@ -455,7 +426,6 @@ int main(int argc, char **argv)
|
||||
bzero(s_re2[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
s_im2[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
bzero(s_im2[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
|
||||
r_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
bzero(r_re[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
r_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
@@ -487,7 +457,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (input_fd==NULL) {
|
||||
|
||||
// for (i=0;i<6;i++)
|
||||
// pbch_pdu[i] = i;
|
||||
pbch_pdu[0]=100;
|
||||
@@ -515,7 +484,6 @@ int main(int argc, char **argv)
|
||||
&eNB->frame_parms,
|
||||
(eNB->frame_parms.Ncp==0) ? 5 : 4,
|
||||
10);
|
||||
|
||||
} else {
|
||||
generate_sss(eNB->common_vars.txdataF[0],
|
||||
AMP,
|
||||
@@ -537,8 +505,6 @@ int main(int argc, char **argv)
|
||||
&eNB->frame_parms,
|
||||
2,
|
||||
12);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -552,16 +518,12 @@ int main(int argc, char **argv)
|
||||
dci_alloc[1].L = 3;
|
||||
dci_alloc[1].rnti = 0x1234;
|
||||
*/
|
||||
|
||||
printf("Generating PBCH for mode1_flag = %d\n", eNB->frame_parms.mode1_flag);
|
||||
|
||||
|
||||
generate_pilots(eNB,
|
||||
eNB->common_vars.txdataF[0],
|
||||
AMP,
|
||||
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
|
||||
|
||||
|
||||
/*
|
||||
num_pdcch_symbols = generate_dci_top(1,
|
||||
dci_alloc,
|
||||
@@ -572,7 +534,6 @@ int main(int argc, char **argv)
|
||||
0);
|
||||
*/
|
||||
|
||||
|
||||
if (num_pdcch_symbols<3) {
|
||||
printf("Less than 3 pdcch symbols\n");
|
||||
// exit(-1);
|
||||
@@ -584,7 +545,7 @@ int main(int argc, char **argv)
|
||||
dummybuf[2] = dummy2;
|
||||
dummybuf[3] = dummy3;
|
||||
generate_pbch(&eNB->pbch,
|
||||
(int32_t**)dummybuf,
|
||||
(int32_t **)dummybuf,
|
||||
AMP,
|
||||
&eNB->frame_parms,
|
||||
pbch_pdu,
|
||||
@@ -618,15 +579,12 @@ int main(int argc, char **argv)
|
||||
eNB1->common_vars.txdataF[0],
|
||||
AMP,
|
||||
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
|
||||
|
||||
|
||||
generate_pbch(&eNB1->pbch,
|
||||
eNB1->common_vars.txdataF[0],
|
||||
AMP,
|
||||
&eNB1->frame_parms,
|
||||
pbch_pdu,
|
||||
0);
|
||||
|
||||
}
|
||||
|
||||
if (interf2>-20) {
|
||||
@@ -638,27 +596,19 @@ int main(int argc, char **argv)
|
||||
0);
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
generate_pilots(eNB2,
|
||||
eNB2->common_vars.txdataF[0],
|
||||
AMP,
|
||||
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
|
||||
|
||||
|
||||
generate_pbch(&eNB2->pbch,
|
||||
eNB2->common_vars.txdataF[0],
|
||||
AMP,
|
||||
&eNB2->frame_parms,
|
||||
pbch_pdu,
|
||||
0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// LOG_M("pilotsF.m","rsF",txdataF[0],frame_parms->ofdm_symbol_size,1,1);
|
||||
|
||||
LOG_M("txsigF0.m","txsF0", eNB->common_vars.txdataF[0][0],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX,1,1);
|
||||
|
||||
if (eNB->frame_parms.nb_antennas_tx>1)
|
||||
@@ -668,9 +618,6 @@ int main(int argc, char **argv)
|
||||
tx_lev1 = 0;
|
||||
tx_lev2 = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
for (aa=0; aa<eNB->frame_parms.nb_antennas_tx; aa++) {
|
||||
if (frame_parms->Ncp == 1)
|
||||
PHY_ofdm_mod(eNB->common_vars.txdataF[0][aa], // input,
|
||||
@@ -743,7 +690,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
// tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
|
||||
|
||||
LOG_M("txsig0.m","txs0", txdata[0],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
|
||||
|
||||
if (frame_parms->nb_antennas_tx>1)
|
||||
@@ -762,17 +708,17 @@ int main(int argc, char **argv)
|
||||
i=0;
|
||||
|
||||
while (!feof(input_fd)) {
|
||||
if (fscanf(input_fd,"%s %s",input_val_str,input_val_str2) != 2) { //&input_val1,&input_val2);
|
||||
if (fscanf(input_fd,"%49s %49s",input_val_str,input_val_str2) != 2) { //&input_val1,&input_val2);
|
||||
printf("%s:%d:%s: error with fscanf, exiting\n", __FILE__, __LINE__, __FUNCTION__);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((i%4)==0) {
|
||||
((short*)txdata[0])[i/2] = (short)((1<<15)*strtod(input_val_str,NULL));
|
||||
((short*)txdata[0])[(i/2)+1] = (short)((1<<15)*strtod(input_val_str2,NULL));
|
||||
((short *)txdata[0])[i/2] = (short)((1<<15)*strtod(input_val_str,NULL));
|
||||
((short *)txdata[0])[(i/2)+1] = (short)((1<<15)*strtod(input_val_str2,NULL));
|
||||
|
||||
if ((i/4)<100)
|
||||
printf("sample %d => %e + j%e (%d +j%d)\n",i/4,strtod(input_val_str,NULL),strtod(input_val_str2,NULL),((short*)txdata[0])[i/4],((short*)txdata[0])[(i/4)+1]);//1,input_val2,);
|
||||
printf("sample %d => %e + j%e (%d +j%d)\n",i/4,strtod(input_val_str,NULL),strtod(input_val_str2,NULL),((short *)txdata[0])[i/4],((short *)txdata[0])[(i/4)+1]); //1,input_val2,);
|
||||
}
|
||||
|
||||
i++;
|
||||
@@ -789,7 +735,6 @@ int main(int argc, char **argv)
|
||||
// tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
|
||||
}
|
||||
|
||||
|
||||
// multipath channel
|
||||
|
||||
for (i=0; i<2*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; i++) {
|
||||
@@ -809,10 +754,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (SNR=snr0; SNR<snr1; SNR+=.2) {
|
||||
|
||||
|
||||
n_errors = 0;
|
||||
n_errors2 = 0;
|
||||
n_alamouti = 0;
|
||||
@@ -824,8 +766,6 @@ int main(int argc, char **argv)
|
||||
printf("*********************** trial %d ***************************\n",trial);
|
||||
|
||||
while (pbch_sinr>-2.0) {
|
||||
|
||||
|
||||
multipath_channel(eNB2UE,s_re,s_im,r_re,r_im,
|
||||
2*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES,0);
|
||||
|
||||
@@ -882,8 +822,8 @@ int main(int argc, char **argv)
|
||||
r_im[aa][i] += (pow(10.0,.05*interf1)*r_im1[aa][i] + pow(10.0,.05*interf2)*r_im2[aa][i]);
|
||||
}
|
||||
|
||||
((short*) UE->common_vars.rxdata[aa])[2*i] = (short) (.167*(r_re[aa][i] +sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short*) UE->common_vars.rxdata[aa])[2*i+1] = (short) (.167*(r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short *) UE->common_vars.rxdata[aa])[2*i] = (short) (.167*(r_re[aa][i] +sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short *) UE->common_vars.rxdata[aa])[2*i+1] = (short) (.167*(r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -892,7 +832,6 @@ int main(int argc, char **argv)
|
||||
10*log10(signal_energy(&UE->common_vars.rxdata[0][frame_parms->samples_per_tti/2],4*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES)));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// optional: read rx_frame from file
|
||||
if ((rx_frame_file = fopen("rx_frame.dat","r")) == NULL)
|
||||
@@ -911,19 +850,15 @@ int main(int argc, char **argv)
|
||||
fclose(rx_frame_file);
|
||||
*/
|
||||
|
||||
|
||||
for (l=0; l<eNB->frame_parms.symbols_per_tti; l++) {
|
||||
|
||||
// subframe_offset = (l/eNB->frame_parms.symbols_per_tti)*eNB->frame_parms.samples_per_tti;
|
||||
// printf("subframe_offset = %d\n",subframe_offset);
|
||||
|
||||
slot_fep(UE,
|
||||
l%(eNB->frame_parms.symbols_per_tti/2),
|
||||
l/(eNB->frame_parms.symbols_per_tti/2),
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
|
||||
0);
|
||||
|
||||
if (l==0) {
|
||||
lte_ue_measurements(UE,
|
||||
@@ -961,16 +896,14 @@ int main(int argc, char **argv)
|
||||
//sprintf(fname,"dl_ch00_%d.m",l);
|
||||
//sprintf(vname,"dl_ch00_%d",l);
|
||||
//LOG_M(fname,vname,&(common_vars->dl_ch_estimates[0][frame_parms->ofdm_symbol_size*(l%6)]),frame_parms->ofdm_symbol_size,1,1);
|
||||
|
||||
lte_est_freq_offset(UE->common_vars.common_vars_rx_data_per_thread[/*subframe*/0&0x1].dl_ch_estimates[0],
|
||||
&UE->frame_parms,
|
||||
l,
|
||||
&freq_offset,
|
||||
1);
|
||||
1);
|
||||
}
|
||||
|
||||
if (l==((eNB->frame_parms.Ncp==0)?10:9)) {
|
||||
|
||||
for (frame_mod4=0; frame_mod4<4; frame_mod4++) {
|
||||
pbch_tx_ant = rx_pbch(&UE->common_vars,
|
||||
UE->pbch_vars[0],
|
||||
@@ -1003,7 +936,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((pbch_tx_ant>0) && (pbch_tx_ant<4)) {
|
||||
if (n_frames==1)
|
||||
msg("pbch decoded sucessfully mode1_flag %d, frame_mod4 %d, tx_ant %d!\n",
|
||||
@@ -1023,7 +955,6 @@ int main(int argc, char **argv)
|
||||
UE,
|
||||
0,0,1);
|
||||
#endif
|
||||
|
||||
} //noise trials
|
||||
|
||||
if (abstraction_flag==1) {
|
||||
@@ -1049,7 +980,6 @@ int main(int argc, char **argv)
|
||||
} // NSR
|
||||
|
||||
if (n_frames==1) {
|
||||
|
||||
LOG_M("H00.m","h00",&(UE->common_vars.common_vars_rx_data_per_thread[/*subframe*/0&0x1].dl_ch_estimates[0][0][0]),((frame_parms->Ncp==0)?7:6)*(eNB->frame_parms.ofdm_symbol_size),1,1);
|
||||
|
||||
if (n_tx==2)
|
||||
@@ -1062,7 +992,6 @@ int main(int argc, char **argv)
|
||||
LOG_M("PBCH_rxF_llr.m","pbch_llr",UE->pbch_vars[0]->llr,(frame_parms->Ncp==0) ? 1920 : 1728,1,4);
|
||||
}
|
||||
|
||||
|
||||
for (i=0; i<2; i++) {
|
||||
free(s_re[i]);
|
||||
free(s_im[i]);
|
||||
@@ -1074,15 +1003,15 @@ int main(int argc, char **argv)
|
||||
free(s_im);
|
||||
free(r_re);
|
||||
free(r_im);
|
||||
|
||||
|
||||
lte_sync_time_free();
|
||||
|
||||
if (write_output_file)
|
||||
fclose(output_fd);
|
||||
|
||||
return(n_errors);
|
||||
if (input_fd != NULL)
|
||||
fclose(input_fd);
|
||||
|
||||
return(n_errors);
|
||||
}
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -48,11 +48,8 @@ extern uint16_t prach_root_sequence_map0_3[838];
|
||||
|
||||
void dump_prach_config(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe);
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
char c;
|
||||
|
||||
int i,aa,aarx;
|
||||
double sigma2, sigma2_dB=0,SNR,snr0=-2.0,snr1=0.0,ue_speed0=0.0,ue_speed1=0.0;
|
||||
uint8_t snr1set=0;
|
||||
@@ -64,7 +61,6 @@ int main(int argc, char **argv)
|
||||
int trial; //, ntrials=1;
|
||||
uint8_t transmission_mode = 1,n_tx=1,n_rx=1;
|
||||
uint16_t Nid_cell=0;
|
||||
|
||||
uint8_t awgn_flag=0;
|
||||
uint8_t hs_flag=0;
|
||||
int n_frames=1;
|
||||
@@ -73,9 +69,7 @@ int main(int argc, char **argv)
|
||||
uint8_t extended_prefix_flag=0;
|
||||
// int8_t interf1=-19,interf2=-19;
|
||||
LTE_DL_FRAME_PARMS *frame_parms;
|
||||
|
||||
SCM_t channel_model=Rayleigh1;
|
||||
|
||||
// uint8_t abstraction_flag=0,calibration_flag=0;
|
||||
// double prach_sinr;
|
||||
uint8_t osf=1,N_RB_DL=25;
|
||||
@@ -91,211 +85,212 @@ int main(int argc, char **argv)
|
||||
double ue_speed = 0;
|
||||
int NCS_config = 1,rootSequenceIndex=0;
|
||||
int threequarter_fs = 0;
|
||||
|
||||
cpuf = get_cpu_freq_GHz();
|
||||
|
||||
logInit();
|
||||
|
||||
number_of_cards = 1;
|
||||
|
||||
|
||||
|
||||
while ((c = getopt (argc, argv, "hHaA:Cr:p:g:n:s:S:t:x:y:v:V:z:N:F:d:Z:L:R:E")) != -1) {
|
||||
switch (c) {
|
||||
case 'a':
|
||||
printf("Running AWGN simulation\n");
|
||||
awgn_flag = 1;
|
||||
/* ntrials not used later, no need to set */
|
||||
//ntrials=1;
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
delay = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
switch((char)*optarg) {
|
||||
case 'A':
|
||||
channel_model=SCM_A;
|
||||
case 'a':
|
||||
printf("Running AWGN simulation\n");
|
||||
awgn_flag = 1;
|
||||
/* ntrials not used later, no need to set */
|
||||
//ntrials=1;
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
channel_model=SCM_B;
|
||||
case 'd':
|
||||
delay = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
channel_model=SCM_C;
|
||||
break;
|
||||
case 'g':
|
||||
switch((char)*optarg) {
|
||||
case 'A':
|
||||
channel_model=SCM_A;
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
channel_model=SCM_B;
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
channel_model=SCM_C;
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
channel_model=SCM_D;
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
channel_model=EPA;
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
channel_model=EVA;
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
channel_model=ETU;
|
||||
break;
|
||||
|
||||
case 'H':
|
||||
channel_model=Rayleigh8;
|
||||
break;
|
||||
|
||||
case 'I':
|
||||
channel_model=Rayleigh1;
|
||||
break;
|
||||
|
||||
case 'J':
|
||||
channel_model=Rayleigh1_corr;
|
||||
break;
|
||||
|
||||
case 'K':
|
||||
channel_model=Rayleigh1_anticorr;
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
channel_model=Rice8;
|
||||
break;
|
||||
|
||||
case 'M':
|
||||
channel_model=Rice1;
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
channel_model=Rayleigh1_800;
|
||||
break;
|
||||
|
||||
default:
|
||||
msg("Unsupported channel model!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
case 'D':
|
||||
channel_model=SCM_D;
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
channel_model=EPA;
|
||||
threequarter_fs=1;
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
channel_model=EVA;
|
||||
case 'n':
|
||||
n_frames = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
channel_model=ETU;
|
||||
case 's':
|
||||
snr0 = atof(optarg);
|
||||
msg("Setting SNR0 to %f\n",snr0);
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
snr1 = atof(optarg);
|
||||
snr1set=1;
|
||||
msg("Setting SNR1 to %f\n",snr1);
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
preamble_tx=atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
ue_speed0 = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
ue_speed1 = atoi(optarg);
|
||||
ue_speed1set = 1;
|
||||
break;
|
||||
|
||||
case 'Z':
|
||||
NCS_config = atoi(optarg);
|
||||
|
||||
if ((NCS_config > 15) || (NCS_config < 0))
|
||||
printf("Illegal NCS_config %d, (should be 0-15)\n",NCS_config);
|
||||
|
||||
break;
|
||||
|
||||
case 'H':
|
||||
channel_model=Rayleigh8;
|
||||
|
||||
case 'I':
|
||||
channel_model=Rayleigh1;
|
||||
|
||||
case 'J':
|
||||
channel_model=Rayleigh1_corr;
|
||||
|
||||
case 'K':
|
||||
channel_model=Rayleigh1_anticorr;
|
||||
printf("High-Speed Flag enabled\n");
|
||||
hs_flag = 1;
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
channel_model=Rice8;
|
||||
rootSequenceIndex = atoi(optarg);
|
||||
|
||||
case 'M':
|
||||
channel_model=Rice1;
|
||||
if ((rootSequenceIndex < 0) || (rootSequenceIndex > 837))
|
||||
printf("Illegal rootSequenceNumber %d, (should be 0-837)\n",rootSequenceIndex);
|
||||
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
transmission_mode=atoi(optarg);
|
||||
|
||||
if ((transmission_mode!=1) &&
|
||||
(transmission_mode!=2) &&
|
||||
(transmission_mode!=6)) {
|
||||
msg("Unsupported transmission mode %d\n",transmission_mode);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
n_tx=atoi(optarg);
|
||||
|
||||
if ((n_tx==0) || (n_tx>2)) {
|
||||
msg("Unsupported number of tx antennas %d\n",n_tx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
n_rx=atoi(optarg);
|
||||
|
||||
if ((n_rx==0) || (n_rx>2)) {
|
||||
msg("Unsupported number of rx antennas %d\n",n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
channel_model=Rayleigh1_800;
|
||||
Nid_cell = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
N_RB_DL = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'O':
|
||||
osf = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
break;
|
||||
|
||||
default:
|
||||
msg("Unsupported channel model!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
threequarter_fs=1;
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
n_frames = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
snr0 = atof(optarg);
|
||||
msg("Setting SNR0 to %f\n",snr0);
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
snr1 = atof(optarg);
|
||||
snr1set=1;
|
||||
msg("Setting SNR1 to %f\n",snr1);
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
preamble_tx=atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
ue_speed0 = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
ue_speed1 = atoi(optarg);
|
||||
ue_speed1set = 1;
|
||||
break;
|
||||
|
||||
case 'Z':
|
||||
NCS_config = atoi(optarg);
|
||||
|
||||
if ((NCS_config > 15) || (NCS_config < 0))
|
||||
printf("Illegal NCS_config %d, (should be 0-15)\n",NCS_config);
|
||||
|
||||
break;
|
||||
|
||||
case 'H':
|
||||
printf("High-Speed Flag enabled\n");
|
||||
hs_flag = 1;
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
rootSequenceIndex = atoi(optarg);
|
||||
|
||||
if ((rootSequenceIndex < 0) || (rootSequenceIndex > 837))
|
||||
printf("Illegal rootSequenceNumber %d, (should be 0-837)\n",rootSequenceIndex);
|
||||
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
transmission_mode=atoi(optarg);
|
||||
|
||||
if ((transmission_mode!=1) &&
|
||||
(transmission_mode!=2) &&
|
||||
(transmission_mode!=6)) {
|
||||
msg("Unsupported transmission mode %d\n",transmission_mode);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
n_tx=atoi(optarg);
|
||||
|
||||
if ((n_tx==0) || (n_tx>2)) {
|
||||
msg("Unsupported number of tx antennas %d\n",n_tx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
n_rx=atoi(optarg);
|
||||
|
||||
if ((n_rx==0) || (n_rx>2)) {
|
||||
msg("Unsupported number of rx antennas %d\n",n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
Nid_cell = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
N_RB_DL = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'O':
|
||||
osf = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
break;
|
||||
|
||||
default:
|
||||
case 'h':
|
||||
printf("%s -h(elp) -a(wgn on) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n",
|
||||
argv[0]);
|
||||
printf("-h This message\n");
|
||||
printf("-a Use AWGN channel and not multipath\n");
|
||||
printf("-n Number of frames to simulate\n");
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n");
|
||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||
printf("-g [A,B,C,D,E,F,G,I,N] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) or Rayleigh1 (I) or Rayleigh1_800 (N) models (ignores delay spread and Ricean factor)\n");
|
||||
printf("-z Number of RX antennas used in eNB\n");
|
||||
printf("-N Nid_cell\n");
|
||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
// printf("-f PRACH format (0=1,1=2,2=3,3=4)\n");
|
||||
printf("-d Channel delay \n");
|
||||
printf("-v Starting UE velocity in km/h, runs from 'v' to 'v+50km/h'. If n_frames is 1 just 'v' is simulated \n");
|
||||
printf("-V Ending UE velocity in km/h, runs from 'v' to 'V'");
|
||||
printf("-L rootSequenceIndex (0-837)\n");
|
||||
printf("-Z NCS_config (ZeroCorrelationZone) (0-15)\n");
|
||||
printf("-H Run with High-Speed Flag enabled \n");
|
||||
printf("-R Number of PRB (6,15,25,50,75,100)\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
exit (-1);
|
||||
break;
|
||||
case 'h':
|
||||
printf("%s -h(elp) -a(wgn on) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n",
|
||||
argv[0]);
|
||||
printf("-h This message\n");
|
||||
printf("-a Use AWGN channel and not multipath\n");
|
||||
printf("-n Number of frames to simulate\n");
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n");
|
||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||
printf("-g [A,B,C,D,E,F,G,I,N] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) or Rayleigh1 (I) or Rayleigh1_800 (N) models (ignores delay spread and Ricean factor)\n");
|
||||
printf("-z Number of RX antennas used in eNB\n");
|
||||
printf("-N Nid_cell\n");
|
||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
// printf("-f PRACH format (0=1,1=2,2=3,3=4)\n");
|
||||
printf("-d Channel delay \n");
|
||||
printf("-v Starting UE velocity in km/h, runs from 'v' to 'v+50km/h'. If n_frames is 1 just 'v' is simulated \n");
|
||||
printf("-V Ending UE velocity in km/h, runs from 'v' to 'V'");
|
||||
printf("-L rootSequenceIndex (0-837)\n");
|
||||
printf("-Z NCS_config (ZeroCorrelationZone) (0-15)\n");
|
||||
printf("-H Run with High-Speed Flag enabled \n");
|
||||
printf("-R Number of PRB (6,15,25,50,75,100)\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
exit (-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,17 +299,16 @@ int main(int argc, char **argv)
|
||||
|
||||
lte_param_init(n_tx,
|
||||
n_tx,
|
||||
n_rx,
|
||||
transmission_mode,
|
||||
extended_prefix_flag,
|
||||
FDD,
|
||||
Nid_cell,
|
||||
3,
|
||||
N_RB_DL,
|
||||
threequarter_fs,
|
||||
osf,
|
||||
0);
|
||||
|
||||
n_rx,
|
||||
transmission_mode,
|
||||
extended_prefix_flag,
|
||||
FDD,
|
||||
Nid_cell,
|
||||
3,
|
||||
N_RB_DL,
|
||||
threequarter_fs,
|
||||
osf,
|
||||
0);
|
||||
|
||||
if (snr1set==0) {
|
||||
if (n_frames==1)
|
||||
@@ -331,30 +325,22 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
printf("SNR0 %f, SNR1 %f\n",snr0,snr1);
|
||||
|
||||
frame_parms = &eNB->frame_parms;
|
||||
|
||||
|
||||
txdata = UE->common_vars.txdata;
|
||||
printf("txdata %p\n",&txdata[0][subframe*frame_parms->samples_per_tti]);
|
||||
|
||||
s_re = malloc(2*sizeof(double*));
|
||||
s_im = malloc(2*sizeof(double*));
|
||||
r_re = malloc(2*sizeof(double*));
|
||||
r_im = malloc(2*sizeof(double*));
|
||||
s_re = malloc(2*sizeof(double *));
|
||||
s_im = malloc(2*sizeof(double *));
|
||||
r_re = malloc(2*sizeof(double *));
|
||||
r_im = malloc(2*sizeof(double *));
|
||||
nsymb = (frame_parms->Ncp == 0) ? 14 : 12;
|
||||
|
||||
printf("FFT Size %d, Extended Prefix %d, Samples per subframe %d, Symbols per subframe %d\n",NUMBER_OF_OFDM_CARRIERS,
|
||||
frame_parms->Ncp,frame_parms->samples_per_tti,nsymb);
|
||||
|
||||
|
||||
|
||||
msg("[SIM] Using SCM/101\n");
|
||||
UE2eNB = new_channel_desc_scm(UE->frame_parms.nb_antennas_tx,
|
||||
eNB->frame_parms.nb_antennas_rx,
|
||||
channel_model,
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_UL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_UL),
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_UL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_UL),
|
||||
0.0,
|
||||
delay,
|
||||
0);
|
||||
@@ -365,12 +351,10 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
for (i=0; i<2; i++) {
|
||||
|
||||
s_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
bzero(s_re[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
s_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
bzero(s_im[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
|
||||
r_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
bzero(r_re[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
r_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
@@ -382,30 +366,22 @@ int main(int argc, char **argv)
|
||||
UE->frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig=NCS_config;
|
||||
UE->frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag=hs_flag;
|
||||
UE->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset=0;
|
||||
|
||||
|
||||
eNB->frame_parms.prach_config_common.rootSequenceIndex=rootSequenceIndex;
|
||||
eNB->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex=0;
|
||||
eNB->frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig=NCS_config;
|
||||
eNB->frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag=hs_flag;
|
||||
eNB->frame_parms.prach_config_common.prach_ConfigInfo.prach_FreqOffset=0;
|
||||
|
||||
eNB->node_function = eNodeB_3GPP;
|
||||
eNB->proc.subframe_rx = subframe;
|
||||
eNB->proc.subframe_prach = subframe;
|
||||
|
||||
/* N_ZC not used later, so prach_fmt is also useless, don't set */
|
||||
//prach_fmt = get_prach_fmt(eNB->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
|
||||
// eNB->frame_parms.frame_type);
|
||||
/* N_ZC not used later, no need to set */
|
||||
//N_ZC = (prach_fmt <4)?839:139;
|
||||
|
||||
compute_prach_seq(&eNB->frame_parms.prach_config_common,eNB->frame_parms.frame_type,eNB->X_u);
|
||||
|
||||
compute_prach_seq(&UE->frame_parms.prach_config_common,UE->frame_parms.frame_type,UE->X_u);
|
||||
|
||||
UE->prach_vars[0]->amp = AMP;
|
||||
|
||||
UE->prach_resources[0] = &prach_resources;
|
||||
|
||||
if (preamble_tx == 99)
|
||||
@@ -416,18 +392,14 @@ int main(int argc, char **argv)
|
||||
|
||||
UE->prach_resources[0]->ra_PreambleIndex = preamble_tx;
|
||||
UE->prach_resources[0]->ra_TDD_map_index = 0;
|
||||
|
||||
tx_lev = generate_prach(UE,
|
||||
0, //eNB_id,
|
||||
subframe,
|
||||
0); //Nf
|
||||
|
||||
/* tx_lev_dB not used later, no need to set */
|
||||
//tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
|
||||
|
||||
LOG_M("txsig0_new.m","txs0", &txdata[0][subframe*frame_parms->samples_per_tti],frame_parms->samples_per_tti,1,1);
|
||||
//LOG_M("txsig1.m","txs1", txdata[1],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
|
||||
|
||||
// multipath channel
|
||||
dump_prach_config(&eNB->frame_parms,subframe);
|
||||
|
||||
@@ -450,8 +422,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (SNR=snr0; SNR<snr1; SNR+=.2) {
|
||||
for (ue_speed=ue_speed0; ue_speed<ue_speed1; ue_speed+=10) {
|
||||
delay_avg = 0.0;
|
||||
@@ -461,7 +431,6 @@ int main(int argc, char **argv)
|
||||
prach_errors=0;
|
||||
|
||||
for (trial=0; trial<n_frames; trial++) {
|
||||
|
||||
sigma2_dB = 10*log10((double)tx_lev) - SNR;
|
||||
|
||||
if (n_frames==1)
|
||||
@@ -471,7 +440,6 @@ int main(int argc, char **argv)
|
||||
sigma2 = pow(10,sigma2_dB/10);
|
||||
// printf("Sigma2 %f (sigma2_dB %f)\n",sigma2,sigma2_dB);
|
||||
|
||||
|
||||
if (awgn_flag == 0) {
|
||||
multipath_tv_channel(UE2eNB,s_re,s_im,r_re,r_im,
|
||||
2*frame_parms->samples_per_tti,0);
|
||||
@@ -485,9 +453,8 @@ int main(int argc, char **argv)
|
||||
|
||||
for (i=0; i<frame_parms->samples_per_tti; i++) {
|
||||
for (aa=0; aa<eNB->frame_parms.nb_antennas_rx; aa++) {
|
||||
|
||||
((short*) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i] = (short) (.167*(r_re[aa][i] +sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short*) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i+1] = (short) (.167*(r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short *) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i] = (short) (.167*(r_re[aa][i] +sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short *) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i+1] = (short) (.167*(r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -496,7 +463,6 @@ int main(int argc, char **argv)
|
||||
preamble_delay_list,
|
||||
0, //Nf
|
||||
0); //tdd_mapindex
|
||||
|
||||
preamble_energy_max = preamble_energy_list[0];
|
||||
preamble_max = 0;
|
||||
|
||||
@@ -524,8 +490,8 @@ int main(int argc, char **argv)
|
||||
LOG_M("prach0.m","prach0", &txdata[0][subframe*frame_parms->samples_per_tti],frame_parms->samples_per_tti,1,1);
|
||||
LOG_M("prachF0.m","prachF0", &eNB->prach_vars.prachF[0],24576,1,1);
|
||||
LOG_M("rxsig0.m","rxs0",
|
||||
&eNB->common_vars.rxdata[0][0][subframe*frame_parms->samples_per_tti],
|
||||
frame_parms->samples_per_tti,1,1);
|
||||
&eNB->common_vars.rxdata[0][0][subframe*frame_parms->samples_per_tti],
|
||||
frame_parms->samples_per_tti,1,1);
|
||||
LOG_M("rxsigF0.m","rxsF0", eNB->prach_vars.rxsigF[0],6144,1,1);
|
||||
LOG_M("prach_preamble.m","prachp",&eNB->X_u[0],839,1,1);
|
||||
}
|
||||
@@ -539,7 +505,6 @@ int main(int argc, char **argv)
|
||||
// printf("(%f,%f)\n",SNR,(double)prach_errors/(double)n_frames);
|
||||
} //SNR loop
|
||||
|
||||
|
||||
for (i=0; i<2; i++) {
|
||||
free(s_re[i]);
|
||||
free(s_im[i]);
|
||||
@@ -551,11 +516,8 @@ int main(int argc, char **argv)
|
||||
free(s_im);
|
||||
free(r_re);
|
||||
free(r_im);
|
||||
|
||||
lte_sync_time_free();
|
||||
|
||||
return(0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -45,37 +45,29 @@ PHY_VARS_UE *UE;
|
||||
|
||||
double cpuf;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
char c;
|
||||
|
||||
int i,l,aa;
|
||||
double sigma2, sigma2_dB=0,SNR,snr0=-2.0,snr1=0.0;
|
||||
uint8_t snr1set=0;
|
||||
//mod_sym_t **txdataF;
|
||||
int **txdata;
|
||||
double s_re0[30720],s_re1[30720],s_im0[30720],s_im1[30720],r_re0[30720],r_im0[30720],r_re1[30720],r_im1[30720];
|
||||
double *s_re[2]={s_re0,s_re1};
|
||||
double *s_im[2]={s_im0,s_im1};
|
||||
double *r_re[2]={r_re0,r_re1};
|
||||
double *r_im[2]={r_im0,r_im1};
|
||||
double *s_re[2]= {s_re0,s_re1};
|
||||
double *s_im[2]= {s_im0,s_im1};
|
||||
double *r_re[2]= {r_re0,r_re1};
|
||||
double *r_im[2]= {r_im0,r_im1};
|
||||
double ricean_factor=0.0000005,iqim=0.0;
|
||||
|
||||
int trial, n_trials, ntrials=1, n_errors;
|
||||
uint8_t transmission_mode = 1,n_tx=1,n_rx=1;
|
||||
unsigned char eNB_id = 0;
|
||||
uint16_t Nid_cell=0;
|
||||
|
||||
int n_frames=1;
|
||||
channel_desc_t *UE2eNB;
|
||||
uint32_t nsymb,tx_lev;
|
||||
uint8_t extended_prefix_flag=0;
|
||||
|
||||
LTE_DL_FRAME_PARMS *frame_parms;
|
||||
|
||||
SCM_t channel_model=Rayleigh1_corr;
|
||||
|
||||
// double pucch_sinr;
|
||||
uint8_t osf=1,N_RB_DL=25;
|
||||
uint32_t pucch_tx=0,pucch1_missed=0,pucch1_false=0,pucch3_false=0,sig;
|
||||
@@ -90,202 +82,203 @@ int main(int argc, char **argv)
|
||||
double stat_no_sig,stat_sig;
|
||||
uint8_t N0=40;
|
||||
uint8_t pucch1_thres=10;
|
||||
|
||||
uint16_t n1_pucch = 0;
|
||||
uint16_t n2_pucch = 0;
|
||||
uint16_t n3_pucch = 20;
|
||||
|
||||
uint16_t n_rnti=0x1234;
|
||||
|
||||
number_of_cards = 1;
|
||||
|
||||
cpuf = get_cpu_freq_GHz();
|
||||
|
||||
while ((c = getopt (argc, argv, "har:pf:g:n:s:S:x:y:z:N:F:T:R:")) != -1) {
|
||||
switch (c) {
|
||||
case 'a':
|
||||
printf("Running AWGN simulation\n");
|
||||
channel_model = AWGN;
|
||||
ntrials=1;
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
if (atoi(optarg)==0)
|
||||
pucch_format = pucch_format1;
|
||||
else if (atoi(optarg)==1)
|
||||
pucch_format = pucch_format1a;
|
||||
else if (atoi(optarg)==2)
|
||||
pucch_format = pucch_format1b;
|
||||
else if (atoi(optarg)==6) // 3,4,5 is reserved for format2,2a,2b
|
||||
pucch_format = pucch_format3;
|
||||
else {
|
||||
printf("Unsupported pucch_format %d\n",atoi(optarg));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
switch((char)*optarg) {
|
||||
case 'A':
|
||||
channel_model=SCM_A;
|
||||
case 'a':
|
||||
printf("Running AWGN simulation\n");
|
||||
channel_model = AWGN;
|
||||
ntrials=1;
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
channel_model=SCM_B;
|
||||
case 'f':
|
||||
if (atoi(optarg)==0)
|
||||
pucch_format = pucch_format1;
|
||||
else if (atoi(optarg)==1)
|
||||
pucch_format = pucch_format1a;
|
||||
else if (atoi(optarg)==2)
|
||||
pucch_format = pucch_format1b;
|
||||
else if (atoi(optarg)==6) // 3,4,5 is reserved for format2,2a,2b
|
||||
pucch_format = pucch_format3;
|
||||
else {
|
||||
printf("Unsupported pucch_format %d\n",atoi(optarg));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
channel_model=SCM_C;
|
||||
case 'g':
|
||||
switch((char)*optarg) {
|
||||
case 'A':
|
||||
channel_model=SCM_A;
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
channel_model=SCM_B;
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
channel_model=SCM_C;
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
channel_model=SCM_D;
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
channel_model=EPA;
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
channel_model=EVA;
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
channel_model=ETU;
|
||||
break;
|
||||
|
||||
case 'H':
|
||||
channel_model=Rayleigh8;
|
||||
break;
|
||||
|
||||
case 'I':
|
||||
channel_model=Rayleigh1;
|
||||
break;
|
||||
|
||||
case 'J':
|
||||
channel_model=Rayleigh1_corr;
|
||||
break;
|
||||
|
||||
case 'K':
|
||||
channel_model=Rayleigh1_anticorr;
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
channel_model=Rice8;
|
||||
break;
|
||||
|
||||
case 'M':
|
||||
channel_model=Rice1;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Unsupported channel model!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
channel_model=SCM_D;
|
||||
case 'n':
|
||||
n_frames = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
channel_model=EPA;
|
||||
case 's':
|
||||
snr0 = atof(optarg);
|
||||
printf("Setting SNR0 to %f\n",snr0);
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
snr1 = atof(optarg);
|
||||
snr1set=1;
|
||||
printf("Setting SNR1 to %f\n",snr1);
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
extended_prefix_flag=1;
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
ricean_factor = pow(10,-.1*atof(optarg));
|
||||
|
||||
if (ricean_factor>1) {
|
||||
printf("Ricean factor must be between 0 and 1\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
transmission_mode=atoi(optarg);
|
||||
|
||||
if ((transmission_mode!=1) &&
|
||||
(transmission_mode!=2) &&
|
||||
(transmission_mode!=6)) {
|
||||
printf("Unsupported transmission mode %d\n",transmission_mode);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
n_tx=atoi(optarg);
|
||||
|
||||
if ((n_tx==0) || (n_tx>2)) {
|
||||
printf("Unsupported number of tx antennas %d\n",n_tx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
n_rx=atoi(optarg);
|
||||
|
||||
if ((n_rx==0) || (n_rx>2)) {
|
||||
printf("Unsupported number of rx antennas %d\n",n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
N0 = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'T':
|
||||
pucch1_thres = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
N_RB_DL = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'O':
|
||||
osf = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
channel_model=EVA;
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
channel_model=ETU;
|
||||
break;
|
||||
|
||||
case 'H':
|
||||
channel_model=Rayleigh8;
|
||||
|
||||
case 'I':
|
||||
channel_model=Rayleigh1;
|
||||
|
||||
case 'J':
|
||||
channel_model=Rayleigh1_corr;
|
||||
|
||||
case 'K':
|
||||
channel_model=Rayleigh1_anticorr;
|
||||
|
||||
case 'L':
|
||||
channel_model=Rice8;
|
||||
|
||||
case 'M':
|
||||
channel_model=Rice1;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Unsupported channel model!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
n_frames = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
snr0 = atof(optarg);
|
||||
printf("Setting SNR0 to %f\n",snr0);
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
snr1 = atof(optarg);
|
||||
snr1set=1;
|
||||
printf("Setting SNR1 to %f\n",snr1);
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
extended_prefix_flag=1;
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
ricean_factor = pow(10,-.1*atof(optarg));
|
||||
|
||||
if (ricean_factor>1) {
|
||||
printf("Ricean factor must be between 0 and 1\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
transmission_mode=atoi(optarg);
|
||||
|
||||
if ((transmission_mode!=1) &&
|
||||
(transmission_mode!=2) &&
|
||||
(transmission_mode!=6)) {
|
||||
printf("Unsupported transmission mode %d\n",transmission_mode);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
n_tx=atoi(optarg);
|
||||
|
||||
if ((n_tx==0) || (n_tx>2)) {
|
||||
printf("Unsupported number of tx antennas %d\n",n_tx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
n_rx=atoi(optarg);
|
||||
|
||||
if ((n_rx==0) || (n_rx>2)) {
|
||||
printf("Unsupported number of rx antennas %d\n",n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'N':
|
||||
N0 = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'T':
|
||||
pucch1_thres = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
N_RB_DL = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'O':
|
||||
osf = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
break;
|
||||
|
||||
default:
|
||||
case 'h':
|
||||
printf("%s -h(elp) -a(wgn on) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -r Ricean_FactordB -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -N CellId\n",
|
||||
argv[0]);
|
||||
printf("-h This message\n");
|
||||
printf("-a Use AWGN channel and not multipath\n");
|
||||
printf("-p Use extended prefix mode\n");
|
||||
printf("-n Number of frames to simulate\n");
|
||||
printf("-r Ricean factor (dB, 0 means Rayleigh, 100 is almost AWGN\n");
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n");
|
||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||
printf("-t Delay spread for multipath channel\n");
|
||||
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
|
||||
printf("-x Transmission mode (1,2,6 for the moment)\n");
|
||||
printf("-y Number of TX antennas used in eNB\n");
|
||||
printf("-z Number of RX antennas used in UE\n");
|
||||
printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
|
||||
printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
|
||||
printf("-N Noise variance in dB\n");
|
||||
printf("-R N_RB_DL\n");
|
||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
printf("-f PUCCH format (0=1,1=1a,2=1b,6=3), formats 2/2a/2b not supported\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
exit (-1);
|
||||
break;
|
||||
case 'h':
|
||||
printf("%s -h(elp) -a(wgn on) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -r Ricean_FactordB -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -N CellId\n",
|
||||
argv[0]);
|
||||
printf("-h This message\n");
|
||||
printf("-a Use AWGN channel and not multipath\n");
|
||||
printf("-p Use extended prefix mode\n");
|
||||
printf("-n Number of frames to simulate\n");
|
||||
printf("-r Ricean factor (dB, 0 means Rayleigh, 100 is almost AWGN\n");
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n");
|
||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||
printf("-t Delay spread for multipath channel\n");
|
||||
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
|
||||
printf("-x Transmission mode (1,2,6 for the moment)\n");
|
||||
printf("-y Number of TX antennas used in eNB\n");
|
||||
printf("-z Number of RX antennas used in UE\n");
|
||||
printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
|
||||
printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
|
||||
printf("-N Noise variance in dB\n");
|
||||
printf("-R N_RB_DL\n");
|
||||
printf("-O oversampling factor (1,2,4,8,16)\n");
|
||||
printf("-f PUCCH format (0=1,1=1a,2=1b,6=3), formats 2/2a/2b not supported\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
exit (-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,17 +292,16 @@ int main(int argc, char **argv)
|
||||
|
||||
lte_param_init(n_tx,
|
||||
n_tx,
|
||||
n_rx,
|
||||
transmission_mode,
|
||||
extended_prefix_flag,
|
||||
FDD,
|
||||
Nid_cell,
|
||||
3,
|
||||
N_RB_DL,
|
||||
0,
|
||||
osf,
|
||||
0);
|
||||
|
||||
n_rx,
|
||||
transmission_mode,
|
||||
extended_prefix_flag,
|
||||
FDD,
|
||||
Nid_cell,
|
||||
3,
|
||||
N_RB_DL,
|
||||
0,
|
||||
osf,
|
||||
0);
|
||||
|
||||
if (snr1set==0) {
|
||||
if (n_frames==1)
|
||||
@@ -319,42 +311,30 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
printf("SNR0 %f, SNR1 %f\n",snr0,snr1);
|
||||
|
||||
frame_parms = &eNB->frame_parms;
|
||||
|
||||
|
||||
txdata = eNB->common_vars.txdata[eNB_id];
|
||||
|
||||
nsymb = (frame_parms->Ncp == 0) ? 14 : 12;
|
||||
|
||||
printf("FFT Size %d, Extended Prefix %d, Samples per subframe %d, Symbols per subframe %d\n",NUMBER_OF_OFDM_CARRIERS,
|
||||
frame_parms->Ncp,frame_parms->samples_per_tti,nsymb);
|
||||
|
||||
|
||||
|
||||
printf("[SIM] Using SCM/101\n");
|
||||
UE2eNB = new_channel_desc_scm(eNB->frame_parms.nb_antennas_tx,
|
||||
UE->frame_parms.nb_antennas_rx,
|
||||
channel_model,
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_UL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_UL),
|
||||
N_RB2sampling_rate(eNB->frame_parms.N_RB_UL),
|
||||
N_RB2channel_bandwidth(eNB->frame_parms.N_RB_UL),
|
||||
0.0,
|
||||
0,
|
||||
0);
|
||||
|
||||
|
||||
if (UE2eNB==NULL) {
|
||||
printf("Problem generating channel model. Exiting.\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
init_ncs_cell(&eNB->frame_parms,eNB->ncs_cell);
|
||||
|
||||
init_ncs_cell(&UE->frame_parms,UE->ncs_cell);
|
||||
|
||||
init_ul_hopping(&eNB->frame_parms);
|
||||
init_ul_hopping(&UE->frame_parms);
|
||||
|
||||
eNB->frame_parms.pucch_config_common.deltaPUCCH_Shift = 2;
|
||||
eNB->frame_parms.pucch_config_common.nRB_CQI = 4;
|
||||
eNB->frame_parms.pucch_config_common.nCS_AN = 6;
|
||||
@@ -362,40 +342,38 @@ int main(int argc, char **argv)
|
||||
UE->frame_parms.pucch_config_common.nRB_CQI = 4;
|
||||
UE->frame_parms.pucch_config_common.nCS_AN = 6;
|
||||
|
||||
|
||||
if( (pucch_format == pucch_format1) || (pucch_format == pucch_format1a) || (pucch_format == pucch_format1b) ){
|
||||
if( (pucch_format == pucch_format1) || (pucch_format == pucch_format1a) || (pucch_format == pucch_format1b) ) {
|
||||
pucch_payload = 0;
|
||||
generate_pucch1x(UE->common_vars.txdataF,
|
||||
frame_parms,
|
||||
UE->ncs_cell,
|
||||
pucch_format,
|
||||
&pucch_config_dedicated,
|
||||
n1_pucch,
|
||||
0, //shortened_format,
|
||||
&pucch_payload,
|
||||
AMP, //amp,
|
||||
subframe); //subframe
|
||||
}else if( pucch_format == pucch_format3){
|
||||
for(i=0;i<pucch3_payload_size;i++)
|
||||
frame_parms,
|
||||
UE->ncs_cell,
|
||||
pucch_format,
|
||||
&pucch_config_dedicated,
|
||||
n1_pucch,
|
||||
0, //shortened_format,
|
||||
&pucch_payload,
|
||||
AMP, //amp,
|
||||
subframe); //subframe
|
||||
} else if( pucch_format == pucch_format3) {
|
||||
for(i=0; i<pucch3_payload_size; i++)
|
||||
pucch3_payload[i]=(uint8_t)(taus()&0x1);
|
||||
|
||||
generate_pucch3x(UE->common_vars.txdataF,
|
||||
frame_parms,
|
||||
UE->ncs_cell,
|
||||
pucch_format,
|
||||
&pucch_config_dedicated,
|
||||
n3_pucch,
|
||||
0, //shortened_format,
|
||||
pucch3_payload,
|
||||
AMP, //amp,
|
||||
subframe, //subframe
|
||||
n_rnti); //rnti
|
||||
frame_parms,
|
||||
UE->ncs_cell,
|
||||
pucch_format,
|
||||
&pucch_config_dedicated,
|
||||
n3_pucch,
|
||||
0, //shortened_format,
|
||||
pucch3_payload,
|
||||
AMP, //amp,
|
||||
subframe, //subframe
|
||||
n_rnti); //rnti
|
||||
}
|
||||
|
||||
LOG_M("txsigF0.m","txsF0", &UE->common_vars.txdataF[0][2*subframe*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES_NO_PREFIX],OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES_NO_PREFIX*nsymb,1,1);
|
||||
|
||||
tx_lev = 0;
|
||||
|
||||
|
||||
|
||||
for (aa=0; aa<eNB->frame_parms.nb_antennas_tx; aa++) {
|
||||
if (frame_parms->Ncp == 1)
|
||||
PHY_ofdm_mod(&UE->common_vars.txdataF[aa][2*subframe*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES_NO_PREFIX], // input,
|
||||
@@ -413,16 +391,12 @@ int main(int argc, char **argv)
|
||||
//apply_7_5_kHz(UE,UE->common_vars.txdata[aa],1+(subframe<<1));
|
||||
apply_7_5_kHz(UE,&txdata[aa][eNB->frame_parms.samples_per_tti*subframe],0);
|
||||
apply_7_5_kHz(UE,&txdata[aa][eNB->frame_parms.samples_per_tti*subframe],1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
tx_lev += signal_energy(&txdata[aa][subframe*eNB->frame_parms.samples_per_tti],
|
||||
OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES);
|
||||
}
|
||||
|
||||
|
||||
|
||||
LOG_M("txsig0.m","txs0", txdata[0], FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
|
||||
//LOG_M("txsig1.m","txs1", txdata[1],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
|
||||
|
||||
@@ -435,28 +409,19 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (SNR=snr0; SNR<snr1; SNR+=.2) {
|
||||
|
||||
printf("n_frames %d SNR %f\n",n_frames,SNR);
|
||||
|
||||
n_errors = 0;
|
||||
pucch_tx = 0;
|
||||
pucch1_missed=0;
|
||||
pucch1_false=0;
|
||||
pucch3_false=0;
|
||||
|
||||
stat_no_sig = 0;
|
||||
stat_sig = 0;
|
||||
|
||||
for (trial=0; trial<n_frames; trial++) {
|
||||
|
||||
|
||||
|
||||
multipath_channel(UE2eNB,s_re,s_im,r_re,r_im,
|
||||
eNB->frame_parms.samples_per_tti,0);
|
||||
|
||||
sigma2_dB = N0;//10*log10((double)tx_lev) - SNR;
|
||||
tx_gain = sqrt(pow(10.0,.1*(N0+SNR))/(double)tx_lev);
|
||||
|
||||
@@ -478,11 +443,11 @@ int main(int argc, char **argv)
|
||||
sig=1;
|
||||
} else {
|
||||
if (trial<(n_frames>>1)) {
|
||||
//printf("no sig =>");
|
||||
//printf("no sig =>");
|
||||
sig= 0;
|
||||
} else {
|
||||
sig=1;
|
||||
//printf("sig =>");
|
||||
//printf("sig =>");
|
||||
pucch_tx++;
|
||||
}
|
||||
}
|
||||
@@ -493,14 +458,11 @@ int main(int argc, char **argv)
|
||||
// fill measurement symbol (19) with noise
|
||||
for (i=0; i<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; i++) {
|
||||
for (aa=0; aa<eNB->frame_parms.nb_antennas_rx; aa++) {
|
||||
|
||||
((short*) &eNB->common_vars.rxdata[0][aa][(frame_parms->samples_per_tti<<1) -frame_parms->ofdm_symbol_size])[2*i] = (short) ((sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short*) &eNB->common_vars.rxdata[0][aa][(frame_parms->samples_per_tti<<1) -frame_parms->ofdm_symbol_size])[2*i+1] = (short) ((sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short *) &eNB->common_vars.rxdata[0][aa][(frame_parms->samples_per_tti<<1) -frame_parms->ofdm_symbol_size])[2*i] = (short) ((sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short *) &eNB->common_vars.rxdata[0][aa][(frame_parms->samples_per_tti<<1) -frame_parms->ofdm_symbol_size])[2*i+1] = (short) ((sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (i=0; i<2*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; i++) {
|
||||
for (aa=0; aa<eNB->frame_parms.nb_antennas_rx; aa++) {
|
||||
if (n_trials==0) {
|
||||
@@ -508,14 +470,12 @@ int main(int argc, char **argv)
|
||||
// r_im[aa][i] += (pow(10.0,.05*interf1)*r_im1[aa][i] + pow(10.0,.05*interf2)*r_im2[aa][i]);
|
||||
}
|
||||
|
||||
|
||||
if (sig==1) {
|
||||
((short*) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i] = (short) (((tx_gain*r_re[aa][i]) +sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short*) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i+1] = (short) (((tx_gain*r_im[aa][i]) + (iqim*r_re[aa][i]*tx_gain) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short *) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i] = (short) (((tx_gain*r_re[aa][i]) +sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short *) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i+1] = (short) (((tx_gain*r_im[aa][i]) + (iqim*r_re[aa][i]*tx_gain) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
} else {
|
||||
((short*) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i] = (short) ((sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short*) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i+1] = (short) ((sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
|
||||
((short *) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i] = (short) ((sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short *) &eNB->common_vars.rxdata[0][aa][subframe*frame_parms->samples_per_tti])[2*i+1] = (short) ((sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -524,7 +484,6 @@ int main(int argc, char **argv)
|
||||
remove_7_5_kHz(eNB,1+(subframe<<1));
|
||||
|
||||
for (l=0; l<eNB->frame_parms.symbols_per_tti/2; l++) {
|
||||
|
||||
slot_fep_ul(&eNB->frame_parms,
|
||||
&eNB->common_vars,
|
||||
l,
|
||||
@@ -539,16 +498,13 @@ int main(int argc, char **argv)
|
||||
0,
|
||||
0
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// if (sig == 1)
|
||||
// printf("*");
|
||||
lte_eNB_I0_measurements(eNB,
|
||||
subframe,
|
||||
0,
|
||||
0,
|
||||
1);
|
||||
eNB->measurements[0].n0_power_tot_dB = N0;//(int8_t)(sigma2_dB-10*log10(eNB->frame_parms.ofdm_symbol_size/(12*NB_RB)));
|
||||
stat = rx_pucch(eNB,
|
||||
@@ -580,9 +536,9 @@ int main(int argc, char **argv)
|
||||
}*/
|
||||
} else if( (pucch_format==pucch_format1a) || (pucch_format==pucch_format1b) ) {
|
||||
pucch1_false = (pucch_payload_rx != pucch_payload) ? (pucch1_false+1) : pucch1_false;
|
||||
} else if (pucch_format==pucch_format3){
|
||||
for(i=0;i<pucch3_payload_size;i++){
|
||||
if(pucch3_payload[i]!=pucch3_payload_rx[i]){
|
||||
} else if (pucch_format==pucch_format3) {
|
||||
for(i=0; i<pucch3_payload_size; i++) {
|
||||
if(pucch3_payload[i]!=pucch3_payload_rx[i]) {
|
||||
pucch3_false = (pucch3_false+1);
|
||||
break;
|
||||
}
|
||||
@@ -611,11 +567,8 @@ int main(int argc, char **argv)
|
||||
LOG_M("rxsigF0.m","rxsF0", &eNB->common_vars.rxdataF[0][0][0],512*nsymb*2,2,1);
|
||||
}
|
||||
|
||||
|
||||
lte_sync_time_free();
|
||||
|
||||
return(n_errors);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "LAYER2/MAC/vars.h"
|
||||
|
||||
#ifdef XFORMS
|
||||
#include "PHY/TOOLS/lte_phy_scope.h"
|
||||
#include "PHY/TOOLS/lte_phy_scope.h"
|
||||
#endif
|
||||
|
||||
#include "OCG_vars.h"
|
||||
@@ -58,11 +58,8 @@ mod_sym_t dummy2[2048*14];
|
||||
mod_sym_t dummy3[2048*14];
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
char c;
|
||||
|
||||
int i,l,aa;
|
||||
double sigma2, sigma2_dB=0,SNR,snr0=-2.0,snr1;
|
||||
uint8_t snr1set=0;
|
||||
@@ -82,226 +79,192 @@ int main(int argc, char **argv)
|
||||
int trial, n_trials, ntrials=1, n_errors,n_errors2,n_alamouti;
|
||||
uint8_t transmission_mode = 1,n_tx=1,n_rx=1;
|
||||
uint16_t Nid_cell=0;
|
||||
|
||||
int n_frames=1;
|
||||
channel_desc_t *eNB2UE,*eNB2UE1,*eNB2UE2;
|
||||
uint32_t nsymb,tx_lev,tx_lev1,tx_lev2;
|
||||
uint8_t extended_prefix_flag=0;
|
||||
LTE_DL_FRAME_PARMS *frame_parms;
|
||||
|
||||
FILE *input_fd=NULL,*pbch_file_fd=NULL;
|
||||
char input_val_str[50],input_val_str2[50];
|
||||
// double input_val1,input_val2;
|
||||
// uint16_t amask=0;
|
||||
uint8_t frame_mod4,num_pdcch_symbols;
|
||||
uint16_t NB_RB=25;
|
||||
|
||||
SCM_t channel_model=AWGN;//Rayleigh1_anticorr;
|
||||
|
||||
DCI_ALLOC_t dci_alloc[8];
|
||||
uint8_t abstraction_flag=0;//,calibration_flag=0;
|
||||
int pbch_tx_ant;
|
||||
uint8_t N_RB_DL=100,osf=1;
|
||||
|
||||
unsigned char frame_type = FDD;
|
||||
unsigned char pbch_phase = 0;
|
||||
|
||||
#ifdef XFORMS
|
||||
FD_lte_phy_scope_ue *form_ue;
|
||||
char title[255];
|
||||
#endif
|
||||
|
||||
logInit();
|
||||
number_of_cards = 1;
|
||||
openair_daq_vars.rx_rf_mode = 1;
|
||||
|
||||
/*
|
||||
rxdataF = (int **)malloc16(2*sizeof(int*));
|
||||
rxdataF[0] = (int *)malloc16(FRAME_LENGTH_BYTES);
|
||||
rxdataF[1] = (int *)malloc16(FRAME_LENGTH_BYTES);
|
||||
|
||||
rxdata = (int **)malloc16(2*sizeof(int*));
|
||||
rxdata[0] = (int *)malloc16(FRAME_LENGTH_BYTES);
|
||||
rxdata[1] = (int *)malloc16(FRAME_LENGTH_BYTES);
|
||||
*/
|
||||
while ((c = getopt (argc, argv, "f:hpf:g:n:s:S:t:x:y:z:N:F:GdP:")) != -1) {
|
||||
switch (c) {
|
||||
case 'f':
|
||||
write_output_file=1;
|
||||
output_fd = fopen(optarg,"w");
|
||||
case 'f':
|
||||
write_output_file=1;
|
||||
output_fd = fopen(optarg,"w");
|
||||
|
||||
if (output_fd==NULL) {
|
||||
printf("Error opening %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
if (output_fd==NULL) {
|
||||
printf("Error opening %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
frame_type = TDD;
|
||||
break;
|
||||
case 'd':
|
||||
frame_type = TDD;
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
switch((char)*optarg) {
|
||||
case 'A':
|
||||
channel_model=SCM_A;
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
channel_model=SCM_B;
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
channel_model=SCM_C;
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
channel_model=SCM_D;
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
channel_model=EPA;
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
channel_model=EVA;
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
channel_model=ETU;
|
||||
break;
|
||||
|
||||
default:
|
||||
msg("Unsupported channel model!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
n_frames = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
snr0 = atof(optarg);
|
||||
msg("Setting SNR0 to %f\n",snr0);
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
snr1 = atof(optarg);
|
||||
snr1set=1;
|
||||
msg("Setting SNR1 to %f\n",snr1);
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
extended_prefix_flag=1;
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
transmission_mode=atoi(optarg);
|
||||
|
||||
if ((transmission_mode!=1) &&
|
||||
(transmission_mode!=2) &&
|
||||
(transmission_mode!=6)) {
|
||||
msg("Unsupported transmission mode %d\n",transmission_mode);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
n_tx=atoi(optarg);
|
||||
|
||||
if ((n_tx==0) || (n_tx>2)) {
|
||||
msg("Unsupported number of tx antennas %d\n",n_tx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
n_rx=atoi(optarg);
|
||||
|
||||
if ((n_rx==0) || (n_rx>2)) {
|
||||
msg("Unsupported number of rx antennas %d\n",n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
switch((char)*optarg) {
|
||||
case 'A':
|
||||
channel_model=SCM_A;
|
||||
abstraction_flag=1;
|
||||
ntrials=10000;
|
||||
msg("Running Abstraction test\n");
|
||||
pbch_file_fd=fopen(optarg,"r");
|
||||
|
||||
if (pbch_file_fd==NULL) {
|
||||
printf("Problem with filename %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
channel_model=SCM_B;
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
channel_model=SCM_C;
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
channel_model=SCM_D;
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
channel_model=EPA;
|
||||
case 'N':
|
||||
Nid_cell = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
channel_model=EVA;
|
||||
input_fd = fopen(optarg,"r");
|
||||
|
||||
if (input_fd==NULL) {
|
||||
printf("Problem with filename %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
channel_model=ETU;
|
||||
case 'P':
|
||||
pbch_phase = atoi(optarg);
|
||||
|
||||
if (pbch_phase>3)
|
||||
printf("Illegal PBCH phase (0-3) got %d\n",pbch_phase);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
msg("Unsupported channel model!\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
n_frames = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
snr0 = atof(optarg);
|
||||
msg("Setting SNR0 to %f\n",snr0);
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
snr1 = atof(optarg);
|
||||
snr1set=1;
|
||||
msg("Setting SNR1 to %f\n",snr1);
|
||||
break;
|
||||
|
||||
/*
|
||||
case 't':
|
||||
Td= atof(optarg);
|
||||
case 'h':
|
||||
printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -N CellId\n",
|
||||
argv[0]);
|
||||
printf("-h This message\n");
|
||||
printf("-p Use extended prefix mode\n");
|
||||
printf("-d Use TDD\n");
|
||||
printf("-n Number of frames to simulate\n");
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n");
|
||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||
printf("-t Delay spread for multipath channel\n");
|
||||
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
|
||||
printf("-x Transmission mode (1,2,6 for the moment)\n");
|
||||
printf("-y Number of TX antennas used in eNB\n");
|
||||
printf("-z Number of RX antennas used in UE\n");
|
||||
printf("-N Nid_cell\n");
|
||||
printf("-f Output filename (.txt format) for Pe/SNR results\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
exit (-1);
|
||||
break;
|
||||
*/
|
||||
case 'p':
|
||||
extended_prefix_flag=1;
|
||||
break;
|
||||
|
||||
/*
|
||||
case 'r':
|
||||
ricean_factor = pow(10,-.1*atof(optarg));
|
||||
if (ricean_factor>1) {
|
||||
printf("Ricean factor must be between 0 and 1\n");
|
||||
exit(-1);
|
||||
}
|
||||
break;
|
||||
*/
|
||||
case 'x':
|
||||
transmission_mode=atoi(optarg);
|
||||
|
||||
if ((transmission_mode!=1) &&
|
||||
(transmission_mode!=2) &&
|
||||
(transmission_mode!=6)) {
|
||||
msg("Unsupported transmission mode %d\n",transmission_mode);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'y':
|
||||
n_tx=atoi(optarg);
|
||||
|
||||
if ((n_tx==0) || (n_tx>2)) {
|
||||
msg("Unsupported number of tx antennas %d\n",n_tx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
n_rx=atoi(optarg);
|
||||
|
||||
if ((n_rx==0) || (n_rx>2)) {
|
||||
msg("Unsupported number of rx antennas %d\n",n_rx);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'A':
|
||||
abstraction_flag=1;
|
||||
ntrials=10000;
|
||||
msg("Running Abstraction test\n");
|
||||
pbch_file_fd=fopen(optarg,"r");
|
||||
|
||||
if (pbch_file_fd==NULL) {
|
||||
printf("Problem with filename %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// case 'C':
|
||||
// calibration_flag=1;
|
||||
// msg("Running Abstraction calibration for Bias removal\n");
|
||||
// break;
|
||||
case 'N':
|
||||
Nid_cell = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
input_fd = fopen(optarg,"r");
|
||||
|
||||
if (input_fd==NULL) {
|
||||
printf("Problem with filename %s\n",optarg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
pbch_phase = atoi(optarg);
|
||||
|
||||
if (pbch_phase>3)
|
||||
printf("Illegal PBCH phase (0-3) got %d\n",pbch_phase);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
case 'h':
|
||||
printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -N CellId\n",
|
||||
argv[0]);
|
||||
printf("-h This message\n");
|
||||
printf("-p Use extended prefix mode\n");
|
||||
printf("-d Use TDD\n");
|
||||
printf("-n Number of frames to simulate\n");
|
||||
printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n");
|
||||
printf("-S Ending SNR, runs from SNR0 to SNR1\n");
|
||||
printf("-t Delay spread for multipath channel\n");
|
||||
printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n");
|
||||
printf("-x Transmission mode (1,2,6 for the moment)\n");
|
||||
printf("-y Number of TX antennas used in eNB\n");
|
||||
printf("-z Number of RX antennas used in UE\n");
|
||||
printf("-N Nid_cell\n");
|
||||
printf("-f Output filename (.txt format) for Pe/SNR results\n");
|
||||
printf("-F Input filename (.txt format) for RX conformance testing\n");
|
||||
exit (-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,16 +272,15 @@ int main(int argc, char **argv)
|
||||
n_tx=2;
|
||||
|
||||
lte_param_init(n_tx,
|
||||
n_rx,
|
||||
transmission_mode,
|
||||
extended_prefix_flag,
|
||||
frame_type,
|
||||
Nid_cell,
|
||||
3,
|
||||
N_RB_DL,
|
||||
osf,
|
||||
0);
|
||||
|
||||
n_rx,
|
||||
transmission_mode,
|
||||
extended_prefix_flag,
|
||||
frame_type,
|
||||
Nid_cell,
|
||||
3,
|
||||
N_RB_DL,
|
||||
osf,
|
||||
0);
|
||||
#ifdef XFORMS
|
||||
fl_initialize (&argc, argv, NULL, 0, 0);
|
||||
form_ue = create_lte_phy_scope_ue();
|
||||
@@ -334,38 +296,27 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
printf("SNR0 %f, SNR1 %f\n",snr0,snr1);
|
||||
|
||||
frame_parms = &PHY_vars_eNB->lte_frame_parms;
|
||||
|
||||
|
||||
|
||||
txdata = PHY_vars_eNB->lte_eNB_common_vars.txdata[0];
|
||||
txdata1 = PHY_vars_eNB1->lte_eNB_common_vars.txdata[0];
|
||||
txdata2 = PHY_vars_eNB2->lte_eNB_common_vars.txdata[0];
|
||||
|
||||
|
||||
s_re = malloc(2*sizeof(double*));
|
||||
s_im = malloc(2*sizeof(double*));
|
||||
s_re1 = malloc(2*sizeof(double*));
|
||||
s_im1 = malloc(2*sizeof(double*));
|
||||
s_re2 = malloc(2*sizeof(double*));
|
||||
s_im2 = malloc(2*sizeof(double*));
|
||||
r_re = malloc(2*sizeof(double*));
|
||||
r_im = malloc(2*sizeof(double*));
|
||||
r_re1 = malloc(2*sizeof(double*));
|
||||
r_im1 = malloc(2*sizeof(double*));
|
||||
r_re2 = malloc(2*sizeof(double*));
|
||||
r_im2 = malloc(2*sizeof(double*));
|
||||
|
||||
s_re = malloc(2*sizeof(double *));
|
||||
s_im = malloc(2*sizeof(double *));
|
||||
s_re1 = malloc(2*sizeof(double *));
|
||||
s_im1 = malloc(2*sizeof(double *));
|
||||
s_re2 = malloc(2*sizeof(double *));
|
||||
s_im2 = malloc(2*sizeof(double *));
|
||||
r_re = malloc(2*sizeof(double *));
|
||||
r_im = malloc(2*sizeof(double *));
|
||||
r_re1 = malloc(2*sizeof(double *));
|
||||
r_im1 = malloc(2*sizeof(double *));
|
||||
r_re2 = malloc(2*sizeof(double *));
|
||||
r_im2 = malloc(2*sizeof(double *));
|
||||
nsymb = (frame_parms->Ncp == 0) ? 14 : 12;
|
||||
|
||||
printf("FFT Size %d, Extended Prefix %d, Samples per subframe %d, Symbols per subframe %d\n",NUMBER_OF_OFDM_CARRIERS,
|
||||
frame_parms->Ncp,frame_parms->samples_per_tti,nsymb);
|
||||
|
||||
printf("PHY_vars_eNB1->lte_eNB_common_vars.txdataF[0][0] = %p\n",
|
||||
PHY_vars_eNB1->lte_eNB_common_vars.txdataF[0][0]);
|
||||
|
||||
|
||||
DLSCH_alloc_pdu2.rah = 0;
|
||||
DLSCH_alloc_pdu2.rballoc = DLSCH_RB_ALLOC;
|
||||
DLSCH_alloc_pdu2.TPC = 0;
|
||||
@@ -377,16 +328,14 @@ int main(int argc, char **argv)
|
||||
DLSCH_alloc_pdu2.rv1 = 0;
|
||||
// Forget second codeword
|
||||
DLSCH_alloc_pdu2.tpmi = (transmission_mode==6 ? 5 : 0) ; // precoding
|
||||
|
||||
eNB2UE = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antennas_tx,
|
||||
PHY_vars_UE->lte_frame_parms.nb_antennas_rx,
|
||||
channel_model,
|
||||
N_RB2sampling_rate(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
|
||||
PHY_vars_UE->lte_frame_parms.nb_antennas_rx,
|
||||
channel_model,
|
||||
N_RB2sampling_rate(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
|
||||
N_RB2channel_bandwidth(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
|
||||
if (eNB2UE==NULL) {
|
||||
msg("Problem generating channel model. Exiting.\n");
|
||||
@@ -394,7 +343,6 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
for (i=0; i<2; i++) {
|
||||
|
||||
s_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
bzero(s_re[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
s_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
@@ -407,7 +355,6 @@ int main(int argc, char **argv)
|
||||
bzero(s_re2[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
s_im2[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
bzero(s_im2[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
|
||||
r_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
bzero(r_re[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
r_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
|
||||
@@ -450,9 +397,7 @@ int main(int argc, char **argv)
|
||||
(PHY_vars_eNB->lte_frame_parms.Ncp==0) ? 5 : 4,
|
||||
10);
|
||||
*/
|
||||
|
||||
} else {
|
||||
|
||||
generate_sss(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
|
||||
AMP,
|
||||
&PHY_vars_eNB->lte_frame_parms,
|
||||
@@ -473,11 +418,8 @@ int main(int argc, char **argv)
|
||||
&PHY_vars_eNB->lte_frame_parms,
|
||||
2,
|
||||
12);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
generate_pilots(PHY_vars_eNB,
|
||||
PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
|
||||
@@ -494,7 +436,6 @@ int main(int argc, char **argv)
|
||||
PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
|
||||
0);
|
||||
*/
|
||||
|
||||
/*
|
||||
if (num_pdcch_symbols<3) {
|
||||
printf("Less than 3 pdcch symbols\n");
|
||||
@@ -530,9 +471,6 @@ int main(int argc, char **argv)
|
||||
tx_lev1 = 0;
|
||||
tx_lev2 = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
for (aa=0; aa<PHY_vars_eNB->lte_frame_parms.nb_antennas_tx; aa++) {
|
||||
if (frame_parms->Ncp == 1)
|
||||
PHY_ofdm_mod(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0][aa], // input,
|
||||
@@ -552,7 +490,6 @@ int main(int argc, char **argv)
|
||||
OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES);
|
||||
}
|
||||
|
||||
|
||||
LOG_M("txsig0.m","txs0", txdata[0],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
|
||||
|
||||
if (frame_parms->nb_antennas_tx>1)
|
||||
@@ -567,19 +504,14 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (SNR=snr0; SNR<snr1; SNR+=.2) {
|
||||
|
||||
|
||||
n_errors = 0;
|
||||
n_errors2 = 0;
|
||||
n_alamouti = 0;
|
||||
|
||||
for (trial=0; trial<n_frames; trial++) {
|
||||
|
||||
multipath_channel(eNB2UE,s_re,s_im,r_re,r_im,
|
||||
2*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES,0);
|
||||
|
||||
sigma2_dB = 10*log10((double)tx_lev) +10*log10((double)PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size/(double)(12*NB_RB)) - SNR;
|
||||
|
||||
if (n_frames==1)
|
||||
@@ -603,8 +535,8 @@ int main(int argc, char **argv)
|
||||
//printf("n_trial %d\n",n_trials);
|
||||
for (i=0; i<2*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; i++) {
|
||||
for (aa=0; aa<PHY_vars_eNB->lte_frame_parms.nb_antennas_rx; aa++) {
|
||||
((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[2*i] = (short) ((r_re[aa][i] +sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[2*i+1] = (short) ((r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short *) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[2*i] = (short) ((r_re[aa][i] +sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short *) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[2*i+1] = (short) ((r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -614,8 +546,6 @@ int main(int argc, char **argv)
|
||||
printf("rx_level data symbol %f\n",
|
||||
10*log10(signal_energy(&PHY_vars_UE->lte_ue_common_vars.rxdata[0][frame_parms->samples_per_tti/2],4*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES)));
|
||||
}
|
||||
|
||||
|
||||
} //noise trials
|
||||
} // trials
|
||||
|
||||
@@ -629,30 +559,65 @@ int main(int argc, char **argv)
|
||||
} // NSR
|
||||
|
||||
if (n_frames==1) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
for (i=0; i<2; i++) {
|
||||
free(s_re[i]);
|
||||
free(s_im[i]);
|
||||
|
||||
if (s_im1)
|
||||
free(s_im1[i]);
|
||||
|
||||
if (s_im2)
|
||||
free(s_im2[i]);
|
||||
|
||||
free(r_re[i]);
|
||||
|
||||
if (r_re1)
|
||||
free(r_re1[i]);
|
||||
|
||||
if (r_re2)
|
||||
free(r_re2[i]);
|
||||
|
||||
free(r_im[i]);
|
||||
|
||||
if (s_re1)
|
||||
free(s_re1[i]);
|
||||
|
||||
if (s_re2)
|
||||
free(s_re2[i]);
|
||||
|
||||
if (r_im1)
|
||||
free(r_im1[i]);
|
||||
|
||||
if (r_im2)
|
||||
free(r_im2[i]);
|
||||
}
|
||||
|
||||
free(s_re);
|
||||
free(s_re1);
|
||||
free(s_re2);
|
||||
free(s_im);
|
||||
free(s_im1);
|
||||
free(s_im2);
|
||||
free(r_re);
|
||||
free(r_re1);
|
||||
free(r_re2);
|
||||
free(r_im);
|
||||
|
||||
|
||||
free(r_im1);
|
||||
free(r_im2);
|
||||
lte_sync_time_free();
|
||||
|
||||
if (write_output_file)
|
||||
fclose(output_fd);
|
||||
|
||||
return(n_errors);
|
||||
if (input_fd)
|
||||
fclose(input_fd);
|
||||
|
||||
if (pbch_file_fd)
|
||||
fclose(pbch_file_fd);
|
||||
|
||||
return(n_errors);
|
||||
}
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+138
-152
@@ -55,7 +55,7 @@
|
||||
|
||||
#include "PHY/TOOLS/lte_phy_scope.h"
|
||||
#include "dummy_functions.c"
|
||||
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
#include "common/config/config_load_configmodule.h"
|
||||
double cpuf;
|
||||
#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0))
|
||||
@@ -81,7 +81,7 @@ double t_tx_min = 1000000000; /*!< \brief initial min process time for tx */
|
||||
double t_rx_min = 1000000000; /*!< \brief initial min process time for tx */
|
||||
int n_tx_dropped = 0; /*!< \brief initial max process time for tx */
|
||||
int n_rx_dropped = 0; /*!< \brief initial max process time for rx */
|
||||
int nfapi_mode = 0;
|
||||
|
||||
|
||||
extern void fep_full(RU_t *ru);
|
||||
extern void ru_fep_full_2thread(RU_t *ru);
|
||||
@@ -349,19 +349,6 @@ int main(int argc, char **argv) {
|
||||
char input_val_str[50],input_val_str2[50];
|
||||
// FILE *rx_frame_file;
|
||||
FILE *csv_fdUL=NULL;
|
||||
/*
|
||||
FILE *fperen=NULL;
|
||||
char fperen_name[512];
|
||||
|
||||
FILE *fmageren=NULL;
|
||||
char fmageren_name[512];
|
||||
|
||||
FILE *flogeren=NULL;
|
||||
char flogeren_name[512];
|
||||
*/
|
||||
/* FILE *ftxlev;
|
||||
char ftxlev_name[512];
|
||||
*/
|
||||
char csv_fname[512];
|
||||
static int n_frames=5000;
|
||||
static int n_ch_rlz = 1;
|
||||
@@ -405,7 +392,6 @@ int main(int argc, char **argv) {
|
||||
cpu_freq_GHz = (double)get_cpu_freq_GHz();
|
||||
cpuf = cpu_freq_GHz;
|
||||
set_parallel_conf("PARALLEL_SINGLE_THREAD");
|
||||
|
||||
printf("Detected cpu_freq %f GHz\n",cpu_freq_GHz);
|
||||
AssertFatal(load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) != NULL,
|
||||
"cannot load configuration module, exiting\n");
|
||||
@@ -456,10 +442,8 @@ int main(int argc, char **argv) {
|
||||
{ "help", "display help and exit", PARAMFLAG_BOOL, iptr:&help, defintval:0, TYPE_INT, 0 },
|
||||
{ "", "",0, iptr:NULL, defintval:0, TYPE_INT, 0 },
|
||||
};
|
||||
struct option * long_options = parse_oai_options(options);
|
||||
|
||||
struct option *long_options = parse_oai_options(options);
|
||||
int option_index;
|
||||
|
||||
int res;
|
||||
|
||||
while ((res=getopt_long_only(argc, argv, "", long_options, &option_index)) == 0) {
|
||||
@@ -467,125 +451,125 @@ int main(int argc, char **argv) {
|
||||
if (long_options[option_index].has_arg==no_argument)
|
||||
*(bool *)options[option_index].iptr=1;
|
||||
else switch (options[option_index].type) {
|
||||
case TYPE_INT:
|
||||
*(int *)options[option_index].iptr=atoi(optarg);
|
||||
break;
|
||||
case TYPE_INT:
|
||||
*(int *)options[option_index].iptr=atoi(optarg);
|
||||
break;
|
||||
|
||||
case TYPE_DOUBLE:
|
||||
*(double *)options[option_index].dblptr=atof(optarg);
|
||||
break;
|
||||
case TYPE_DOUBLE:
|
||||
*(double *)options[option_index].dblptr=atof(optarg);
|
||||
break;
|
||||
|
||||
case TYPE_UINT8:
|
||||
*(uint8_t *)options[option_index].dblptr=atoi(optarg);
|
||||
break;
|
||||
|
||||
case TYPE_UINT16:
|
||||
*(uint16_t *)options[option_index].dblptr=atoi(optarg);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("not decoded type.\n");
|
||||
exit(1);
|
||||
case TYPE_UINT8:
|
||||
*(uint8_t *)options[option_index].dblptr=atoi(optarg);
|
||||
break;
|
||||
|
||||
case TYPE_UINT16:
|
||||
*(uint16_t *)options[option_index].dblptr=atoi(optarg);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("not decoded type.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (long_options[option_index].name[0]) {
|
||||
case 'T':
|
||||
tdd_config=atoi(optarg);
|
||||
frame_type=TDD;
|
||||
break;
|
||||
case 'T':
|
||||
tdd_config=atoi(optarg);
|
||||
frame_type=TDD;
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
channel_model = AWGN;
|
||||
chMod = 1;
|
||||
break;
|
||||
case 'a':
|
||||
channel_model = AWGN;
|
||||
chMod = 1;
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
strncpy(channel_model_input,optarg,9);
|
||||
struct tmp {
|
||||
char opt;
|
||||
int m;
|
||||
int M;
|
||||
}
|
||||
tmp[]= {
|
||||
{'A',SCM_A,2},
|
||||
{'B',SCM_B,3},
|
||||
{'C',SCM_C,4},
|
||||
{'D',SCM_D,5},
|
||||
{'E',EPA,6},
|
||||
{'G',ETU,8},
|
||||
{'H',Rayleigh8,9},
|
||||
{'I',Rayleigh1,10},
|
||||
{'J',Rayleigh1_corr,11},
|
||||
{'K',Rayleigh1_anticorr,12},
|
||||
{'L',Rice8,13},
|
||||
{'M',Rice1,14},
|
||||
{'N',AWGN,1},
|
||||
{0,0,0}
|
||||
};
|
||||
struct tmp *ptr;
|
||||
case 'g':
|
||||
strncpy(channel_model_input,optarg,9);
|
||||
struct tmp {
|
||||
char opt;
|
||||
int m;
|
||||
int M;
|
||||
}
|
||||
tmp[]= {
|
||||
{'A',SCM_A,2},
|
||||
{'B',SCM_B,3},
|
||||
{'C',SCM_C,4},
|
||||
{'D',SCM_D,5},
|
||||
{'E',EPA,6},
|
||||
{'G',ETU,8},
|
||||
{'H',Rayleigh8,9},
|
||||
{'I',Rayleigh1,10},
|
||||
{'J',Rayleigh1_corr,11},
|
||||
{'K',Rayleigh1_anticorr,12},
|
||||
{'L',Rice8,13},
|
||||
{'M',Rice1,14},
|
||||
{'N',AWGN,1},
|
||||
{0,0,0}
|
||||
};
|
||||
struct tmp *ptr;
|
||||
|
||||
for (ptr=tmp; ptr->opt!=0; ptr++)
|
||||
if ( ptr->opt == optarg[0] ) {
|
||||
channel_model=ptr->m;
|
||||
chMod=ptr->M;
|
||||
break;
|
||||
}
|
||||
for (ptr=tmp; ptr->opt!=0; ptr++)
|
||||
if ( ptr->opt == optarg[0] ) {
|
||||
channel_model=ptr->m;
|
||||
chMod=ptr->M;
|
||||
break;
|
||||
}
|
||||
|
||||
AssertFatal(ptr->opt != 0, "Unsupported channel model: %s !\n", optarg );
|
||||
break;
|
||||
AssertFatal(ptr->opt != 0, "Unsupported channel model: %s !\n", optarg );
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
transmission_m=atoi(optarg);
|
||||
AssertFatal(transmission_m==1 || transmission_m==2,
|
||||
"Unsupported transmission mode %d\n",transmission_m);
|
||||
break;
|
||||
case 'x':
|
||||
transmission_m=atoi(optarg);
|
||||
AssertFatal(transmission_m==1 || transmission_m==2,
|
||||
"Unsupported transmission mode %d\n",transmission_m);
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
nb_rb = atoi(optarg);
|
||||
nb_rb_set = 1;
|
||||
break;
|
||||
case 'r':
|
||||
nb_rb = atoi(optarg);
|
||||
nb_rb_set = 1;
|
||||
break;
|
||||
|
||||
//case 'c':
|
||||
// cyclic_shift = atoi(optarg);
|
||||
// break;
|
||||
|
||||
case 'i':
|
||||
input_fdUL = fopen(optarg,"r");
|
||||
printf("Reading in %s (%p)\n",optarg,input_fdUL);
|
||||
AssertFatal(input_fdUL != (FILE *)NULL,"Unknown file %s\n",optarg);
|
||||
break;
|
||||
case 'i':
|
||||
input_fdUL = fopen(optarg,"r");
|
||||
printf("Reading in %s (%p)\n",optarg,input_fdUL);
|
||||
AssertFatal(input_fdUL != (FILE *)NULL,"Unknown file %s\n",optarg);
|
||||
break;
|
||||
|
||||
case 'A':
|
||||
beta_ACK = atoi(optarg);
|
||||
AssertFatal(beta_ACK>15,"beta_ack must be in (0..15)\n");
|
||||
break;
|
||||
case 'A':
|
||||
beta_ACK = atoi(optarg);
|
||||
AssertFatal(beta_ACK>15,"beta_ack must be in (0..15)\n");
|
||||
break;
|
||||
|
||||
case 'C':
|
||||
beta_CQI = atoi(optarg);
|
||||
AssertFatal((beta_CQI>15)||(beta_CQI<2),"beta_cqi must be in (2..15)\n");
|
||||
break;
|
||||
case 'C':
|
||||
beta_CQI = atoi(optarg);
|
||||
AssertFatal((beta_CQI>15)||(beta_CQI<2),"beta_cqi must be in (2..15)\n");
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
beta_RI = atoi(optarg);
|
||||
AssertFatal((beta_RI>15)||(beta_RI<2),"beta_ri must be in (0..13)\n");
|
||||
break;
|
||||
case 'R':
|
||||
beta_RI = atoi(optarg);
|
||||
AssertFatal((beta_RI>15)||(beta_RI<2),"beta_ri must be in (0..13)\n");
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
dump_perf=1;
|
||||
opp_enabled=1;
|
||||
break;
|
||||
case 'P':
|
||||
dump_perf=1;
|
||||
opp_enabled=1;
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
set_parallel_conf(optarg);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Wrong option: %s\n",long_options[option_index].name);
|
||||
exit(1);
|
||||
break;
|
||||
case 'L':
|
||||
set_parallel_conf(optarg);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Wrong option: %s\n",long_options[option_index].name);
|
||||
exit(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -594,14 +578,15 @@ int main(int argc, char **argv) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
if (help || verbose )
|
||||
display_options_values(options, true);
|
||||
display_options_values(options, true);
|
||||
|
||||
if (help)
|
||||
exit(0);
|
||||
|
||||
|
||||
if (thread_struct.parallel_conf != PARALLEL_SINGLE_THREAD)
|
||||
set_worker_conf("WORKER_ENABLE");
|
||||
|
||||
RC.nb_L1_inst = 1;
|
||||
RC.nb_RU = 1;
|
||||
lte_param_init(&eNB,&UE,&ru,
|
||||
@@ -619,7 +604,7 @@ int main(int argc, char **argv) {
|
||||
threequarter_fs,
|
||||
osf,
|
||||
0);
|
||||
RC.eNB = (PHY_VARS_eNB ***)malloc(sizeof(PHY_VARS_eNB **));
|
||||
RC.eNB = (PHY_VARS_eNB ** *)malloc(sizeof(PHY_VARS_eNB **));
|
||||
RC.eNB[0] = (PHY_VARS_eNB **)malloc(sizeof(PHY_VARS_eNB *));
|
||||
RC.ru = (RU_t **)malloc(sizeof(RC.ru));
|
||||
RC.eNB[0][0] = eNB;
|
||||
@@ -637,7 +622,7 @@ int main(int argc, char **argv) {
|
||||
eNB->UL_INFO.cqi_ind.cqi_raw_pdu_list = eNB->cqi_raw_pdu_list;
|
||||
printf("lte_param_init done\n");
|
||||
// for a call to phy_reset_ue later we need PHY_vars_UE_g allocated and pointing to UE
|
||||
PHY_vars_UE_g = (PHY_VARS_UE ***)malloc(sizeof(PHY_VARS_UE **));
|
||||
PHY_vars_UE_g = (PHY_VARS_UE ** *)malloc(sizeof(PHY_VARS_UE **));
|
||||
PHY_vars_UE_g[0] = (PHY_VARS_UE **) malloc(sizeof(PHY_VARS_UE *));
|
||||
PHY_vars_UE_g[0][0] = UE;
|
||||
|
||||
@@ -822,7 +807,7 @@ int main(int argc, char **argv) {
|
||||
if (cqi_flag == 1) coded_bits_per_codeword-=UE->ulsch[0]->O;
|
||||
|
||||
rate = (double)dlsch_tbs25[get_I_TBS(mcs)][nb_rb-1]/(coded_bits_per_codeword);
|
||||
printf("Rate = %f (mod %d), coded bits %d\n",rate,get_Qm_ul(mcs),coded_bits_per_codeword);
|
||||
printf("Rate = %f (mod %d), coded bits %u\n",rate,get_Qm_ul(mcs),coded_bits_per_codeword);
|
||||
|
||||
for (ch_realization=0; ch_realization<n_ch_rlz; ch_realization++) {
|
||||
/*
|
||||
@@ -884,7 +869,7 @@ int main(int argc, char **argv) {
|
||||
i=0;
|
||||
|
||||
while (!feof(input_fdUL)) {
|
||||
ret=fscanf(input_fdUL,"%s %s",input_val_str,input_val_str2);//&input_val1,&input_val2);
|
||||
ret=fscanf(input_fdUL,"%49s %49s",input_val_str,input_val_str2);//&input_val1,&input_val2);
|
||||
|
||||
if (ret != 2) printf("ERROR: error reading file\n");
|
||||
|
||||
@@ -971,7 +956,7 @@ int main(int argc, char **argv) {
|
||||
eNB->ulsch[0]->harq_processes[harq_pid]->round=round;
|
||||
UE->ulsch[0]->harq_processes[harq_pid]->round=round;
|
||||
|
||||
if (n_frames==1) printf("filling ulsch: Trial %d : Round %d (subframe %d, frame %d)\n",trials,round,proc_rxtx_ue->subframe_tx,proc_rxtx_ue->frame_tx);
|
||||
if (n_frames==1) printf("filling ulsch: Trial %u : Round %d (subframe %d, frame %d)\n",trials,round,proc_rxtx_ue->subframe_tx,proc_rxtx_ue->frame_tx);
|
||||
|
||||
round_trials[round]++;
|
||||
UL_req.sfn_sf = (1<<4)+subframe;
|
||||
@@ -1062,10 +1047,10 @@ int main(int argc, char **argv) {
|
||||
sigma2_dB = N0;//-10*log10(UE->frame_parms.ofdm_symbol_size/(UE->frame_parms.N_RB_DL*12));//10*log10((double)tx_lev) +10*log10(UE->frame_parms.ofdm_symbol_size/(UE->frame_parms.N_RB_DL*12)) - SNR;
|
||||
sigma2 = pow(10,sigma2_dB/10);
|
||||
// compute tx_gain to achieve target SNR (per resource element!)
|
||||
tx_gain = sqrt(pow(10.0,.1*(N0+SNR))/(double)tx_lev);//*(nb_rb*12/(double)UE->frame_parms.ofdm_symbol_size)/(double)tx_lev);
|
||||
tx_gain = sqrt(pow(10.0,.1*(N0+SNR))/(double)tx_lev);// *(nb_rb*12/(double)UE->frame_parms.ofdm_symbol_size)/(double)tx_lev);
|
||||
|
||||
if (n_frames==1)
|
||||
printf("tx_lev = %d (%d.%d dB,%f), gain %f\n",tx_lev,tx_lev_dB/10,tx_lev_dB,10*log10((double)tx_lev),10*log10(tx_gain));
|
||||
printf("tx_lev = %u (%u.%u dB,%f), gain %f\n",tx_lev,tx_lev_dB/10,tx_lev_dB,10*log10((double)tx_lev),10*log10(tx_gain));
|
||||
|
||||
// fill measurement symbol (19) with noise
|
||||
for (i=0; i<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; i++) {
|
||||
@@ -1100,7 +1085,7 @@ int main(int argc, char **argv) {
|
||||
// calculate freq domain representation to compute SINR
|
||||
freq_channel(UE2eNB, N_RB_DL,12*N_RB_DL + 1);
|
||||
// snr=pow(10.0,.1*SNR);
|
||||
fprintf(csv_fdUL,"%f,%d,%d,%f,%f,%f,",SNR,tx_lev,tx_lev_dB,sigma2_dB,tx_gain,SNR2);
|
||||
fprintf(csv_fdUL,"%f,%u,%u,%f,%f,%f,",SNR,tx_lev,tx_lev_dB,sigma2_dB,tx_gain,SNR2);
|
||||
|
||||
//fprintf(csv_fdUL,"%f,",SNR);
|
||||
for (u=0; u<12*nb_rb; u++) {
|
||||
@@ -1156,12 +1141,12 @@ int main(int argc, char **argv) {
|
||||
if (eNB->frame_parms.nb_antennas_rx>1) LOG_M("rxsig1UL.m","rxs1", &ru->common.rxdata[1][eNB->frame_parms.samples_per_tti*subframe],eNB->frame_parms.samples_per_tti,1,1);
|
||||
}
|
||||
|
||||
start_meas(&eNB->phy_proc_rx);
|
||||
start_meas(&eNB->phy_proc_rx);
|
||||
ru->feprx = (get_thread_worker_conf() == WORKER_ENABLE) ? ru_fep_full_2thread : fep_full;
|
||||
ru->feprx(ru);
|
||||
phy_procedures_eNB_uespec_RX(eNB,proc_rxtx);
|
||||
stop_meas(&eNB->phy_proc_rx);
|
||||
|
||||
stop_meas(&eNB->phy_proc_rx);
|
||||
|
||||
if (cqi_flag > 0) {
|
||||
cqi_error = 0;
|
||||
|
||||
@@ -1226,11 +1211,10 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
dump_ulsch(eNB,eNB->proc.frame_rx,subframe,0,round);
|
||||
|
||||
if (round == 4) exit(-1);
|
||||
round=5;
|
||||
}
|
||||
|
||||
if (n_frames==1) printf("round %d errors %d/%d\n",round,errs[round],trials);
|
||||
if (n_frames==1) printf("round %d errors %u/%u\n",round,errs[round],trials);
|
||||
|
||||
round++;
|
||||
|
||||
@@ -1288,7 +1272,7 @@ int main(int argc, char **argv) {
|
||||
LOG_UDUMPMSG(SIM,dataArray(table_rx),table_rx->size,LOG_DUMP_DOUBLE,"The receiver raw data: \n");
|
||||
}
|
||||
|
||||
printf("\n**********rb: %d ***mcs : %d *********SNR = %f dB (%f): TX %d dB (gain %f dB), N0W %f dB, I0 %d dB, delta_IF %d [ (%d,%d) dB / (%d,%d) dB ]**************************\n",
|
||||
printf("\n**********rb: %d ***mcs : %d *********SNR = %f dB (%f): TX %u dB (gain %f dB), N0W %f dB, I0 %d dB, delta_IF %d [ (%d,%d) dB / (%d,%d) dB ]**************************\n",
|
||||
nb_rb,mcs,SNR,SNR2,
|
||||
tx_lev_dB,
|
||||
20*log10(tx_gain),
|
||||
@@ -1300,7 +1284,7 @@ int main(int argc, char **argv) {
|
||||
eNB->measurements.n0_power_dB[0],
|
||||
eNB->measurements.n0_power_dB[1]);
|
||||
effective_rate = ((double)(round_trials[0])/((double)round_trials[0] + round_trials[1] + round_trials[2] + round_trials[3]));
|
||||
printf("Errors (%d/%d %d/%d %d/%d %d/%d), Pe = (%e,%e,%e,%e) => effective rate %f (%3.1f%%,%f,%f), normalized delay %f (%f)\n",
|
||||
printf("Errors (%u/%u %u/%u %u/%u %u/%u), Pe = (%e,%e,%e,%e) => effective rate %f (%3.1f%%,%f,%f), normalized delay %f (%f)\n",
|
||||
errs[0],
|
||||
round_trials[0],
|
||||
errs[1],
|
||||
@@ -1322,16 +1306,16 @@ int main(int argc, char **argv) {
|
||||
(1.0*(round_trials[0]-errs[0])+2.0*(round_trials[1]-errs[1])+3.0*(round_trials[2]-errs[2])+4.0*(round_trials[3]-errs[3]))/((double)round_trials[0]));
|
||||
|
||||
if (cqi_flag >0) {
|
||||
printf("CQI errors %d/%d,false positives %d/%d, CQI false negatives %d/%d\n",
|
||||
printf("CQI errors %d/%u,false positives %d/%u, CQI false negatives %d/%u\n",
|
||||
cqi_errors,round_trials[0]+round_trials[1]+round_trials[2]+round_trials[3],
|
||||
cqi_crc_falsepositives,round_trials[0]+round_trials[1]+round_trials[2]+round_trials[3],
|
||||
cqi_crc_falsenegatives,round_trials[0]+round_trials[1]+round_trials[2]+round_trials[3]);
|
||||
}
|
||||
|
||||
if (eNB->ulsch[0]->harq_processes[harq_pid]->o_ACK[0] > 0)
|
||||
printf("ACK/NAK errors %d/%d\n",ack_errors,round_trials[0]+round_trials[1]+round_trials[2]+round_trials[3]);
|
||||
printf("ACK/NAK errors %d/%u\n",ack_errors,round_trials[0]+round_trials[1]+round_trials[2]+round_trials[3]);
|
||||
|
||||
fprintf(bler_fd,"%f;%d;%d;%d;%f;%d;%d;%d;%d;%d;%d;%d;%d\n",
|
||||
fprintf(bler_fd,"%f;%d;%d;%d;%f;%u;%u;%u;%u;%u;%u;%u;%u\n",
|
||||
SNR,
|
||||
mcs,
|
||||
nb_rb,
|
||||
@@ -1358,15 +1342,15 @@ int main(int argc, char **argv) {
|
||||
printStatIndent(&UE->ulsch_rate_matching_stats,"ULSCH rate-matching time");
|
||||
printStatIndent(&UE->ulsch_interleaving_stats,"ULSCH sub-block interleaving");
|
||||
printStatIndent(&UE->ulsch_multiplexing_stats,"ULSCH multiplexing time");
|
||||
printf("\n");
|
||||
printf("\n");
|
||||
printDistribution(&eNB->phy_proc_rx,table_rx,"Total PHY proc rx subframe");
|
||||
printDistribution(&ru->ofdm_demod_stats,table_rx_fft,"|__ OFDM_demod time");
|
||||
printDistribution(&eNB->ulsch_demodulation_stats,table_rx_demod,"|__ ULSCH demodulation time");
|
||||
printDistribution(&eNB->ulsch_decoding_stats,table_rx_dec,"|__ ULSCH Decoding time");
|
||||
printDistribution(&eNB->ulsch_decoding_stats,table_rx_dec,"|__ ULSCH Decoding time");
|
||||
printf(" (%.2f Mbit/s, avg iter %.2f, max %.2f)\n",
|
||||
UE->ulsch[0]->harq_processes[harq_pid]->TBS/1000.0,
|
||||
(double)iter_trials,
|
||||
(double)eNB->ulsch_decoding_stats.max*timeBase);
|
||||
(double)iter_trials,
|
||||
(double)eNB->ulsch_decoding_stats.max*timeBase);
|
||||
printStatIndent2(&eNB->ulsch_deinterleaving_stats,"sub-block interleaving" );
|
||||
printStatIndent2(&eNB->ulsch_demultiplexing_stats,"sub-block demultiplexing" );
|
||||
printStatIndent2(&eNB->ulsch_rate_unmatching_stats,"sub-block rate-matching" );
|
||||
@@ -1404,7 +1388,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
if ( (test_perf != 0) && (100 * effective_rate > test_perf )) {
|
||||
//fprintf(time_meas_fd,"SNR; MCS; TBS; rate; err0; trials0; err1; trials1; err2; trials2; err3; trials3\n");
|
||||
fprintf(time_meas_fd,"%f;%d;%d;%f;%d;%d;%d;%d;%d;%d;%d;%d;",
|
||||
fprintf(time_meas_fd,"%f;%d;%d;%f;%u;%u;%u;%u;%u;%u;%u;%u;",
|
||||
SNR,
|
||||
mcs,
|
||||
eNB->ulsch[0]->harq_processes[harq_pid]->TBS,
|
||||
@@ -1418,7 +1402,7 @@ int main(int argc, char **argv) {
|
||||
errs[3],
|
||||
round_trials[3]);
|
||||
//fprintf(time_meas_fd,"SNR; MCS; TBS; rate; err0; trials0; err1; trials1; err2; trials2; err3; trials3;ND;\n");
|
||||
fprintf(time_meas_fd,"%f;%d;%d;%f;%2.1f;%f;%d;%d;%d;%d;%d;%d;%d;%d;%e;%e;%e;%e;%f;%f;",
|
||||
fprintf(time_meas_fd,"%f;%d;%d;%f;%2.1f;%f;%u;%u;%u;%u;%u;%u;%u;%u;%e;%e;%e;%e;%f;%f;",
|
||||
SNR,
|
||||
mcs,
|
||||
eNB->ulsch[0]->harq_processes[harq_pid]->TBS,
|
||||
@@ -1463,34 +1447,34 @@ int main(int argc, char **argv) {
|
||||
);
|
||||
//fprintf(time_meas_fd,"UE_PROC_TX_STD;UE_PROC_TX_MAX;UE_PROC_TX_MIN;UE_PROC_TX_MED;UE_PROC_TX_Q1;UE_PROC_TX_Q3;UE_PROC_TX_DROPPED;\n");
|
||||
fprintf(time_meas_fd,"%f;%f;%f;%f;%f;%f;%d;",
|
||||
squareRoot(&UE->phy_proc_tx), t_tx_max, t_tx_min, median(table_tx), q1(table_tx), q3(table_tx), n_tx_dropped);
|
||||
squareRoot(&UE->phy_proc_tx), t_tx_max, t_tx_min, median(table_tx), q1(table_tx), q3(table_tx), n_tx_dropped);
|
||||
//fprintf(time_meas_fd,"IFFT;\n");
|
||||
fprintf(time_meas_fd,"%f;%f;%f;%f;",
|
||||
squareRoot(&UE->ofdm_mod_stats),
|
||||
squareRoot(&UE->ofdm_mod_stats),
|
||||
median(table_tx_ifft),q1(table_tx_ifft),q3(table_tx_ifft));
|
||||
//fprintf(time_meas_fd,"MOD;\n");
|
||||
fprintf(time_meas_fd,"%f;%f;%f;%f;",
|
||||
squareRoot(&UE->ulsch_modulation_stats),
|
||||
squareRoot(&UE->ulsch_modulation_stats),
|
||||
median(table_tx_mod), q1(table_tx_mod), q3(table_tx_mod));
|
||||
//fprintf(time_meas_fd,"ENC;\n");
|
||||
fprintf(time_meas_fd,"%f;%f;%f;%f;",
|
||||
squareRoot(&UE->ulsch_encoding_stats),
|
||||
squareRoot(&UE->ulsch_encoding_stats),
|
||||
median(table_tx_enc),q1(table_tx_enc),q3(table_tx_enc));
|
||||
//fprintf(time_meas_fd,"eNB_PROC_RX_STD;eNB_PROC_RX_MAX;eNB_PROC_RX_MIN;eNB_PROC_RX_MED;eNB_PROC_RX_Q1;eNB_PROC_RX_Q3;eNB_PROC_RX_DROPPED;\n");
|
||||
fprintf(time_meas_fd,"%f;%f;%f;%f;%f;%f;%d;",
|
||||
squareRoot(&eNB->phy_proc_rx), t_rx_max, t_rx_min,
|
||||
squareRoot(&eNB->phy_proc_rx), t_rx_max, t_rx_min,
|
||||
median(table_rx), q1(table_rx), q3(table_rx), n_rx_dropped);
|
||||
//fprintf(time_meas_fd,"FFT;\n");
|
||||
fprintf(time_meas_fd,"%f;%f;%f;%f;",
|
||||
squareRoot(&ru->ofdm_demod_stats),
|
||||
squareRoot(&ru->ofdm_demod_stats),
|
||||
median(table_rx_fft), q1(table_rx_fft), q3(table_rx_fft));
|
||||
//fprintf(time_meas_fd,"DEMOD;\n");
|
||||
fprintf(time_meas_fd,"%f;%f;%f;%f;",
|
||||
squareRoot(&eNB->ulsch_demodulation_stats),
|
||||
squareRoot(&eNB->ulsch_demodulation_stats),
|
||||
median(table_rx_demod), q1(table_rx_demod), q3(table_rx_demod));
|
||||
//fprintf(time_meas_fd,"DEC;\n");
|
||||
fprintf(time_meas_fd,"%f;%f;%f;%f\n",
|
||||
squareRoot(&eNB->ulsch_decoding_stats),
|
||||
squareRoot(&eNB->ulsch_decoding_stats),
|
||||
median(table_rx_dec), q1(table_rx_dec), q3(table_rx_dec));
|
||||
printf("[passed] effective rate : %f (%2.1f%%,%f)): log and break \n",rate*effective_rate, 100*effective_rate, rate );
|
||||
break;
|
||||
@@ -1523,5 +1507,7 @@ int main(int argc, char **argv) {
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* temporary dummy implem of get_softmodem_optmask, till basic simulators implemented as device */
|
||||
uint64_t get_softmodem_optmask(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
openair0_device openair0;
|
||||
volatile int oai_exit=0;
|
||||
|
||||
void exit_function(const char* file, const char* function, const int line,const char *s) {
|
||||
void exit_function(const char* file, const char* function, const int line,const char *s) {
|
||||
const char * msg= s==NULL ? "no comment": s;
|
||||
printf("Exiting at: %s:%d %s(), %s\n", file, line, function, msg);
|
||||
exit(-1);
|
||||
printf("Exiting at: %s:%d %s(), %s\n", file, line, function, msg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
extern unsigned int dlsch_tbs25[27][25],TBStable[27][110];
|
||||
|
||||
@@ -32,17 +32,14 @@
|
||||
|
||||
// NEW code with lookup table for sin/cos based on delay profile (TO BE TESTED)
|
||||
|
||||
double **cos_lut=NULL,**sin_lut=NULL;
|
||||
double **cos_lut=NULL,* *sin_lut=NULL;
|
||||
|
||||
|
||||
//#if 1
|
||||
|
||||
|
||||
|
||||
int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
|
||||
{
|
||||
|
||||
|
||||
int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples) {
|
||||
double delta_f,freq; // 90 kHz spacing
|
||||
double delay;
|
||||
int16_t f;
|
||||
@@ -50,21 +47,18 @@ int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
|
||||
|
||||
if ((n_samples&1)==0) {
|
||||
fprintf(stderr, "freq_channel_init: n_samples has to be odd\n");
|
||||
return(-1);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
cos_lut = (double **)malloc(n_samples*sizeof(double*));
|
||||
sin_lut = (double **)malloc(n_samples*sizeof(double*));
|
||||
|
||||
cos_lut = (double **)malloc(n_samples*sizeof(double *));
|
||||
sin_lut = (double **)malloc(n_samples*sizeof(double *));
|
||||
delta_f = nb_rb*180000/(n_samples-1);
|
||||
|
||||
for (f=-(n_samples>>1); f<=(n_samples>>1); f++) {
|
||||
freq=delta_f*(double)f*1e-6;// due to the fact that delays is in mus
|
||||
|
||||
cos_lut[f+(n_samples>>1)] = (double *)malloc((int)desc->nb_taps*sizeof(double));
|
||||
sin_lut[f+(n_samples>>1)] = (double *)malloc((int)desc->nb_taps*sizeof(double));
|
||||
|
||||
|
||||
for (l=0; l<(int)desc->nb_taps; l++) {
|
||||
if (desc->nb_taps==1)
|
||||
delay = desc->delays[l];
|
||||
@@ -74,17 +68,13 @@ int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
|
||||
cos_lut[f+(n_samples>>1)][l] = cos(2*M_PI*freq*delay);
|
||||
sin_lut[f+(n_samples>>1)][l] = sin(2*M_PI*freq*delay);
|
||||
//printf("values cos:%d, sin:%d\n", cos_lut[f][l], sin_lut[f][l]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
|
||||
{
|
||||
|
||||
|
||||
int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples) {
|
||||
int16_t f,f2,d;
|
||||
uint8_t aarx,aatx,l;
|
||||
double *clut,*slut;
|
||||
@@ -95,7 +85,7 @@ int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
|
||||
// n_samples has to be a odd number because we assume the spectrum is symmetric around the DC and includes the DC
|
||||
if ((n_samples&1)==0) {
|
||||
fprintf(stderr, "freq_channel: n_samples has to be odd\n");
|
||||
return(-1);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
// printf("no of taps:%d,",(int)desc->nb_taps);
|
||||
@@ -104,6 +94,7 @@ int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
|
||||
// we are initializing the lut for the largets possible n_samples=12*nb_rb+1
|
||||
// if called with n_samples<12*nb_rb+1, we decimate the lut
|
||||
n_samples_max=12*nb_rb+1;
|
||||
|
||||
if (init_freq_channel(desc,nb_rb,n_samples_max)==0)
|
||||
freq_channel_init=1;
|
||||
else
|
||||
@@ -111,9 +102,7 @@ int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
|
||||
}
|
||||
|
||||
d=(n_samples_max-1)/(n_samples-1);
|
||||
|
||||
//printf("no_samples=%d, n_samples_max=%d, d=%d\n",n_samples,n_samples_max,d);
|
||||
|
||||
start_meas(&desc->interp_freq);
|
||||
|
||||
for (f=-n_samples_max/2,f2=-n_samples/2; f<n_samples_max/2; f+=d,f2++) {
|
||||
@@ -126,7 +115,6 @@ int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].y=0.0;
|
||||
|
||||
for (l=0; l<(int)desc->nb_taps; l++) {
|
||||
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].x+=(desc->a[l][aarx+(aatx*desc->nb_rx)].x*clut[l]+
|
||||
desc->a[l][aarx+(aatx*desc->nb_rx)].y*slut[l]);
|
||||
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].y+=(-desc->a[l][aarx+(aatx*desc->nb_rx)].x*slut[l]+
|
||||
@@ -137,7 +125,6 @@ int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
|
||||
}
|
||||
|
||||
stop_meas(&desc->interp_freq);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -146,16 +133,13 @@ double compute_pbch_sinr(channel_desc_t *desc,
|
||||
channel_desc_t *desc_i2,
|
||||
double snr_dB,double snr_i1_dB,
|
||||
double snr_i2_dB,
|
||||
uint16_t nb_rb)
|
||||
{
|
||||
|
||||
uint16_t nb_rb) {
|
||||
double avg_sinr,snr=pow(10.0,.1*snr_dB),snr_i1=pow(10.0,.1*snr_i1_dB),snr_i2=pow(10.0,.1*snr_i2_dB);
|
||||
uint16_t f;
|
||||
uint8_t aarx,aatx;
|
||||
double S;
|
||||
struct complex S_i1;
|
||||
struct complex S_i2;
|
||||
|
||||
avg_sinr=0.0;
|
||||
|
||||
// printf("nb_rb %d\n",nb_rb);
|
||||
@@ -202,18 +186,14 @@ double compute_sinr(channel_desc_t *desc,
|
||||
channel_desc_t *desc_i2,
|
||||
double snr_dB,double snr_i1_dB,
|
||||
double snr_i2_dB,
|
||||
uint16_t nb_rb)
|
||||
{
|
||||
|
||||
uint16_t nb_rb) {
|
||||
double avg_sinr,snr=pow(10.0,.1*snr_dB),snr_i1=pow(10.0,.1*snr_i1_dB),snr_i2=pow(10.0,.1*snr_i2_dB);
|
||||
uint16_t f;
|
||||
uint8_t aarx,aatx;
|
||||
double S;
|
||||
struct complex S_i1;
|
||||
struct complex S_i2;
|
||||
|
||||
DevAssert( nb_rb > 0 );
|
||||
|
||||
avg_sinr=0.0;
|
||||
|
||||
// printf("nb_rb %d\n",nb_rb);
|
||||
@@ -256,12 +236,9 @@ double compute_sinr(channel_desc_t *desc,
|
||||
int pbch_polynomial_degree=6;
|
||||
double pbch_awgn_polynomial[7]= {-7.2926e-05, -2.8749e-03, -4.5064e-02, -3.5301e-01, -1.4655e+00, -3.6282e+00, -6.6907e+00};
|
||||
|
||||
void load_pbch_desc(FILE *pbch_file_fd)
|
||||
{
|
||||
|
||||
void load_pbch_desc(FILE *pbch_file_fd) {
|
||||
int i, ret;
|
||||
char dummy[25];
|
||||
|
||||
ret = fscanf(pbch_file_fd,"%d",&pbch_polynomial_degree);
|
||||
|
||||
if (ret < 0) {
|
||||
@@ -277,7 +254,7 @@ void load_pbch_desc(FILE *pbch_file_fd)
|
||||
printf("PBCH polynomial : ");
|
||||
|
||||
for (i=0; i<=pbch_polynomial_degree; i++) {
|
||||
ret = fscanf(pbch_file_fd,"%s",dummy);
|
||||
ret = fscanf(pbch_file_fd,"%24s",dummy);
|
||||
|
||||
if (ret < 0) {
|
||||
printf("fscanf failed: %s\n", strerror(errno));
|
||||
@@ -291,9 +268,7 @@ void load_pbch_desc(FILE *pbch_file_fd)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
double pbch_bler(double sinr)
|
||||
{
|
||||
|
||||
double pbch_bler(double sinr) {
|
||||
int i;
|
||||
double log10_bler=pbch_awgn_polynomial[pbch_polynomial_degree];
|
||||
double sinrpow=sinr;
|
||||
@@ -317,6 +292,5 @@ double pbch_bler(double sinr)
|
||||
|
||||
//printf ("sinr %f bler %f\n",sinr,bler);
|
||||
return(bler);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -31,17 +31,14 @@
|
||||
enum sector {SEC1, SEC2, SEC3};
|
||||
scenario_desc_t scenario;
|
||||
|
||||
void get_chan_desc(node_desc_t* node_tx, node_desc_t* node_rx, channel_desc_t *ch_desc, scenario_desc_t* scenario)
|
||||
{
|
||||
void get_chan_desc(node_desc_t *node_tx, node_desc_t *node_rx, channel_desc_t *ch_desc, scenario_desc_t *scenario) {
|
||||
double dist;
|
||||
dist = sqrt(pow((node_tx->x - node_rx->x), 2) + pow((node_tx->y - node_rx->y), 2));
|
||||
|
||||
/* conversion of distance into KM 3gpp (36-942)*/
|
||||
ch_desc->path_loss_dB = (128.1 + 37.6 * log10(dist/1000));
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
int enb_count = 16;
|
||||
int ue_count = 50;
|
||||
double sect_angle[3]= {0,2*PI/3,4*PI/3};
|
||||
@@ -75,19 +72,16 @@ int main()
|
||||
"bler_9.csv", "bler_10.csv", "bler_11.csv", "bler_12.csv", "bler_13.csv", "bler_14.csv", "bler_15.csv", "bler_16.csv",
|
||||
"bler_17.csv", "bler_18.csv", "bler_19.csv", "bler_20.csv", "bler_21.csv", "bler_22.csv"
|
||||
};
|
||||
|
||||
double beta[MCS_COUNT] = {0, 0, 0, 0, 0.9459960937499999, 1.2912109374999994, 1.0133789062499998, 1.000390625,
|
||||
1.02392578125, 1.8595703124999998, 2.424389648437498, 2.3946533203124982, 2.5790039062499988,
|
||||
2.4084960937499984, 2.782617187499999, 2.7868652343749996, 3.92099609375, 4.0392578125,
|
||||
4.56109619140625, 5.03338623046875, 5.810888671875, 6.449108886718749
|
||||
};
|
||||
|
||||
double enb_position[][2] = {{1100,1100},{1100,2100},{1100,3100},{1100,4100},
|
||||
{2100,1100},{2100,2100},{2100,3100},{2100,4100},
|
||||
{3100,1100},{3100,2100},{3100,3100},{3100,4100},
|
||||
{4100,1100},{4100,2100},{4100,3100},{4100,4100}
|
||||
};
|
||||
|
||||
double ue_position[][2] = {{3340,4740},{1500,620},{1780,4220},{1300,3540},{780,3100},
|
||||
{1140,540},{1340,3660},{860,1220},{2700,2140},{3860,3060},
|
||||
{3740,1060},{1700,3060},{2180,1620},{4420,1060},{1300,3340},
|
||||
@@ -99,15 +93,12 @@ int main()
|
||||
{3420,2820},{1580,3940},{660,2100},{2740,1180},{2500,2500},
|
||||
{3580,3580},{3740,3140},{3020,3020},{4340,4140},{980,4300}
|
||||
};
|
||||
|
||||
randominit(0);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int tabl_len=0;
|
||||
double local_table[MCS_COUNT][9][9];
|
||||
|
||||
for (mcs = 5; mcs <= MCS_COUNT; mcs++) {
|
||||
|
||||
fp = fopen(file_name[mcs - 1],"r");
|
||||
|
||||
if (fp == NULL) {
|
||||
@@ -117,7 +108,6 @@ int main()
|
||||
tabl_len=0;
|
||||
|
||||
while (!feof(fp)) {
|
||||
|
||||
sinr_bler = strtok(buffer, ";");
|
||||
local_table[mcs-1][0][tabl_len] = atof(sinr_bler);
|
||||
sinr_bler = strtok(NULL,";");
|
||||
@@ -133,12 +123,8 @@ int main()
|
||||
|
||||
for (tabl_len=0; tabl_len<9; tabl_len++)
|
||||
printf("%lf %lf \n ",local_table[mcs-1][0][tabl_len],local_table[mcs-1][1][tabl_len]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
for (enb_index = 0; enb_index < enb_count; enb_index++)
|
||||
@@ -172,7 +158,6 @@ int main()
|
||||
ul_channel[ue_index][enb_index] = new_channel_desc_scm(1, 1, SCM_C, 7.68, 0, 0, 0);
|
||||
dl_channel[ue_index][enb_index] = new_channel_desc_scm(1, 1, SCM_C, 7.68, 0, 0, 0);
|
||||
//printf("ue %d enb %d\n", ue_index, enb_index);
|
||||
|
||||
/* Calculating the angle in the range -pi to pi from the slope */
|
||||
//(ue_data[ue_index])->alpha_rad[enb_index] = (double)(atan2((ue_data[ue_index]->x - enb_data[enb_index]->x), (ue_data[ue_index]->y - enb_data[enb_index]->y)));
|
||||
ue_data[ue_index]->alpha_rad[enb_index] = atan2((ue_data[ue_index]->x - enb_data[enb_index]->x), (ue_data[ue_index]->y - enb_data[enb_index]->y));
|
||||
@@ -190,8 +175,7 @@ int main()
|
||||
|
||||
/* gain = -min(Am , 12 * (theta/theta_3dB)^2) */
|
||||
gain_max = (gain_sec[SEC1] > gain_sec[SEC2]) ? ((gain_sec[SEC1] > gain_sec[SEC3]) ? gain_sec[SEC1]:gain_sec[SEC3]) :
|
||||
((gain_sec[SEC2] > gain_sec[SEC3]) ? gain_sec[SEC2]:gain_sec[SEC3]);
|
||||
|
||||
((gain_sec[SEC2] > gain_sec[SEC3]) ? gain_sec[SEC2]:gain_sec[SEC3]);
|
||||
get_chan_desc(enb_data[enb_index], ue_data[ue_index], ul_channel[ue_index][enb_index], &scenario);
|
||||
get_chan_desc(enb_data[enb_index], ue_data[ue_index], dl_channel[ue_index][enb_index], &scenario);
|
||||
|
||||
@@ -204,7 +188,6 @@ int main()
|
||||
|
||||
//return_value = random_channel(ul_channel[ue_index][enb_index]);
|
||||
return_value = random_channel(dl_channel[ue_index][enb_index]);
|
||||
|
||||
/* Thermal noise is calculated using 10log10(K*T*B) K = Boltzmann´s constant T = room temperature B = bandwidth */
|
||||
/* Taken as constant for the time being since the BW is not changing */
|
||||
thermal_noise = -105; //value in dBm
|
||||
@@ -222,7 +205,6 @@ int main()
|
||||
- (thermal_noise + ue_data[ue_index]->rx_noise_level)
|
||||
+ 10 * log10 (pow(dl_channel[ue_index][enb_index]->chF[0][count].r, 2)
|
||||
+ pow(dl_channel[ue_index][enb_index]->chF[0][count].i, 2));
|
||||
|
||||
//printf("Dl_link SNR for res. block %d is %lf\n", count, sinr[enb_index][count]);
|
||||
}
|
||||
}
|
||||
@@ -252,7 +234,6 @@ int main()
|
||||
//printf("mcs value %d \n",mcs);
|
||||
//printf("beta value %lf \n",-beta[mcs-1]);
|
||||
//printf("snr_eff value %lf \n",log(sinr_eff[ue_index][mcs-1]));
|
||||
|
||||
sinr_eff[ue_index][mcs-1] = -beta[mcs-1] *log((sinr_eff[ue_index][mcs-1])/(2*nb_rb));//
|
||||
//printf("snr_eff value %lf \n",sinr_eff[ue_index][mcs-1]);
|
||||
sinr_eff[ue_index][mcs-1] = 10 * log10(sinr_eff[ue_index][mcs-1]);
|
||||
@@ -264,9 +245,7 @@ int main()
|
||||
}
|
||||
|
||||
sinr_eff[ue_index][mcs-1] /= 10;
|
||||
|
||||
//printf("Effective snr %lf \n",sinr_eff[ue_index][mcs-1]);
|
||||
|
||||
bler[ue_index][mcs-1] = 0;
|
||||
|
||||
/*line_num = 0;
|
||||
@@ -295,37 +274,31 @@ int main()
|
||||
}
|
||||
fclose(fp);*/
|
||||
for (tabl_len=0; tabl_len<9; tabl_len++) {
|
||||
|
||||
if(tabl_len==0)
|
||||
if (sinr_eff[ue_index][mcs-1] < local_table[mcs-1][0][tabl_len]) {
|
||||
bler[ue_index][mcs-1] = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (sinr_eff[ue_index][mcs-1] == local_table[mcs-1][0][tabl_len]) {
|
||||
bler[ue_index][mcs-1] = local_table[mcs-1][1][tabl_len];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//printf("\n###Dl_link UE %d attached to eNB %d \n MCS %d effective SNR %lf BLER %lf", ue_index, att_enb_index, mcs,sinr_eff[ue_index][mcs-1],bler[ue_index][mcs-1]);
|
||||
}
|
||||
|
||||
//printf("\n\n");
|
||||
|
||||
printf("\n Ue_ix enb_ix mcs5 mcs6 mcs7 mcs8 mcs9 mcs10 mcs11 mcs12 mcs13\
|
||||
mcs14 mcs15 mcs16 mcs17 mcs18 mcs19 mcs20 mcs21 mcs22\n");
|
||||
|
||||
printf("SINR %4d %4d %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f\
|
||||
%+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f\n",
|
||||
%+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f\n",
|
||||
ue_index, att_enb_index, sinr_eff[ue_index][4], sinr_eff[ue_index][5], sinr_eff[ue_index][6], sinr_eff[ue_index][7],
|
||||
sinr_eff[ue_index][8], sinr_eff[ue_index][9], sinr_eff[ue_index][10], sinr_eff[ue_index][11], sinr_eff[ue_index][12],
|
||||
sinr_eff[ue_index][13], sinr_eff[ue_index][14], sinr_eff[ue_index][15], sinr_eff[ue_index][16], sinr_eff[ue_index][17],
|
||||
sinr_eff[ue_index][18], sinr_eff[ue_index][19], sinr_eff[ue_index][20], sinr_eff[ue_index][21], sinr_eff[ue_index][22]);
|
||||
|
||||
printf("BLER %4d %4d %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f\
|
||||
%+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f\n",
|
||||
%+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f %+4.2f\n",
|
||||
ue_index, att_enb_index, bler[ue_index][4], bler[ue_index][5], bler[ue_index][6], bler[ue_index][7],
|
||||
bler[ue_index][8], bler[ue_index][9], bler[ue_index][10], bler[ue_index][11], bler[ue_index][12],
|
||||
bler[ue_index][13], bler[ue_index][14], bler[ue_index][15], bler[ue_index][16], bler[ue_index][17],
|
||||
|
||||
@@ -27,20 +27,15 @@
|
||||
|
||||
unsigned int *generate_gauss_LUT(unsigned char Nbits,
|
||||
unsigned char L
|
||||
)
|
||||
{
|
||||
|
||||
) {
|
||||
unsigned int *LUT_ptr,i;
|
||||
|
||||
LUT_ptr = (unsigned int *)malloc((1<<(Nbits-1))*sizeof(int));
|
||||
assert(LUT_ptr);
|
||||
|
||||
|
||||
for (i=0; i<(1<<(Nbits-1)); i++) {
|
||||
LUT_ptr[i] = (unsigned int)((double)((unsigned int)(1<<31))*erf(i*L/(double)(1<<(Nbits-1))));
|
||||
|
||||
#ifdef LUTDEBUG
|
||||
printf("pos %d : LUT_ptr[%d]=%x (%f)\n",i,i,LUT_ptr[i],(double)(erf(i*L/(double)(1<<(Nbits-1)))));
|
||||
printf("pos %u : LUT_ptr[%u]=%x (%f)\n",i,i,LUT_ptr[i],(double)(erf(i*L/(double)(1<<(Nbits-1)))));
|
||||
#endif //LUTDEBUG
|
||||
}
|
||||
|
||||
@@ -51,40 +46,29 @@ unsigned int *generate_gauss_LUT(unsigned char Nbits,
|
||||
|
||||
int gauss(unsigned int *gauss_LUT,
|
||||
unsigned char Nbits
|
||||
)
|
||||
{
|
||||
|
||||
) {
|
||||
unsigned int search_pos,step_size,u,tmp,tmpm1,tmpp1,s;
|
||||
|
||||
// Get a 32-bit uniform random-variable
|
||||
u = taus();
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("u = %u\n",u);
|
||||
#endif //DEBUG
|
||||
|
||||
// if it is larger than 2^31 (here negative), save the sign and rescale down to 31-bits.
|
||||
|
||||
s = u & 0x80000000;
|
||||
u &= 0x7fffffff;
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("u = %x,s=%d\n",u,s);
|
||||
printf("u = %x,s=%u\n",u,s);
|
||||
#endif //DEBUG
|
||||
|
||||
search_pos = (1<<(Nbits-2)); // starting position of the binary search
|
||||
step_size = search_pos;
|
||||
|
||||
do {
|
||||
|
||||
step_size >>= 1;
|
||||
|
||||
tmp = gauss_LUT[search_pos];
|
||||
tmpm1 = gauss_LUT[search_pos-1];
|
||||
tmpp1 = gauss_LUT[search_pos+1];
|
||||
#ifdef DEBUG
|
||||
printf("search_pos %d, step_size %d: t %x tm %x,tp %x\n",search_pos,step_size,tmp,tmpm1,tmpp1);
|
||||
printf("search_pos %u, step_size %u: t %x tm %x,tp %x\n",search_pos,step_size,tmp,tmpm1,tmpp1);
|
||||
#endif //DEBUG
|
||||
|
||||
if (u <= tmp)
|
||||
@@ -96,12 +80,10 @@ int gauss(unsigned int *gauss_LUT,
|
||||
return s==0 ? search_pos : - search_pos;
|
||||
else
|
||||
search_pos += step_size;
|
||||
|
||||
} while (step_size > 0);
|
||||
|
||||
// If it gets here we're beyond the positive edge so return max
|
||||
return s==0 ? (1<<(Nbits-1))-1 : 1-((1<<(Nbits-1)));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -109,9 +91,7 @@ int gauss(unsigned int *gauss_LUT,
|
||||
|
||||
#define Nhistbits 8
|
||||
|
||||
void main(int argc,char **argv)
|
||||
{
|
||||
|
||||
void main(int argc,char **argv) {
|
||||
unsigned int *gauss_LUT_ptr,i;
|
||||
unsigned int hist[(1<<Nhistbits)];
|
||||
int gvar,maxg=0,ming=9999999,maxnum=0,L,Ntrials,Nbits;
|
||||
@@ -125,7 +105,6 @@ void main(int argc,char **argv)
|
||||
Nbits = atoi(argv[1]);
|
||||
L = atoi(argv[2]);
|
||||
Ntrials = atoi(argv[3]);
|
||||
|
||||
set_taus_seed();
|
||||
// Generate Gaussian LUT 12-bit quantization over 5 standard deviations
|
||||
gauss_LUT_ptr = generate_gauss_LUT(Nbits,L);
|
||||
@@ -134,7 +113,6 @@ void main(int argc,char **argv)
|
||||
hist[i] = 0;
|
||||
|
||||
for (i=0; i<Ntrials; i++) {
|
||||
|
||||
gvar = gauss(gauss_LUT_ptr,Nbits);
|
||||
|
||||
if (gvar == ((1<<(Nbits-1))-1))
|
||||
@@ -151,10 +129,8 @@ void main(int argc,char **argv)
|
||||
|
||||
printf("Tail probability = %e(%x)\n",2*erfc((double)L*gauss_LUT_ptr[(1<<(Nbits-1))-1]/(unsigned int)(1<<31)),gauss_LUT_ptr[(1<<(Nbits-1))-1]);
|
||||
printf("max %d, min %d, mean %f, stddev %f, Pr(maxnum)=%e(%d)\n",maxg,ming,meang,sqrt(varg),(double)maxnum/Ntrials,maxnum);
|
||||
|
||||
// for (i=0;i<(1<<Nhistbits);i++)
|
||||
// printf("%d : %u\n",i,hist[i]);
|
||||
|
||||
free(gauss_LUT_ptr);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,24 +37,18 @@ void multipath_tv_channel(channel_desc_t *desc,
|
||||
double **rx_sig_re,
|
||||
double **rx_sig_im,
|
||||
uint16_t length,
|
||||
uint8_t keep_channel)
|
||||
{
|
||||
|
||||
double complex **tx,**rx,***H_t,*rx_temp;//, *tv_H_t;
|
||||
uint8_t keep_channel) {
|
||||
double complex **tx,**rx,* **H_t,*rx_temp; //, *tv_H_t;
|
||||
double path_loss = pow(10,desc->path_loss_dB/20);
|
||||
int i,j,k,dd;
|
||||
|
||||
dd = abs(desc->channel_offset);
|
||||
|
||||
#ifdef DEBUG_CH
|
||||
printf("[TV CHANNEL] keep = %d : path_loss = %g (%f), nb_rx %d, nb_tx %d, dd %d, len %d max_doppler %d\n",keep_channel,path_loss,desc->path_loss_dB,desc->nb_rx,desc->nb_tx,dd,desc->channel_length,
|
||||
printf("[TV CHANNEL] keep = %d : path_loss = %g (%f), nb_rx %d, nb_tx %d, dd %d, len %d max_doppler %g\n",keep_channel,path_loss,desc->path_loss_dB,desc->nb_rx,desc->nb_tx,dd,desc->channel_length,
|
||||
desc->max_Doppler);
|
||||
#endif
|
||||
|
||||
tx = (double complex **)malloc(desc->nb_tx*sizeof(double complex));
|
||||
rx = (double complex **)malloc(desc->nb_rx*sizeof(double complex));
|
||||
|
||||
H_t= (double complex ***) malloc(desc->nb_tx*desc->nb_rx*sizeof(double complex **));
|
||||
H_t= (double complex ** *) malloc(desc->nb_tx*desc->nb_rx*sizeof(double complex **));
|
||||
// tv_H_t = (double complex *) malloc(length*sizeof(double complex));
|
||||
rx_temp= (double complex *) calloc(length,sizeof(double complex));
|
||||
|
||||
@@ -128,17 +122,13 @@ void multipath_tv_channel(channel_desc_t *desc,
|
||||
}
|
||||
|
||||
free(H_t);
|
||||
|
||||
free(rx_temp);
|
||||
}
|
||||
|
||||
//TODO: make phi_rad a parameter of this function
|
||||
void tv_channel(channel_desc_t *desc,double complex ***H,uint16_t length)
|
||||
{
|
||||
|
||||
void tv_channel(channel_desc_t *desc,double complex ***H,uint16_t length) {
|
||||
int i,j,p,l,k;
|
||||
double *alpha,*phi_rad,pi=acos(-1),*w_Hz;
|
||||
|
||||
alpha = (double *)calloc(desc->nb_paths,sizeof(double));
|
||||
phi_rad = (double *)calloc(desc->nb_paths,sizeof(double));
|
||||
w_Hz = (double *)calloc(desc->nb_paths,sizeof(double));
|
||||
@@ -203,21 +193,17 @@ void tv_channel(channel_desc_t *desc,double complex ***H,uint16_t length)
|
||||
}
|
||||
|
||||
// time varying convolution
|
||||
void tv_conv(double complex **h, double complex *x, double complex *y, uint16_t nb_samples, uint8_t nb_taps, int dd)
|
||||
{
|
||||
|
||||
void tv_conv(double complex **h, double complex *x, double complex *y, uint16_t nb_samples, uint8_t nb_taps, int dd) {
|
||||
int i,j;
|
||||
|
||||
for(i=0; i<((int)nb_samples-dd); i++) {
|
||||
for(j=0; j<nb_taps; j++) {
|
||||
if(i>j)
|
||||
y[i+dd] += creal(h[i][j])*creal(x[i-j])-cimag(h[i][j])*cimag(x[i-j]) + I*(creal(h[i][j])*cimag(x[i-j])+cimag(h[i][j])*creal(x[i-j]));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double frand_a_b(double a, double b)
|
||||
{
|
||||
double frand_a_b(double a, double b) {
|
||||
return (rand()/(double)RAND_MAX)*(b-a)+a;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user