Commit 98a9469f authored by nikaeinn's avatar nikaeinn
Browse files

* add oaisim performance profiler OPP (enabled with option q )

* fix the bug for IP connectivity when more than 1 UE is connected (test with iperf: ok)
* set target ul/dl mcs in the eNB scheduler to hardwire the desired MCS (option t for UL and m for DL)
* add the code related to abstraction from http://svn.eurecom.fr/openairsvn/openair4G/tags/asilomar2013
* cleanup the code
* pre-ci passed for all except for eMBMS



git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5093 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 70920ffd
...@@ -373,7 +373,7 @@ run in segments with final trace back after last segment. ...@@ -373,7 +373,7 @@ run in segments with final trace back after last segment.
@param traceback flag to indicate that traceback should be performed*/ @param traceback flag to indicate that traceback should be performed*/
void phy_viterbi_dot11_sse2(int8_t *y,uint8_t *decoded_bytes,uint16_t n); void phy_viterbi_dot11_sse2(int8_t *y,uint8_t *decoded_bytes,uint16_t n);
/*!\fn void phy_viterbi_lte_sse2(s8 *y, u8 *decoded_bytes, u16 n) /*!\fn void phy_viterbi_lte_sse2(int8_t *y, uint8_t *decoded_bytes, uint16_t n)
\brief This routine performs a SIMD optmized Viterbi decoder for the LTE 64-state tail-biting convolutional code. \brief This routine performs a SIMD optmized Viterbi decoder for the LTE 64-state tail-biting convolutional code.
@param y Pointer to soft input (coded on 8-bits but should be limited to 4-bit precision to avoid overflow) @param y Pointer to soft input (coded on 8-bits but should be limited to 4-bit precision to avoid overflow)
@param decoded_bytes Pointer to decoded output @param decoded_bytes Pointer to decoded output
......
...@@ -582,7 +582,16 @@ void phy_config_dedicated_ue(u8 Mod_id,u8 CH_index, ...@@ -582,7 +582,16 @@ void phy_config_dedicated_ue(u8 Mod_id,u8 CH_index,
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id]; PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id];
phy_vars_ue->total_TBS[CH_index]=0;
phy_vars_ue->total_TBS_last[CH_index]=0;
phy_vars_ue->bitrate[CH_index]=0;
phy_vars_ue->total_received_bits[CH_index]=0;
phy_vars_ue->dlsch_errors[CH_index]=0;
phy_vars_ue->dlsch_errors_last[CH_index]=0;
phy_vars_ue->dlsch_received[CH_index]=0;
phy_vars_ue->dlsch_received_last[CH_index]=0;
phy_vars_ue->dlsch_fer[CH_index]=0;
if (physicalConfigDedicated) { if (physicalConfigDedicated) {
......
...@@ -154,10 +154,11 @@ phy_adjust_gain (PHY_VARS_UE *phy_vars_ue, u8 eNB_id) { ...@@ -154,10 +154,11 @@ phy_adjust_gain (PHY_VARS_UE *phy_vars_ue, u8 eNB_id) {
#endif #endif
#ifdef DEBUG_PHY #ifdef DEBUG_PHY
if ((phy_vars_ue->frame%100==0) || (phy_vars_ue->frame < 10)) /* if ((phy_vars_ue->frame%100==0) || (phy_vars_ue->frame < 10))
msg("[PHY][ADJUST_GAIN] frame %d, rx_power = %d, rx_power_fil = %d, rx_power_fil_dB = %d, coef=%d, ncoef=%d, rx_total_gain_dB = %d (%d,%d,%d)\n", msg("[PHY][ADJUST_GAIN] frame %d, rx_power = %d, rx_power_fil = %d, rx_power_fil_dB = %d, coef=%d, ncoef=%d, rx_total_gain_dB = %d (%d,%d,%d)\n",
phy_vars_ue->frame,rx_power,rx_power_fil,rx_power_fil_dB,coef,ncoef,phy_vars_ue->rx_total_gain_dB, phy_vars_ue->frame,rx_power,rx_power_fil,rx_power_fil_dB,coef,ncoef,phy_vars_ue->rx_total_gain_dB,
TARGET_RX_POWER,MAX_RF_GAIN,MIN_RF_GAIN); TARGET_RX_POWER,MAX_RF_GAIN,MIN_RF_GAIN);
*/
#endif //DEBUG_PHY #endif //DEBUG_PHY
} }
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include "PHY/defs.h" #include "PHY/defs.h"
#include "PHY/extern.h" #include "PHY/extern.h"
#include "SCHED/defs.h" #include "SCHED/defs.h"
#include "SIMULATION/TOOLS/defs.h" // for taus
#include <emmintrin.h> #include <emmintrin.h>
#include <xmmintrin.h> #include <xmmintrin.h>
#ifdef __SSE3__ #ifdef __SSE3__
...@@ -2062,9 +2063,10 @@ u8 generate_dci_top(u8 num_ue_spec_dci, ...@@ -2062,9 +2063,10 @@ u8 generate_dci_top(u8 num_ue_spec_dci,
y[1] = &yseq1[0]; y[1] = &yseq1[0];
// reset all bits to <NIL>, here we set <NIL> elements as 2 // reset all bits to <NIL>, here we set <NIL> elements as 2
memset(e, 2, DCI_BITS_MAX); //memset(e, 2, DCI_BITS_MAX);
// here we interpred NIL as a random QPSK sequence. That makes power estimation easier. // here we interpred NIL as a random QPSK sequence. That makes power estimation easier.
//for (i=0;i<DCI_BITS_MAX;i++) e[i]=taus()&1; for (i=0;i<DCI_BITS_MAX;i++)
e[i]=taus()&1;
e_ptr = e; e_ptr = e;
// generate DCIs in order of decreasing aggregation level, then common/ue spec // generate DCIs in order of decreasing aggregation level, then common/ue spec
......
...@@ -2636,7 +2636,7 @@ uint16_t quantize_wideband_pmi(PHY_MEASUREMENTS *meas,uint8_t eNB_id) { ...@@ -2636,7 +2636,7 @@ uint16_t quantize_wideband_pmi(PHY_MEASUREMENTS *meas,uint8_t eNB_id) {
} }
*/ */
uint8_t sinr2cqi(int sinr,uint8_t trans_mode) { uint8_t sinr2cqi(double sinr,uint8_t trans_mode) {
// int flag_LA=0; // int flag_LA=0;
if(flag_LA==0){ if(flag_LA==0){
...@@ -2751,7 +2751,9 @@ void fill_CQI(void *o,UCI_format_t uci_format,PHY_MEASUREMENTS *meas,uint8_t eNB ...@@ -2751,7 +2751,9 @@ void fill_CQI(void *o,UCI_format_t uci_format,PHY_MEASUREMENTS *meas,uint8_t eNB
if(flag_LA==1) if(flag_LA==1)
sinr_tmp = sinr_eff; sinr_tmp = sinr_eff;
else else
sinr_tmp = meas->wideband_cqi_avg[eNB_id]; sinr_tmp = (double) meas->wideband_cqi_avg[eNB_id];
LOG_I(PHY,"Filling CQI %f for eNB %d\n",sinr_tmp,eNB_id);
switch (uci_format) { switch (uci_format) {
case wideband_cqi_rank1_2A: case wideband_cqi_rank1_2A:
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include "PHY/CODING/lte_interleaver_inline.h" #include "PHY/CODING/lte_interleaver_inline.h"
#include "PHY/LTE_TRANSPORT/defs.h" #include "PHY/LTE_TRANSPORT/defs.h"
#include "defs.h" #include "defs.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
//#define DEBUG_DLSCH_CODING //#define DEBUG_DLSCH_CODING
//#define DEBUG_DLSCH_FREE 1 //#define DEBUG_DLSCH_FREE 1
...@@ -74,11 +75,12 @@ void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch) { ...@@ -74,11 +75,12 @@ void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch) {
msg("Freeing dlsch process %d (%p)\n",i,dlsch->harq_processes[i]); msg("Freeing dlsch process %d (%p)\n",i,dlsch->harq_processes[i]);
#endif #endif
if (dlsch->harq_processes[i]->b) { if (dlsch->harq_processes[i]->b) {
free16(dlsch->harq_processes[i]->b,MAX_DLSCH_PAYLOAD_BYTES); free16(dlsch->harq_processes[i]->b,MAX_DLSCH_PAYLOAD_BYTES);
dlsch->harq_processes[i]->b = NULL;
#ifdef DEBUG_DLSCH_FREE #ifdef DEBUG_DLSCH_FREE
msg("Freeing dlsch process %d b (%p)\n",i,dlsch->harq_processes[i]->b); msg("Freeing dlsch process %d b (%p)\n",i,dlsch->harq_processes[i]->b);
#endif #endif
} }
if (dlsch->harq_processes[i]->c) { if (dlsch->harq_processes[i]->c) {
#ifdef DEBUG_DLSCH_FREE #ifdef DEBUG_DLSCH_FREE
msg("Freeing dlsch process %d c (%p)\n",i,dlsch->harq_processes[i]->c); msg("Freeing dlsch process %d c (%p)\n",i,dlsch->harq_processes[i]->c);
...@@ -88,14 +90,18 @@ void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch) { ...@@ -88,14 +90,18 @@ void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch) {
#ifdef DEBUG_DLSCH_FREE #ifdef DEBUG_DLSCH_FREE
msg("Freeing dlsch process %d c[%d] (%p)\n",i,r,dlsch->harq_processes[i]->c[r]); msg("Freeing dlsch process %d c[%d] (%p)\n",i,r,dlsch->harq_processes[i]->c[r]);
#endif #endif
if (dlsch->harq_processes[i]->c[r]) if (dlsch->harq_processes[i]->c[r]) {
free16(dlsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+768); free16(dlsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+768);
dlsch->harq_processes[i]->c[r] = NULL;
}
} }
} }
free16(dlsch->harq_processes[i],sizeof(LTE_DL_eNB_HARQ_t)); free16(dlsch->harq_processes[i],sizeof(LTE_DL_eNB_HARQ_t));
dlsch->harq_processes[i] = NULL;
} }
} }
free16(dlsch,sizeof(LTE_eNB_DLSCH_t)); free16(dlsch,sizeof(LTE_eNB_DLSCH_t));
dlsch = NULL;
} }
} }
...@@ -137,7 +143,10 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,unsigne ...@@ -137,7 +143,10 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,unsigne
bzero(dlsch->harq_processes[i],sizeof(LTE_DL_eNB_HARQ_t)); bzero(dlsch->harq_processes[i],sizeof(LTE_DL_eNB_HARQ_t));
// dlsch->harq_processes[i]->first_tx=1; // 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) { if (dlsch->harq_processes[i]->b) {
bzero(dlsch->harq_processes[i]->b,MAX_DLSCH_PAYLOAD_BYTES/bw_scaling);
}
else {
msg("Can't get b\n"); msg("Can't get b\n");
exit_flag=1; exit_flag=1;
} }
...@@ -145,7 +154,10 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,unsigne ...@@ -145,7 +154,10 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,unsigne
for (r=0;r<MAX_NUM_DLSCH_SEGMENTS/bw_scaling;r++) { for (r=0;r<MAX_NUM_DLSCH_SEGMENTS/bw_scaling;r++) {
// account for filler in first segment and CRCs for multiple segment case // account for filler in first segment and CRCs for multiple segment case
dlsch->harq_processes[i]->c[r] = (unsigned char*)malloc16(((r==0)?8:0) + 3+ 768); dlsch->harq_processes[i]->c[r] = (unsigned char*)malloc16(((r==0)?8:0) + 3+ 768);
if (!dlsch->harq_processes[i]->c[r]) { if (dlsch->harq_processes[i]->c[r]) {
bzero(dlsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+ 768);
}
else {
msg("Can't get c\n"); msg("Can't get c\n");
exit_flag=2; exit_flag=2;
} }
...@@ -169,7 +181,8 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,unsigne ...@@ -169,7 +181,8 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,unsigne
return(dlsch); return(dlsch);
} }
} }
msg("new_eNB_dlsch exit flag %d, size of %zd\n", exit_flag, sizeof(LTE_eNB_DLSCH_t)); LOG_D(PHY, "new_eNB_dlsch exit flag %d, size of %ld\n",
exit_flag, sizeof(LTE_eNB_DLSCH_t));
free_eNB_dlsch(dlsch); free_eNB_dlsch(dlsch);
return(NULL); return(NULL);
...@@ -224,6 +237,8 @@ int dlsch_encoding(unsigned char *a, ...@@ -224,6 +237,8 @@ int dlsch_encoding(unsigned char *a,
unsigned int Kr=0,Kr_bytes,r,r_offset=0; unsigned int Kr=0,Kr_bytes,r,r_offset=0;
unsigned short m=dlsch->harq_processes[harq_pid]->mcs; 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 A = dlsch->harq_processes[harq_pid]->TBS; //6228
// printf("Encoder: A: %d\n",A); // printf("Encoder: A: %d\n",A);
mod_order = get_Qm(dlsch->harq_processes[harq_pid]->mcs); mod_order = get_Qm(dlsch->harq_processes[harq_pid]->mcs);
...@@ -355,6 +370,8 @@ int dlsch_encoding(unsigned char *a, ...@@ -355,6 +370,8 @@ int dlsch_encoding(unsigned char *a,
write_output("enc_output.m","enc",dlsch->e,r_offset,1,4); write_output("enc_output.m","enc",dlsch->e,r_offset,1,4);
#endif #endif
} }
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
return(0); return(0);
} }
......
...@@ -495,34 +495,14 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, ...@@ -495,34 +495,14 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
} }
} }
} }
//printf("sinr_eff1 = %f\n",sinr_eff); LOG_D(OCM,"sinr_eff (lin, unweighted) = %f\n",sinr_eff);
sinr_eff = -beta2_dlsch[TM][mcs]*log((sinr_eff)/(12*rb_count)); sinr_eff = -beta2_dlsch[TM][mcs]*log((sinr_eff)/(12*rb_count));
LOG_D(OCM,"sinr_eff (lin, weighted) = %f\n",sinr_eff);
sinr_eff = 10 * log10(sinr_eff); sinr_eff = 10 * log10(sinr_eff);
LOG_I(OCM,"sinr_eff2 = %f\n",sinr_eff); LOG_D(OCM,"sinr_eff (dB) = %f\n",sinr_eff);
// table lookup bler = interp(sinr_eff,&sinr_bler_map[mcs][0][0],&sinr_bler_map[mcs][1][0],table_length[mcs]);
sinr_eff *= 10;
sinr_eff = floor(sinr_eff);
// if ((int)sinr_eff%2) {
// sinr_eff += 1;
// }
sinr_eff /= 10;
msg("Imran sinr_eff after rounding = %f\n",sinr_eff);
for (index = 0; index < table_length[mcs]; index++) {
if(index == 0) {
if (sinr_eff < sinr_bler_map[mcs][0][index]) {
bler = 1;
break;
}
else if(sinr_eff > sinr_bler_map[mcs][0][table_length[mcs]]){
bler = 0;
break;
}
}
if (sinr_eff == sinr_bler_map[mcs][0][index]) {
bler = sinr_bler_map[mcs][1][index];
}
}
#ifdef USER_MODE // need to be adapted for the emulation in the kernel space #ifdef USER_MODE // need to be adapted for the emulation in the kernel space
if (uniformrandom() < bler) { if (uniformrandom() < bler) {
LOG_I(OCM,"abstraction_decoding failed (mcs=%d, sinr_eff=%f, bler=%f)\n",mcs,sinr_eff,bler); LOG_I(OCM,"abstraction_decoding failed (mcs=%d, sinr_eff=%f, bler=%f)\n",mcs,sinr_eff,bler);
...@@ -591,56 +571,34 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, ...@@ -591,56 +571,34 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
} }
} }
// averaging of accumulated MI // averaging of accumulated MI
I = I/(12*rb_count); I = I/(12*rb_count);
//Now I->SINR_effective Mapping //Now I->SINR_effective Mapping
if(mcs<10) if(mcs<10)
{ {
sinr_eff = (p_qpsk[0]*pow(I,7) + p_qpsk[1]*pow(I,6) + p_qpsk[2]*pow(I,5) + p_qpsk[3]*pow(I,4) + p_qpsk[4]*pow(I,3) + p_qpsk[5]*pow(I,2) + p_qpsk[6]*I + p_qpsk[7]); sinr_eff = (p_qpsk[0]*pow(I,7) + p_qpsk[1]*pow(I,6) + p_qpsk[2]*pow(I,5) + p_qpsk[3]*pow(I,4) + p_qpsk[4]*pow(I,3) + p_qpsk[5]*pow(I,2) + p_qpsk[6]*I + p_qpsk[7]);
}
else if(mcs>9 && mcs<17)
{
sinr_eff = (p_qam16[0]*pow(I,7) + p_qam16[1]*pow(I,6) + p_qam16[2]*pow(I,5) + p_qam16[3]*pow(I,4) + p_qam16[4]*pow(I,3) + p_qam16[5]*pow(I,2) + p_qam16[6]*I + p_qam16[7]);
}
else if(mcs>16 && mcs<23)
{
sinr_eff = (p_qam64[0]*pow(I,7) + p_qam64[1]*pow(I,6) + p_qam64[2]*pow(I,5) + p_qam64[3]*pow(I,4) + p_qam64[4]*pow(I,3) + p_qam64[5]*pow(I,2) + p_qam64[6]*I + p_qam64[7]);
}
sinr_eff = sinr_eff + 10*log10(beta2_dlsch_MI[TM][mcs]);
msg("SINR_Eff = %e\n",sinr_eff);
sinr_eff *= 10;
sinr_eff = floor(sinr_eff);
// if ((int)sinr_eff%2) {
// sinr_eff += 1;
// }
sinr_eff /= 10;
msg("sinr_eff after rounding = %f\n",sinr_eff);
for (index = 0; index < table_length[mcs]; index++) {
if(index == 0) {
if (sinr_eff < sinr_bler_map[mcs][0][index]) {
bler = 1;
break;
}
else if(sinr_eff > sinr_bler_map[mcs][0][table_length[mcs]]){
bler = 0;
break;
}
} }
if (sinr_eff == sinr_bler_map[mcs][0][index]) { else if(mcs>9 && mcs<17)
bler = sinr_bler_map[mcs][1][index]; {
sinr_eff = (p_qam16[0]*pow(I,7) + p_qam16[1]*pow(I,6) + p_qam16[2]*pow(I,5) + p_qam16[3]*pow(I,4) + p_qam16[4]*pow(I,3) + p_qam16[5]*pow(I,2) + p_qam16[6]*I + p_qam16[7]);
} }
} else if(mcs>16 && mcs<23)
{
sinr_eff = (p_qam64[0]*pow(I,7) + p_qam64[1]*pow(I,6) + p_qam64[2]*pow(I,5) + p_qam64[3]*pow(I,4) + p_qam64[4]*pow(I,3) + p_qam64[5]*pow(I,2) + p_qam64[6]*I + p_qam64[7]);
}
//sinr_eff = sinr_eff + 10*log10(beta2_dlsch_MI[TM][mcs]);
LOG_D(OCM,"SINR_Eff = %e\n",sinr_eff);
bler = interp(sinr_eff,&sinr_bler_map[mcs][0][0],&sinr_bler_map[mcs][1][0],table_length[mcs]);
#ifdef USER_MODE // need to be adapted for the emulation in the kernel space #ifdef USER_MODE // need to be adapted for the emulation in the kernel space
if (uniformrandom() < bler) { if (uniformrandom() < bler) {
msg("abstraction_decoding failed (mcs=%d, sinr_eff=%f, bler=%f)\n",mcs,sinr_eff,bler); LOG_I(OCM,"abstraction_decoding failed (mcs=%d, sinr_eff=%f, bler=%f)\n",mcs,sinr_eff,bler);
return(0); return(0);
} }
else { else {
msg("abstraction_decoding successful (mcs=%d, sinr_eff=%f, bler=%f)\n",mcs,sinr_eff,bler); LOG_I(OCM,"abstraction_decoding successful (mcs=%d, sinr_eff=%f, bler=%f)\n",mcs,sinr_eff,bler);
return(1); return(1);
} }
#endif #endif
...@@ -660,7 +618,7 @@ uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue, ...@@ -660,7 +618,7 @@ uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue,
u16 i; u16 i;
#endif #endif
// may not be necessaru for PMCH?? // may not be necessary for PMCH??
for (eNB_id2=0;eNB_id2<NB_eNB_INST;eNB_id2++) { for (eNB_id2=0;eNB_id2<NB_eNB_INST;eNB_id2++) {
if (PHY_vars_eNB_g[eNB_id2]->lte_frame_parms.Nid_cell == phy_vars_ue->lte_frame_parms.Nid_cell) if (PHY_vars_eNB_g[eNB_id2]->lte_frame_parms.Nid_cell == phy_vars_ue->lte_frame_parms.Nid_cell)
break; break;
......
...@@ -50,6 +50,10 @@ ...@@ -50,6 +50,10 @@
#include "extern.h" #include "extern.h"
#include "PHY/extern.h" #include "PHY/extern.h"
#ifdef PHY_ABSTRACTION
#include "SIMULATION/TOOLS/defs.h"
#endif
#ifndef __SSE3__ #ifndef __SSE3__
extern __m128i zero; extern __m128i zero;
#define _mm_abs_epi16(xmmx) _mm_xor_si128((xmmx),_mm_cmpgt_epi16(zero,(xmmx))) #define _mm_abs_epi16(xmmx) _mm_xor_si128((xmmx),_mm_cmpgt_epi16(zero,(xmmx)))
...@@ -900,21 +904,34 @@ u16 rx_pbch(LTE_UE_COMMON *lte_ue_common_vars, ...@@ -900,21 +904,34 @@ u16 rx_pbch(LTE_UE_COMMON *lte_ue_common_vars,
} }
#ifdef PHY_ABSTRACTION
u16 rx_pbch_emul(PHY_VARS_UE *phy_vars_ue, u16 rx_pbch_emul(PHY_VARS_UE *phy_vars_ue,
u8 eNB_id, u8 eNB_id,
u8 pbch_phase) { u8 pbch_phase) {
u8 pbch_error=0; double bler=0.0, x=0.0;
double sinr=0.0;
LOG_D(PHY,"EMUL UE rx_pbch_emul: eNB_id %d, pbch_phase %d\n",eNB_id,pbch_phase); u16 nb_rb = phy_vars_ue->lte_frame_parms.N_RB_DL;
s16 f;
// compute effective sinr
// TODO: adapt this to varible bandwidth
for (f=(nb_rb*6-3*12);f<(nb_rb*6+3*12);f++) {
if (f!=0) //skip DC
sinr += pow(10, 0.1*(phy_vars_ue->sinr_dB[f]));
}
sinr = 10*log10(sinr/(6*12));
bler = pbch_bler(sinr);
LOG_D(PHY,"EMUL UE rx_pbch_emul: eNB_id %d, pbch_phase %d, sinr %f dB, bler %f \n",
eNB_id,
pbch_phase,
sinr,
bler);
if (pbch_phase == (phy_vars_ue->frame % 4)) { if (pbch_phase == (phy_vars_ue->frame % 4)) {
if (uniformrandom() >= bler) {
// abtract pbch error here
// pbch_error = pbch_abstraction();
if (pbch_error == 0) {
memcpy(phy_vars_ue->lte_ue_pbch_vars[eNB_id]->decoded_output,PHY_vars_eNB_g[eNB_id]->pbch_pdu,PBCH_PDU_SIZE); memcpy(phy_vars_ue->lte_ue_pbch_vars[eNB_id]->decoded_output,PHY_vars_eNB_g[eNB_id]->pbch_pdu,PBCH_PDU_SIZE);
return(PHY_vars_eNB_g[eNB_id]->lte_frame_parms.nb_antennas_tx_eNB); return(PHY_vars_eNB_g[eNB_id]->lte_frame_parms.nb_antennas_tx_eNB);
} }
...@@ -924,3 +941,4 @@ u16 rx_pbch_emul(PHY_VARS_UE *phy_vars_ue, ...@@ -924,3 +941,4 @@ u16 rx_pbch_emul(PHY_VARS_UE *phy_vars_ue,
else else
return(-1); return(-1);
} }
#endif
...@@ -827,6 +827,8 @@ void rx_prach(PHY_VARS_eNB *phy_vars_eNB,u8 subframe,u16 *preamble_energy_list, ...@@ -827,6 +827,8 @@ void rx_prach(PHY_VARS_eNB *phy_vars_eNB,u8 subframe,u16 *preamble_energy_list,
NCS = NCS_restricted[Ncs_config]; NCS = NCS_restricted[Ncs_config];
} }
start_meas(&phy_vars_eNB->rx_prach);
n_ra_prb = n_ra_prboffset; n_ra_prb = n_ra_prboffset;
prach_root_sequence_map = (prach_fmt < 4) ? prach_root_sequence_map0_3 : prach_root_sequence_map4; prach_root_sequence_map = (prach_fmt < 4) ? prach_root_sequence_map0_3 : prach_root_sequence_map4;
...@@ -1133,6 +1135,8 @@ void rx_prach(PHY_VARS_eNB *phy_vars_eNB,u8 subframe,u16 *preamble_energy_list, ...@@ -1133,6 +1135,8 @@ void rx_prach(PHY_VARS_eNB *phy_vars_eNB,u8 subframe,u16 *preamble_energy_list,
#endif #endif
// exit(-1); // exit(-1);
}// preamble_index }// preamble_index
stop_meas(&phy_vars_eNB->rx_prach);
} }
void init_prach_tables(int N_ZC) { void init_prach_tables(int N_ZC) {
......
...@@ -119,6 +119,7 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t ...@@ -119,6 +119,7 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
len += sprintf(&buffer[len], "[UE PROC] RX total power eNB%d: %d dB, avg: %d dB\n",eNB,phy_vars_ue->PHY_measurements.rx_power_tot_dB[eNB],phy_vars_ue->PHY_measurements.rx_power_avg_dB[eNB]); len += sprintf(&buffer[len], "[UE PROC] RX total power eNB%d: %d dB, avg: %d dB\n",eNB,phy_vars_ue->PHY_measurements.rx_power_tot_dB[eNB],phy_vars_ue->PHY_measurements.rx_power_avg_dB[eNB]);
len += sprintf(&buffer[len], "[UE PROC] RX total power lin: %d, avg: %d, RX total noise lin: %d, avg: %d\n",phy_vars_ue->PHY_measurements.rx_power_tot[eNB], phy_vars_ue->PHY_measurements.rx_power_avg[eNB], phy_vars_ue->PHY_measurements.n0_power_tot, phy_vars_ue->PHY_measurements.n0_power_avg); len += sprintf(&buffer[len], "[UE PROC] RX total power lin: %d, avg: %d, RX total noise lin: %d, avg: %d\n",phy_vars_ue->PHY_measurements.rx_power_tot[eNB], phy_vars_ue->PHY_measurements.rx_power_avg[eNB], phy_vars_ue->PHY_measurements.n0_power_tot, phy_vars_ue->PHY_measurements.n0_power_avg);
len += sprintf(&buffer[len], "[UE PROC] effective SINR %.2f dB\n",phy_vars_ue->sinr_eff);
len += sprintf(&buffer[len], "[UE PROC] Wideband CQI eNB %d: %d dB, avg: %d dB\n",eNB,phy_vars_ue->PHY_measurements.wideband_cqi_tot[eNB],phy_vars_ue->PHY_measurements.wideband_cqi_avg[eNB]); len += sprintf(&buffer[len], "[UE PROC] Wideband CQI eNB %d: %d dB, avg: %d dB\n",eNB,phy_vars_ue->PHY_measurements.wideband_cqi_tot[eNB],phy_vars_ue->PHY_measurements.wideband_cqi_avg[eNB]);
len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 0): [%d %d %d %d %d %d %d] dB\n", len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 0): [%d %d %d %d %d %d %d] dB\n",
...@@ -195,6 +196,7 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t ...@@ -195,6 +196,7 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
RRC_status = mac_get_rrc_status(phy_vars_ue->Mod_id,0,0); RRC_status = mac_get_rrc_status(phy_vars_ue->Mod_id,0,0);
len += sprintf(&buffer[len],"[UE PROC] RRC status = %d\n",RRC_status); len += sprintf(&buffer[len],"[UE PROC] RRC status = %d\n",RRC_status);
#endif #endif
len += sprintf(&buffer[len],"[UE PROC] RSRP[0] %d, RSSI %d, RSRQ[0] %d\n",phy_vars_ue->PHY_measurements.rsrp[0], phy_vars_ue->PHY_measurements.rssi, phy_vars_ue->PHY_measurements.rsrq[0]);
len += sprintf(&buffer[len], "[UE PROC] Transmission Mode %d (mode1_flag %d)\n",phy_vars_ue->transmission_mode[eNB],phy_vars_ue->lte_frame_parms.mode1_flag); len += sprintf(&buffer[len], "[UE PROC] Transmission Mode %d (mode1_flag %d)\n",phy_vars_ue->transmission_mode[eNB],phy_vars_ue->lte_frame_parms.mode1_flag);
if (phy_vars_ue->transmission_mode[eNB] == 6) if (phy_vars_ue->transmission_mode[eNB] == 6)
...@@ -252,8 +254,7 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t ...@@ -252,8 +254,7 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
} }
len += sprintf(&buffer[len],"EOF\n"); len += sprintf(&buffer[len],"EOF\n");
/* SR: for trailing '\0' */ len += sprintf(&buffer[len],"\0");
len ++;
return len; return len;
} // is_clusterhead } // is_clusterhead
...@@ -479,8 +480,7 @@ int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) { ...@@ -479,8 +480,7 @@ int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) {
len += sprintf(&buffer[len],"\n"); len += sprintf(&buffer[len],"\n");
} }
len += sprintf(&buffer[len],"EOF\n"); len += sprintf(&buffer[len],"EOF\n");
/* SR: for trailing '\0' */ len += sprintf(&buffer[len],"\0");
len++;
return len; return len;
} }
...@@ -247,12 +247,14 @@ u32 ulsch_encoding(u8 *a, ...@@ -247,12 +247,14 @@ u32 ulsch_encoding(u8 *a,
// fill CQI/PMI information // fill CQI/PMI information
if (ulsch->O>0) { if (ulsch->O>0) {
/* //not correctly done
if (flag_LA==1) if (flag_LA==1)
sinr_eff = sinr_eff_cqi_calc(phy_vars_ue, 0); //eNB_id is missing here sinr_eff = sinr_eff_cqi_calc(phy_vars_ue, 0); //eNB_id is missing here
else else
sinr_eff = 0; sinr_eff = 0;
*/
rnti = phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti; rnti = phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti;
fill_CQI(ulsch->o,ulsch->uci_format,meas,0,rnti, tmode,sinr_eff); fill_CQI(ulsch->o,ulsch->uci_format,meas,0,rnti, tmode,phy_vars_ue->sinr_eff);
LOG_D(PHY,"UE CQI\n"); LOG_D(PHY,"UE CQI\n");
print_CQI(<