Commit f364d13d authored by Cedric Roux's avatar Cedric Roux

Merge branch 'develop_integration_w24' into 'develop'

develop_integration_w24 into develop

Summary or changes:
- work on transmission mode 3 and 4

See merge request !204
parents 7580d021 85ac4e46
......@@ -941,9 +941,14 @@
(Test 7b, 5 MHz, R3-1.FDD (MCS 15), ETU70, 1.4 dB (30%)),
(Test 10, 5 MHz, R6.FDD (MCS 25), EVA5, 17.4 dB (70%)),
(Test 10b, 5 MHz, R6-1.FDD (MCS 24,18 PRB), EVA5, 17.5dB (70%)),
(Test 11, 10 MHz, R7.FDD (MCS 25), EVA5, 17.7dB (70%))
(Test 11, 10 MHz, R7.FDD (MCS 25), EVA5, 17.7dB (70%)),
(Test 11b, 10 MHz, R7-1.FDD (MCS 25), EVA5, 16.7dB (70%)),
(Test 15, 20 MHz, R.9 FDD (MCS 26), EVA5, 17.6dB (70%)),
(Test 15b, 20 MHz, R.9-2 FDD (MCS 26, 17PRB), EVA5, 17.3dB (70%)),
(Test 15c, 20 MHz, R.9-1 FDD (MCS 26, 83 PRB), EVA5, 16.6dB (70%)),
(TM2 Test 1 10 MHz, R.11 FDD (MCS 14), EVA5, 6.8 dB (70%)),
(TM2 Test 1b 20 MHz, R.11-2 FDD (MCS 13), EVA5, 5.9 dB (70%)),
(TM2 Test 1b 5 MHz, R.11-2 FDD (MCS 13), EVA5, 5.9 dB (70%)),
</desc>
<pre_compile_prog></pre_compile_prog>
<compile_prog>$OPENAIR_DIR/cmake_targets/build_oai</compile_prog>
......@@ -960,6 +965,9 @@
-m25 -gF -s17.4 -w1.0 -f.2 -n500 -B25 -c3 -z2 -O70
-m25 -gF -s17.5 -w1.0 -f.2 -n500 -B25 -c3 -z2 -r1022 -O70
-m26 -gF -s17.7 -w1.0 -f.2 -n500 -B50 -c2 -z2 -O70
-m26 -gF -s17.6 -w1.0 -f.2 -n500 -B100 -c2 -z2 -O70
-m26 -gF -s17.3 -w1.0 -f.2 -n500 -B100 -c2 -z2 -r1600 -O70
-m26 -gF -s16.6 -w1.0 -f.2 -n500 -B100 -c2 -z2 -r1899 -O70
-m14 -gF -s6.8 -w1.0 -f.2 -n500 -B50 -c2 -x2 -y2 -z2 -O70
-m13 -gF -s5.9 -w1.0 -f.2 -n500 -B25 -c3 -x2 -y2 -z2 -O70</main_exec_args>
<tags>dlsim.test1 dlsim.test5 dlsim.test6 dlsim.test6b dlsim.test7 dlsim.test7b dlsim.test10 dlsim.test10b dlsim.test11 dlsim.TM2_test1 dlsim.TM2_test1b</tags>
......
......@@ -3,7 +3,7 @@ set(PACKAGE_NAME "unitary_tests_simulators")
set(PHYSIM True)
set(RF_BOARD None)
set(XFORMS True)
set(ENABLE_ITTI False)
set(DEBUG_PHY False)
set(MU_RECIEVER False)
set(RANDOM_BF False)
......
......@@ -58,7 +58,7 @@ filter/filter.a:
$(CC) $(CFLAGS) -c -o $@ $<
clean:
rm -f *.o core tracer_remote textlog enb vcd record replay
rm -f *.o core tracer_remote textlog enb ue vcd record replay
rm -f extract_config macpdu2wireshark
cd gui && make clean
cd view && make clean
......
......@@ -161,7 +161,7 @@ int lte_est_freq_offset(int **dl_ch_estimates,
LTE_DL_FRAME_PARMS *frame_parms,
int l,
int* freq_offset,
int reset);
int reset);
int lte_mbsfn_est_freq_offset(int **dl_ch_estimates,
LTE_DL_FRAME_PARMS *frame_parms,
......@@ -180,7 +180,7 @@ This function computes the time domain channel response, finds the peak and adju
void lte_adjust_synch(LTE_DL_FRAME_PARMS *frame_parms,
PHY_VARS_UE *phy_vars_ue,
module_id_t eNb_id,
uint8_t subframe,
uint8_t subframe,
unsigned char clear,
short coef);
......@@ -189,7 +189,8 @@ void lte_ue_measurements(PHY_VARS_UE *phy_vars_ue,
unsigned int subframe_offset,
unsigned char N0_symbol,
unsigned char abstraction_flag,
uint8_t subframe);
unsigned char rank_adaptation,
uint8_t subframe);
//! \brief This function performance RSRP/RSCP measurements
void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue,
......@@ -214,11 +215,11 @@ int8_t set_RSRQ_filtered(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,floa
//! Automatic gain control
void phy_adjust_gain (PHY_VARS_UE *phy_vars_ue,
uint32_t rx_power_fil_dB,
uint32_t rx_power_fil_dB,
unsigned char eNB_id);
int lte_ul_channel_estimation(PHY_VARS_eNB *phy_vars_eNB,
eNB_rxtx_proc_t *proc,
eNB_rxtx_proc_t *proc,
module_id_t eNB_id,
module_id_t UE_id,
uint8_t l,
......@@ -246,7 +247,7 @@ int lte_est_timing_advance(LTE_DL_FRAME_PARMS *frame_parms,
int lte_est_timing_advance_pusch(PHY_VARS_eNB* phy_vars_eNB,module_id_t UE_id);
void lte_eNB_I0_measurements(PHY_VARS_eNB *phy_vars_eNB,
int subframe,
int subframe,
module_id_t eNB_id,
unsigned char clear);
......
......@@ -34,6 +34,9 @@
//#define DEBUG_MEAS_RRC
//#define DEBUG_MEAS_UE
//#define DEBUG_RANK_EST
int16_t cond_num_threshold = 0;
#ifdef USER_MODE
void print_shorts(char *s,short *x)
......@@ -207,8 +210,8 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
if(ue->frame_parms.frame_type == FDD)
{
rxF_sss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].rxdataF[aarx][(5*ue->frame_parms.ofdm_symbol_size)];
rxF_pss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].rxdataF[aarx][(6*ue->frame_parms.ofdm_symbol_size)];
rxF_sss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].rxdataF[aarx][(5*ue->frame_parms.ofdm_symbol_size)];
rxF_pss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].rxdataF[aarx][(6*ue->frame_parms.ofdm_symbol_size)];
}
else
{
......@@ -218,17 +221,17 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
//-ve spectrum from SSS
//+ve spectrum from SSS
ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+70]*rxF_sss[2+70])+((int32_t)rxF_sss[2+69]*rxF_sss[2+69]));
ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+70]*rxF_sss[2+70])+((int32_t)rxF_sss[2+69]*rxF_sss[2+69]));
ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+68]*rxF_sss[2+68])+((int32_t)rxF_sss[2+67]*rxF_sss[2+67]));
ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+66]*rxF_sss[2+66])+((int32_t)rxF_sss[2+65]*rxF_sss[2+65]));
// ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+64]*rxF_sss[2+64])+((int32_t)rxF_sss[2+63]*rxF_sss[2+63]));
// printf("sssp32 %d\n",ue->measurements.n0_power[aarx]);
// ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[2+64]*rxF_sss[2+64])+((int32_t)rxF_sss[2+63]*rxF_sss[2+63]));
// printf("sssp32 %d\n",ue->measurements.n0_power[aarx]);
//+ve spectrum from PSS
ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[2+70]*rxF_pss[2+70])+((int32_t)rxF_pss[2+69]*rxF_pss[2+69]));
ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[2+68]*rxF_pss[2+68])+((int32_t)rxF_pss[2+67]*rxF_pss[2+67]));
ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[2+66]*rxF_pss[2+66])+((int32_t)rxF_pss[2+65]*rxF_pss[2+65]));
// ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[2+64]*rxF_pss[2+64])+((int32_t)rxF_pss[2+63]*rxF_pss[2+63]));
// printf("pss32 %d\n",ue->measurements.n0_power[aarx]); //-ve spectrum from PSS
// ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[2+64]*rxF_pss[2+64])+((int32_t)rxF_pss[2+63]*rxF_pss[2+63]));
// printf("pss32 %d\n",ue->measurements.n0_power[aarx]); //-ve spectrum from PSS
if(ue->frame_parms.frame_type == FDD)
{
rxF_sss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].rxdataF[aarx][(6*ue->frame_parms.ofdm_symbol_size)];
......@@ -239,29 +242,29 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
rxF_sss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[(subframe+1)&0x1].rxdataF[aarx][(14*ue->frame_parms.ofdm_symbol_size)];
rxF_pss = (int16_t *)&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].rxdataF[aarx][(3*ue->frame_parms.ofdm_symbol_size)];
}
// ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-72]*rxF_pss[-72])+((int32_t)rxF_pss[-71]*rxF_pss[-71]));
// printf("pssm36 %d\n",ue->measurements.n0_power[aarx]);
// ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-72]*rxF_pss[-72])+((int32_t)rxF_pss[-71]*rxF_pss[-71]));
// printf("pssm36 %d\n",ue->measurements.n0_power[aarx]);
ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-70]*rxF_pss[-70])+((int32_t)rxF_pss[-69]*rxF_pss[-69]));
ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-68]*rxF_pss[-68])+((int32_t)rxF_pss[-67]*rxF_pss[-67]));
ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-66]*rxF_pss[-66])+((int32_t)rxF_pss[-65]*rxF_pss[-65]));
ue->measurements.n0_power[aarx] = (((int32_t)rxF_sss[-70]*rxF_sss[-70])+((int32_t)rxF_sss[-69]*rxF_sss[-69]));
ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[-68]*rxF_sss[-68])+((int32_t)rxF_sss[-67]*rxF_sss[-67]));
ue->measurements.n0_power[aarx] += (((int32_t)rxF_sss[-66]*rxF_sss[-66])+((int32_t)rxF_sss[-65]*rxF_sss[-65]));
// ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-64]*rxF_pss[-64])+((int32_t)rxF_pss[-63]*rxF_pss[-63]));
// printf("pssm32 %d\n",ue->measurements.n0_power[aarx]);
// ue->measurements.n0_power[aarx] += (((int32_t)rxF_pss[-64]*rxF_pss[-64])+((int32_t)rxF_pss[-63]*rxF_pss[-63]));
// printf("pssm32 %d\n",ue->measurements.n0_power[aarx]);
ue->measurements.n0_power_dB[aarx] = (unsigned short) dB_fixed(ue->measurements.n0_power[aarx]/12);
ue->measurements.n0_power_tot /*+=*/ = ue->measurements.n0_power[aarx];
}
}
//LOG_I(PHY,"Subframe %d RRC UE MEAS Noise Level %d \n", subframe, ue->measurements.n0_power_tot);
ue->measurements.n0_power_tot_dB = (unsigned short) dB_fixed(ue->measurements.n0_power_tot/(12*aarx));
ue->measurements.n0_power_tot_dBm = ue->measurements.n0_power_tot_dB - ue->rx_total_gain_dB - dB_fixed(ue->frame_parms.ofdm_symbol_size);
} else {
ue->measurements.n0_power_tot_dB = (unsigned short) dB_fixed(ue->measurements.n0_power_tot/(12*aarx));
ue->measurements.n0_power_tot_dBm = ue->measurements.n0_power_tot_dB - ue->rx_total_gain_dB - dB_fixed(ue->frame_parms.ofdm_symbol_size);
} else {
LOG_E(PHY, "Not yet implemented: noise power calculation when prefix length = EXTENDED\n");
}
}
}
else if ((ue->frame_parms.frame_type == TDD) &&
((subframe == 1) || (subframe == 6))) { // TDD PSS/SSS, compute noise in DTX REs // 2016-09-29 wilson fix incorrect noise power calculation
......@@ -310,12 +313,11 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
// printf("pssm32 %d\n",ue->measurements.n0_power[aarx]);
ue->measurements.n0_power_dB[aarx] = (unsigned short) dB_fixed(ue->measurements.n0_power[aarx]/12);
ue->measurements.n0_power_tot /*+=*/ = ue->measurements.n0_power[aarx];
}
}
ue->measurements.n0_power_tot_dB = (unsigned short) dB_fixed(ue->measurements.n0_power_tot/(12*aarx));
ue->measurements.n0_power_tot_dBm = ue->measurements.n0_power_tot_dB - ue->rx_total_gain_dB - dB_fixed(ue->frame_parms.ofdm_symbol_size);
//LOG_I(PHY,"Subframe %d RRC UE MEAS Noise Level %d \n", subframe, ue->measurements.n0_power_tot);
}
......@@ -357,8 +359,8 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
ue->measurements.rsrp[eNB_offset] += (((int32_t)(rxF[off])*rxF[off])+((int32_t)(rxF[off+1])*rxF[off+1]));
// printf("rb %d, off %d : %d\n",rb,off,((((int32_t)rxF[off])*rxF[off])+((int32_t)(rxF[off+1])*rxF[off+1])));
// if ((ue->frame_rx&0x3ff) == 0)
// printf("rb %d, off %d : %d\n",rb,off,((rxF[off]*rxF[off])+(rxF[off+1]*rxF[off+1])));
// if ((ue->frame_rx&0x3ff) == 0)
// printf("rb %d, off %d : %d\n",rb,off,((rxF[off]*rxF[off])+(rxF[off+1]*rxF[off+1])));
off+=12;
......@@ -424,7 +426,7 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
// if (slot == 0) {
if (eNB_offset == 0)
LOG_I(PHY,"[UE %d] Frame %d, subframe %d RRC Measurements => rssi %3.1f dBm (digital: %3.1f dB, gain %d), N0 %d dBm\n",ue->Mod_id,
LOG_I(PHY,"[UE %d] Frame %d, subframe %d RRC Measurements => rssi %3.1f dBm (digital: %3.1f dB, gain %d), N0 %d dBm\n",ue->Mod_id,
ue->proc.proc_rxtx[subframe&1].frame_rx,subframe,10*log10(ue->measurements.rssi)-ue->rx_total_gain_dB,
10*log10(ue->measurements.rssi),
ue->rx_total_gain_dB,
......@@ -454,7 +456,8 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
unsigned int subframe_offset,
unsigned char N0_symbol,
unsigned char abstraction_flag,
uint8_t subframe)
unsigned char rank_adaptation,
uint8_t subframe)
{
......@@ -468,17 +471,17 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
int16x8_t *dl_ch0_128, *dl_ch1_128;
#endif
int *dl_ch0,*dl_ch1;
LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
int nb_subbands,subband_size,last_subband_size;
int N_RB_DL = frame_parms->N_RB_DL;
int rank_tm3_tm4;
ue->measurements.nb_antennas_rx = frame_parms->nb_antennas_rx;
if (ue->transmission_mode[eNB_id]!=4)
ue->measurements.rank[eNB_id] = 0;
else
ue->measurements.rank[eNB_id] = 1;
// printf ("tx mode %d\n", ue->transmission_mode[eNB_id]);
// printf ("rank %d\n", ue->PHY_measurements.rank[eNB_id]);
switch (N_RB_DL) {
case 6:
......@@ -539,6 +542,28 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
} //eNB_id
eNB_id=0;
if (ue->transmission_mode[0]==4 || ue->transmission_mode[0]==3){
if (rank_adaptation == 1)
rank_tm3_tm4 = rank_estimation_tm3_tm4(&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id][0][4],
&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id][2][4],
&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id][1][4],
&ue->common_vars.common_vars_rx_data_per_thread[subframe&0x1].dl_ch_estimates[eNB_id][3][4],
N_RB_DL);
else
rank_tm3_tm4=1;
#ifdef DEBUG_RANK_EST
printf("rank tm3 or tm4 %d\n", rank_tm3_tm4);
#endif
}
if (ue->transmission_mode[eNB_id]!=4 && ue->transmission_mode[eNB_id]!=3)
ue->measurements.rank[eNB_id] = 0;
else
ue->measurements.rank[eNB_id] = rank_tm3_tm4;
// printf ("tx mode %d\n", ue->transmission_mode[eNB_id]);
// printf ("rank %d\n", ue->PHY_measurements.rank[eNB_id]);
// filter to remove jitter
if (ue->init_averaging == 0) {
for (eNB_id = 0; eNB_id < ue->n_connected_eNB; eNB_id++)
......@@ -547,7 +572,7 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
(k2*((long long int)(ue->measurements.rx_power_tot[eNB_id]))))>>10);
//LOG_I(PHY,"Noise Power Computation: k1 %d k2 %d n0 avg %d n0 tot %d\n", k1, k2, ue->measurements.n0_power_avg,
// ue->measurements.n0_power_tot);
// ue->measurements.n0_power_tot);
ue->measurements.n0_power_avg = (int)
(((k1*((long long int) (ue->measurements.n0_power_avg))) +
(k2*((long long int) (ue->measurements.n0_power_tot))))>>10);
......@@ -567,12 +592,12 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
#ifdef DEBUG_MEAS_UE
LOG_I(PHY,"[eNB %d] Subframe %d, RSSI %d dBm, RSSI (digital) %d dB, WBandCQI %d dB, rxPwrAvg %d, n0PwrAvg %d\n",
eNB_id,
subframe,
subframe,
ue->measurements.rx_rssi_dBm[eNB_id],
ue->measurements.rx_power_avg_dB[eNB_id],
ue->measurements.wideband_cqi_avg[eNB_id],
ue->measurements.rx_power_avg[eNB_id],
ue->measurements.n0_power_avg);
ue->measurements.n0_power_tot);
#endif
}
......@@ -633,7 +658,7 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
}
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
//printf("aarx=%d", aarx);
//printf("aarx=%d", aarx);
// skip the first 4 RE due to interpolation filter length of 5 (not possible to skip 5 due to 128i alignment, must be multiple of 128bit)
#if defined(__x86_64__) || defined(__i386__)
......@@ -654,12 +679,12 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
// pmi
#if defined(__x86_64__) || defined(__i386__)
pmi128_re = _mm_xor_si128(pmi128_re,pmi128_re);
pmi128_re = _mm_xor_si128(pmi128_re,pmi128_re);
pmi128_im = _mm_xor_si128(pmi128_im,pmi128_im);
#elif defined(__arm__)
pmi128_re = vdupq_n_s32(0);
pmi128_im = vdupq_n_s32(0);
pmi128_im = vdupq_n_s32(0);
#endif
// limit is the number of groups of 4 REs in a subband (12 = 4 RBs, 3 = 1 RB)
// for 5 MHz channelization, there are 7 subbands, 6 of size 4 RBs and 1 of size 1 RB
......@@ -671,48 +696,48 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
for (i=0; i<limit; i++) {
#if defined(__x86_64__) || defined(__i386__)
mmtmpPMI0 = _mm_xor_si128(mmtmpPMI0,mmtmpPMI0);
mmtmpPMI0 = _mm_xor_si128(mmtmpPMI0,mmtmpPMI0);
mmtmpPMI1 = _mm_xor_si128(mmtmpPMI1,mmtmpPMI1);
// For each RE in subband perform ch0 * conj(ch1)
// multiply by conjugated channel
// print_ints("ch0",&dl_ch0_128[0]);
// print_ints("ch1",&dl_ch1_128[0]);
// print_ints("ch0",&dl_ch0_128[0]);
// print_ints("ch1",&dl_ch1_128[0]);
mmtmpPMI0 = _mm_madd_epi16(dl_ch0_128[0],dl_ch1_128[0]);
// print_ints("re",&mmtmpPMI0);
mmtmpPMI0 = _mm_madd_epi16(dl_ch0_128[0],dl_ch1_128[0]);
// print_ints("re",&mmtmpPMI0);
mmtmpPMI1 = _mm_shufflelo_epi16(dl_ch1_128[0],_MM_SHUFFLE(2,3,0,1));
// print_ints("_mm_shufflelo_epi16",&mmtmpPMI1);
mmtmpPMI1 = _mm_shufflehi_epi16(mmtmpPMI1,_MM_SHUFFLE(2,3,0,1));
// print_ints("_mm_shufflehi_epi16",&mmtmpPMI1);
// print_ints("_mm_shufflehi_epi16",&mmtmpPMI1);
mmtmpPMI1 = _mm_sign_epi16(mmtmpPMI1,*(__m128i*)&conjugate[0]);
// print_ints("_mm_sign_epi16",&mmtmpPMI1);
// print_ints("_mm_sign_epi16",&mmtmpPMI1);
mmtmpPMI1 = _mm_madd_epi16(mmtmpPMI1,dl_ch0_128[0]);
// print_ints("mm_madd_epi16",&mmtmpPMI1);
// print_ints("mm_madd_epi16",&mmtmpPMI1);
// mmtmpPMI1 contains imag part of 4 consecutive outputs (32-bit)
pmi128_re = _mm_add_epi32(pmi128_re,mmtmpPMI0);
// print_ints(" pmi128_re 0",&pmi128_re);
// print_ints(" pmi128_re 0",&pmi128_re);
pmi128_im = _mm_add_epi32(pmi128_im,mmtmpPMI1);
// print_ints(" pmi128_im 0 ",&pmi128_im);
// print_ints(" pmi128_im 0 ",&pmi128_im);
/* mmtmpPMI0 = _mm_xor_si128(mmtmpPMI0,mmtmpPMI0);
/* mmtmpPMI0 = _mm_xor_si128(mmtmpPMI0,mmtmpPMI0);
mmtmpPMI1 = _mm_xor_si128(mmtmpPMI1,mmtmpPMI1);
mmtmpPMI0 = _mm_madd_epi16(dl_ch0_128[1],dl_ch1_128[1]);
// print_ints("re",&mmtmpPMI0);
mmtmpPMI0 = _mm_madd_epi16(dl_ch0_128[1],dl_ch1_128[1]);
// print_ints("re",&mmtmpPMI0);
mmtmpPMI1 = _mm_shufflelo_epi16(dl_ch1_128[1],_MM_SHUFFLE(2,3,0,1));
// print_ints("_mm_shufflelo_epi16",&mmtmpPMI1);
mmtmpPMI1 = _mm_shufflehi_epi16(mmtmpPMI1,_MM_SHUFFLE(2,3,0,1));
// print_ints("_mm_shufflehi_epi16",&mmtmpPMI1);
// print_ints("_mm_shufflehi_epi16",&mmtmpPMI1);
mmtmpPMI1 = _mm_sign_epi16(mmtmpPMI1,*(__m128i*)&conjugate);
// print_ints("_mm_sign_epi16",&mmtmpPMI1);
// print_ints("_mm_sign_epi16",&mmtmpPMI1);
mmtmpPMI1 = _mm_madd_epi16(mmtmpPMI1,dl_ch0_128[1]);
// print_ints("mm_madd_epi16",&mmtmpPMI1);
// print_ints("mm_madd_epi16",&mmtmpPMI1);
// mmtmpPMI1 contains imag part of 4 consecutive outputs (32-bit)
pmi128_re = _mm_add_epi32(pmi128_re,mmtmpPMI0);
// print_ints(" pmi128_re 1",&pmi128_re);
// print_ints(" pmi128_re 1",&pmi128_re);
pmi128_im = _mm_add_epi32(pmi128_im,mmtmpPMI1);
//print_ints(" pmi128_im 1 ",&pmi128_im);*/
//print_ints(" pmi128_im 1 ",&pmi128_im);*/
#elif defined(__arm__)
......@@ -806,3 +831,553 @@ void lte_ue_measurements_emul(PHY_VARS_UE *ue,uint8_t subframe,uint8_t eNB_id)
msg("[PHY] EMUL UE lte_ue_measurements_emul subframe %d, eNB_id %d\n",subframe,eNB_id);
}
uint8_t rank_estimation_tm3_tm4 (int *dl_ch_estimates_00, // please respect the order of channel estimates
int *dl_ch_estimates_01,
int *dl_ch_estimates_10,
int *dl_ch_estimates_11,
unsigned short nb_rb)
{
int i=0;
int rank=0;
int N_RB=nb_rb;
int *ch00_rank, *ch01_rank, *ch10_rank, *ch11_rank;
int32_t shift;
int avg_0[2];
int avg_1[2];
int count=0;
/* we need at least alignment to 16 bytes, let's put 32 to be sure
* (maybe not necessary but doesn't hurt)
*/
int32_t conjch00_ch01[12*N_RB] __attribute__((aligned(32)));
int32_t conjch01_ch00[12*N_RB] __attribute__((aligned(32)));
int32_t conjch10_ch11[12*N_RB] __attribute__((aligned(32)));
int32_t conjch11_ch10[12*N_RB] __attribute__((aligned(32)));
int32_t conjch00_ch00[12*N_RB] __attribute__((aligned(32)));
int32_t conjch01_ch01[12*N_RB] __attribute__((aligned(32)));
int32_t conjch10_ch10[12*N_RB] __attribute__((aligned(32)));
int32_t conjch11_ch11[12*N_RB] __attribute__((aligned(32)));
int32_t af_mf_00[12*N_RB] __attribute__((aligned(32)));
int32_t af_mf_00_sq[12*N_RB] __attribute__((aligned(32)));
int32_t af_mf_01_sq[12*N_RB] __attribute__((aligned(32)));
int32_t af_mf_10_sq[12*N_RB] __attribute__((aligned(32)));
int32_t af_mf_11_sq[12*N_RB] __attribute__((aligned(32)));
int32_t af_mf_01[12*N_RB] __attribute__((aligned(32)));
int32_t af_mf_10[12*N_RB] __attribute__((aligned(32)));
int32_t af_mf_11[12*N_RB] __attribute__((aligned(32)));
int32_t determ_fin[12*N_RB] __attribute__((aligned(32)));
int32_t denum_db[12*N_RB] __attribute__((aligned(32)));
int32_t numer_fin[12*N_RB] __attribute__((aligned(32)));
int32_t numer_db[12*N_RB] __attribute__((aligned(32)));
int32_t cond_db[12*N_RB] __attribute__((aligned(32)));
ch00_rank = dl_ch_estimates_00;
ch01_rank = dl_ch_estimates_01;
ch10_rank = dl_ch_estimates_10;
ch11_rank = dl_ch_estimates_11;
dlsch_channel_level_TM34_meas(ch00_rank,
ch01_rank,
ch10_rank,
ch11_rank,
avg_0,
avg_1,
N_RB);
avg_0[0] = (log2_approx(avg_0[0])/2);
shift = cmax(avg_0[0],0);
#ifdef DEBUG_RANK_EST
printf("\n shift %d \n" , shift);
printf("\n conj(ch00)ch01 \n");
#endif
conjch0_mult_ch1(ch00_rank,
ch01_rank,
conjch00_ch01,
N_RB,
shift); // this is an arbitrary shift to avoid overflow. can be changed.
#ifdef DEBUG_RANK_EST
printf("\n conj(ch01)ch00 \n");
#endif
conjch0_mult_ch1(ch01_rank,
ch00_rank,
conjch01_ch00,
N_RB,
shift);
#ifdef DEBUG_RANK_EST
printf("\n conj(ch10)ch11 \n");
#endif
conjch0_mult_ch1(ch10_rank,
ch11_rank,
conjch10_ch11,
N_RB,
shift);
#ifdef DEBUG_RANK_EST
printf("\n conj(ch11)ch10 \n");
#endif
conjch0_mult_ch1(ch11_rank,
ch10_rank,
conjch11_ch10,
N_RB,
shift);
#ifdef DEBUG_RANK_EST
printf("\n conj(ch00)ch00 \n");
#endif
conjch0_mult_ch1(ch00_rank,
ch00_rank,
conjch00_ch00,
N_RB,
shift);
#ifdef DEBUG_RANK_EST
printf("\n conj(ch01)ch01 \n");
#endif
conjch0_mult_ch1(ch01_rank,
ch01_rank,
conjch01_ch01,
N_RB,
shift);
#ifdef DEBUG_RANK_EST
printf("\n conj(ch10)ch10 \n");
#endif
conjch0_mult_ch1(ch10_rank,
ch10_rank,
conjch10_ch10,
N_RB,
shift);
#ifdef DEBUG_RANK_EST
printf("\n conj(ch11)ch11 \n");
#endif
conjch0_mult_ch1(ch11_rank,
ch11_rank,
conjch11_ch11,
N_RB,
shift);
construct_HhH_elements(conjch00_ch00,
conjch01_ch01,
conjch11_ch11,
conjch10_ch10,
conjch00_ch01,
conjch01_ch00,
conjch10_ch11,
conjch11_ch10,
af_mf_00,
af_mf_01,
af_mf_10,
af_mf_11,
N_RB);
#ifdef DEBUG_RANK_EST
printf("\n |HhH00|^2 \n");
#endif
squared_matrix_element(af_mf_00,
af_mf_00_sq,
N_RB);
#ifdef DEBUG_RANK_EST
printf("\n |HhH01|^2 \n");
#endif
squared_matrix_element(af_mf_01,
af_mf_01_sq,
N_RB);
#ifdef DEBUG_RANK_EST
printf("\n |HhH10|^2 \n");
#endif
squared_matrix_element(af_mf_10,
af_mf_10_sq,
N_RB);
#ifdef DEBUG_RANK_EST
printf("\n |HhH11|^2 \n");
#endif
squared_matrix_element(af_mf_11,
af_mf_11_sq,
N_RB);
det_HhH(af_mf_00,
af_mf_01,
af_mf_10,
af_mf_11,
determ_fin,
N_RB);
numer(af_mf_00_sq,
af_mf_01_sq,
af_mf_10_sq,
af_mf_11_sq,
numer_fin,
N_RB);
for (i=1; i<12*N_RB; i++)
{
denum_db[i]=dB_fixed(determ_fin[i]);
numer_db[i]=dB_fixed(numer_fin[i]);
cond_db[i]=(numer_db[i]-denum_db[i]);
if (cond_db[i] < cond_num_threshold)
count++;
#ifdef DEBUG_RANK_EST
printf("cond_num_threshold =%d \n", cond_num_threshold);
printf("i %d numer_db[i] = %d \n", i, numer_db[i]);
printf("i %d denum_db[i] = %d \n", i, denum_db[i]);
printf("i %d cond_db[i] = %d \n", i, cond_db[i]);
printf("i %d counter = %d \n", i, count);
#endif
}
if (count >= 6*N_RB) // conditional number is lower 10dB in half on more Res Blocks
rank=1;
#ifdef DEBUG_RANK_EST
printf(" rank = %d \n", rank);
#endif
return(rank);
}
void conjch0_mult_ch1(int *ch0,
int *ch1,
int32_t *ch0conj_ch1,
unsigned short nb_rb,
unsigned char output_shift0)
{
//This function is used to compute multiplications in Hhermitian * H matrix
unsigned short rb;
__m128i *dl_ch0_128,*dl_ch1_128, *ch0conj_ch1_128, mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3;
dl_ch0_128 = (__m128i *)ch0;
dl_ch1_128 = (__m128i *)ch1;
ch0conj_ch1_128 = (__m128i *)ch0conj_ch1;
for (rb=0; rb<3*nb_rb; rb++) {
mmtmpD0 = _mm_madd_epi16(dl_ch0_128[0],dl_ch1_128[0]);
mmtmpD1 = _mm_shufflelo_epi16(dl_ch0_128[0],_MM_SHUFFLE(2,3,0,1));
mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1));
mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)&conjugate[0]);
mmtmpD1 = _mm_madd_epi16(mmtmpD1,dl_ch1_128[0]);
mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift0);
mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift0);
mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1);
mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1);
ch0conj_ch1_128[0] = _mm_packs_epi32(mmtmpD2,mmtmpD3);
#ifdef DEBUG_RANK_EST
printf("\n Computing conjugates \n");
print_shorts("ch0:",(int16_t*)&dl_ch0_128[0]);
print_shorts("ch1:",(int16_t*)&dl_ch1_128[0]);
print_shorts("pack:",(int16_t*)&ch0conj_ch1_128[0]);
#endif
dl_ch0_128+=1;
dl_ch1_128+=1;
ch0conj_ch1_128+=1;
}
_mm_empty();
_m_empty();
}
void construct_HhH_elements(int *ch0conj_ch0, //00_00
int *ch1conj_ch1,//01_01
int *ch2conj_ch2,//11_11
int *ch3conj_ch3,//10_10
int *ch0conj_ch1,//00_01
int *ch1conj_ch0,//01_00
int *ch2conj_ch3,//10_11
int *ch3conj_ch2,//11_10
int32_t *after_mf_00,
int32_t *after_mf_01,
int32_t *after_mf_10,
int32_t *after_mf_11,
unsigned short nb_rb)
{
unsigned short rb;
__m128i *ch0conj_ch0_128, *ch1conj_ch1_128, *ch2conj_ch2_128, *ch3conj_ch3_128;
__m128i *ch0conj_ch1_128, *ch1conj_ch0_128, *ch2conj_ch3_128, *ch3conj_ch2_128;
__m128i *after_mf_00_128, *after_mf_01_128, *after_mf_10_128, *after_mf_11_128;
ch0conj_ch0_128 = (__m128i *)ch0conj_ch0;
ch1conj_ch1_128 = (__m128i *)ch1conj_ch1;
ch2conj_ch2_128 = (__m128i *)ch2conj_ch2;
ch3conj_ch3_128 = (__m128i *)ch3conj_ch3;
ch0conj_ch1_128 = (__m128i *)ch0conj_ch1;
ch1conj_ch0_128 = (__m128i *)ch1conj_ch0;
ch2conj_ch3_128 = (__m128i *)ch2conj_ch3;
ch3conj_ch2_128 = (__m128i *)ch3conj_ch2;
after_mf_00_128 = (__m128i *)after_mf_00;
after_mf_01_128 = (__m128i *)after_mf_01;
after_mf_10_128 = (__m128i *)after_mf_10;
after_mf_11_128 = (__m128i *)after_mf_11;
for (rb=0; rb<3*nb_rb; rb++) {
after_mf_00_128[0] =_mm_adds_epi16(ch0conj_ch0_128[0],ch3conj_ch3_128[0]);// _mm_adds_epi32(ch0conj_ch0_128[0], ch3conj_ch3_128[0]); //00_00 + 10_10
after_mf_11_128[0] =_mm_adds_epi16(ch1conj_ch1_128[0], ch2conj_ch2_128[0]); //01_01 + 11_11
after_mf_01_128[0] =_mm_adds_epi16(ch0conj_ch1_128[0], ch2conj_ch3_128[0]);//00_01 + 10_11
after_mf_10_128[0] =_mm_adds_epi16(ch1conj_ch0_128[0], ch3conj_ch2_128[0]);//01_00 + 11_10
#ifdef DEBUG_RANK_EST
printf(" \n construct_HhH_elements \n");
print_shorts("ch0conj_ch0_128:",(int16_t*)&ch0conj_ch0_128[0]);
print_shorts("ch1conj_ch1_128:",(int16_t*)&ch1conj_ch1_128[0]);
print_shorts("ch2conj_ch2_128:",(int16_t*)&ch2conj_ch2_128[0]);
print_shorts("ch3conj_ch3_128:",(int16_t*)&ch3conj_ch3_128[0]);
print_shorts("ch0conj_ch1_128:",(int16_t*)&ch0conj_ch1_128[0]);
print_shorts("ch1conj_ch0_128:",(int16_t*)&ch1conj_ch0_128[0]);
print_shorts("ch2conj_ch3_128:",(int16_t*)&ch2conj_ch3_128[0]);
print_shorts("ch3conj_ch2_128:",(int16_t*)&ch3conj_ch2_128[0]);
print_shorts("after_mf_00_128:",(int16_t*)&after_mf_00_128[0]);
print_shorts("after_mf_01_128:",(int16_t*)&after_mf_01_128[0]);
print_shorts("after_mf_10_128:",(int16_t*)&after_mf_10_128[0]);
print_shorts("after_mf_11_128:",(int16_t*)&after_mf_11_128[0]);
#endif
ch0conj_ch0_128+=1;
ch1conj_ch1_128+=1;
ch2conj_ch2_128+=1;
ch3conj_ch3_128+=1;
ch0conj_ch1_128+=1;
ch1conj_ch0_128+=1;
ch2conj_ch3_128+=1;
ch3conj_ch2_128+=1;
after_mf_00_128+=1;
after_mf_01_128+=1;
after_mf_10_128+=1;
after_mf_11_128+=1;
}
_mm_empty();
_m_empty();
}
void squared_matrix_element(int32_t *Hh_h_00,
int32_t *Hh_h_00_sq,
unsigned short nb_rb)
{
unsigned short rb;
__m128i *Hh_h_00_128,*Hh_h_00_sq_128;
Hh_h_00_128 = (__m128i *)Hh_h_00;
Hh_h_00_sq_128 = (__m128i *)Hh_h_00_sq;
for (rb=0; rb<3*nb_rb; rb++) {
Hh_h_00_sq_128[0] = _mm_madd_epi16(Hh_h_00_128[0],Hh_h_00_128[0]);
#ifdef DEBUG_RANK_EST
printf("\n Computing squared_matrix_element \n");
print_shorts("Hh_h_00_128:",(int16_t*)&Hh_h_00_128[0]);
print_ints("Hh_h_00_sq_128:",(int32_t*)&Hh_h_00_sq_128[0]);
#endif
Hh_h_00_sq_128+=1;
Hh_h_00_128+=1;
}
_mm_empty();
_m_empty();
}
void det_HhH(int32_t *after_mf_00,
int32_t *after_mf_01,
int32_t *after_mf_10,
int32_t *after_mf_11,
int32_t *det_fin,
unsigned short nb_rb)
{
unsigned short rb;
__m128i *after_mf_00_128,*after_mf_01_128, *after_mf_10_128, *after_mf_11_128, ad_re_128, bc_re_128;
__m128i *det_fin_128, det_128;
after_mf_00_128 = (__m128i *)after_mf_00;
after_mf_01_128 = (__m128i *)after_mf_01;
after_mf_10_128 = (__m128i *)after_mf_10;
after_mf_11_128 = (__m128i *)after_mf_11;
det_fin_128 = (__m128i *)det_fin;
for (rb=0; rb<3*nb_rb; rb++) {
ad_re_128 = _mm_madd_epi16(after_mf_00_128[0],after_mf_11_128[0]);
bc_re_128 = _mm_madd_epi16(after_mf_01_128[0],after_mf_01_128[0]);
det_128 = _mm_sub_epi32(ad_re_128, bc_re_128);
det_fin_128[0] = _mm_abs_epi32(det_128);
#ifdef DEBUG_RANK_EST
printf("\n Computing denominator \n");
print_shorts("after_mf_00_128:",(int16_t*)&after_mf_00_128[0]);
print_shorts("after_mf_01_128:",(int16_t*)&after_mf_01_128[0]);
print_shorts("after_mf_10_128:",(int16_t*)&after_mf_10_128[0]);
print_shorts("after_mf_11_128:",(int16_t*)&after_mf_11_128[0]);
print_ints("ad_re_128:",(int32_t*)&ad_re_128);
print_ints("bc_re_128:",(int32_t*)&bc_re_128);
print_ints("det_fin_128:",(int32_t*)&det_fin_128[0]);
#endif
det_fin_128+=1;
after_mf_00_128+=1;
after_mf_01_128+=1;
after_mf_10_128+=1;
after_mf_11_128+=1;
}
_mm_empty();
_m_empty();
}
void numer(int32_t *Hh_h_00_sq,
int32_t *Hh_h_01_sq,
int32_t *Hh_h_10_sq,
int32_t *Hh_h_11_sq,
int32_t *num_fin,
unsigned short nb_rb)
{
unsigned short rb;
__m128i *h_h_00_sq_128, *h_h_01_sq_128, *h_h_10_sq_128, *h_h_11_sq_128;
__m128i *num_fin_128, sq_a_plus_sq_d_128, sq_b_plus_sq_c_128;
h_h_00_sq_128 = (__m128i *)Hh_h_00_sq;
h_h_01_sq_128 = (__m128i *)Hh_h_01_sq;
h_h_10_sq_128 = (__m128i *)Hh_h_10_sq;
h_h_11_sq_128 = (__m128i *)Hh_h_11_sq;
num_fin_128 = (__m128i *)num_fin;
for (rb=0; rb<3*nb_rb; rb++) {
sq_a_plus_sq_d_128 = _mm_add_epi32(h_h_00_sq_128[0],h_h_11_sq_128[0]);
sq_b_plus_sq_c_128 = _mm_add_epi32(h_h_01_sq_128[0],h_h_10_sq_128[0]);
num_fin_128[0] = _mm_add_epi32(sq_a_plus_sq_d_128, sq_b_plus_sq_c_128);
#ifdef DEBUG_RANK_EST
printf("\n Computing numerator \n");
print_ints("h_h_00_sq_128:",(int32_t*)&h_h_00_sq_128[0]);
print_ints("h_h_01_sq_128:",(int32_t*)&h_h_01_sq_128[0]);
print_ints("h_h_10_sq_128:",(int32_t*)&h_h_10_sq_128[0]);
print_ints("h_h_11_sq_128:",(int32_t*)&h_h_11_sq_128[0]);
print_shorts("sq_a_plus_sq_d_128:",(int16_t*)&sq_a_plus_sq_d_128);
print_shorts("sq_b_plus_sq_c_128:",(int16_t*)&sq_b_plus_sq_c_128);
print_shorts("num_fin_128:",(int16_t*)&num_fin_128[0]);
#endif
num_fin_128+=1;
h_h_00_sq_128+=1;
h_h_01_sq_128+=1;
h_h_10_sq_128+=1;
h_h_11_sq_128+=1;
}
_mm_empty();
_m_empty();
}
void dlsch_channel_level_TM34_meas(int *ch00,
int *ch01,
int *ch10,
int *ch11,
int *avg_0,
int *avg_1,
unsigned short nb_rb)
{
#if defined(__x86_64__)||defined(__i386__)
short rb;
unsigned char nre=12;
__m128i *ch00_128, *ch01_128, *ch10_128, *ch11_128;
__m128i avg_0_row0_128D, avg_1_row0_128D, avg_0_row1_128D, avg_1_row1_128D;
__m128i ch00_128_tmp, ch01_128_tmp, ch10_128_tmp, ch11_128_tmp;
avg_0[0] = 0;
avg_0[1] = 0;
avg_1[0] = 0;
avg_1[1] = 0;
ch00_128 = (__m128i *)ch00;
ch01_128 = (__m128i *)ch01;
ch10_128 = (__m128i *)ch10;
ch11_128 = (__m128i *)ch11;
avg_0_row0_128D = _mm_setzero_si128();
avg_1_row0_128D = _mm_setzero_si128();
avg_0_row1_128D = _mm_setzero_si128();
avg_1_row1_128D = _mm_setzero_si128();
for (rb=0; rb<3*nb_rb; rb++) {
ch00_128_tmp = _mm_load_si128(&ch00_128[0]);
ch01_128_tmp = _mm_load_si128(&ch01_128[0]);
ch10_128_tmp = _mm_load_si128(&ch10_128[0]);
ch11_128_tmp = _mm_load_si128(&ch11_128[0]);
avg_0_row0_128D = _mm_add_epi32(avg_0_row0_128D,_mm_madd_epi16(ch00_128_tmp,ch00_128_tmp));
avg_1_row0_128D = _mm_add_epi32(avg_1_row0_128D,_mm_madd_epi16(ch01_128_tmp,ch01_128_tmp));
avg_0_row1_128D = _mm_add_epi32(avg_0_row1_128D,_mm_madd_epi16(ch10_128_tmp,ch10_128_tmp));
avg_1_row1_128D = _mm_add_epi32(avg_1_row1_128D,_mm_madd_epi16(ch11_128_tmp,ch11_128_tmp));
ch00_128+=1;
ch01_128+=1;
ch10_128+=1;
ch11_128+=1;
}
avg_0[0] = (((int*)&avg_0_row0_128D)[0])/(nb_rb*nre) +
(((int*)&avg_0_row0_128D)[1])/(nb_rb*nre) +
(((int*)&avg_0_row0_128D)[2])/(nb_rb*nre) +
(((int*)&avg_0_row0_128D)[3])/(nb_rb*nre);
avg_1[0] = (((int*)&avg_1_row0_128D)[0])/(nb_rb*nre) +
(((int*)&avg_1_row0_128D)[1])/(nb_rb*nre) +
(((int*)&avg_1_row0_128D)[2])/(nb_rb*nre) +
(((int*)&avg_1_row0_128D)[3])/(nb_rb*nre);
avg_0[1] = (((int*)&avg_0_row1_128D)[0])/(nb_rb*nre) +
(((int*)&avg_0_row1_128D)[1])/(nb_rb*nre) +
(((int*)&avg_0_row1_128D)[2])/(nb_rb*nre) +
(((int*)&avg_0_row1_128D)[3])/(nb_rb*nre);
avg_1[1] = (((int*)&avg_1_row1_128D)[0])/(nb_rb*nre) +
(((int*)&avg_1_row1_128D)[1])/(nb_rb*nre) +
(((int*)&avg_1_row1_128D)[2])/(nb_rb*nre) +
(((int*)&avg_1_row1_128D)[3])/(nb_rb*nre);
avg_0[0] = avg_0[0] + avg_0[1];
avg_1[0] = avg_1[0] + avg_1[1];
avg_0[0] = min (avg_0[0], avg_1[0]);
avg_1[0] = avg_0[0];
_mm_empty();
_m_empty();
#elif defined(__arm__)
#endif
}
......@@ -1270,7 +1270,6 @@ int generate_eNB_dlsch_params_from_dci(int frame,
if (dlsch0_harq->round == 0) {
dlsch0_harq->status = ACTIVE;
// printf("Setting DLSCH process %d to ACTIVE\n",harq_pid);
// MCS and TBS don't change across HARQ rounds
dlsch0_harq->mcs = mcs;
dlsch0_harq->TBS = TBStable[get_I_TBS(dlsch0_harq->mcs)][NPRB-1];
......@@ -1494,7 +1493,6 @@ int generate_eNB_dlsch_params_from_dci(int frame,
break;
}
if (harq_pid>=8) {
LOG_E(PHY,"ERROR: Format 2_2A: harq_pid=%d >= 8\n", harq_pid);
return(-1);
......@@ -1513,7 +1511,7 @@ int generate_eNB_dlsch_params_from_dci(int frame,
TB1_active=0;
}
#ifdef DEBUG_HARQ
printf("RV0 = %d, RV1 = %d. MCS0 = %d, MCS1=%d\n", rv1, rv2, mcs1, mcs2);
printf(" eNOdeB RV0 = %d, RV1 = %d. MCS0 = %d, MCS1=%d\n", rv1, rv2, mcs1, mcs2);
#endif
if (TB0_active && TB1_active && tbswap==0) {
dlsch0=dlsch[0];
......@@ -1578,6 +1576,8 @@ int generate_eNB_dlsch_params_from_dci(int frame,
printf("\n ENB: TB0 is deactivated, retransmit TB1 transmit in TM6\n");
#endif
}
// printf("[eNB] dlsch0_harq->round = %d, dlsch1_harq->round = %d \n", dlsch0_harq->round, dlsch1_harq->round);
if (dlsch0 != NULL){
dlsch0->subframe_tx[subframe] = 1;
......@@ -1721,6 +1721,7 @@ int generate_eNB_dlsch_params_from_dci(int frame,
dlsch1_harq->pmi_alloc = DL_pmi_single;
break;
}
// printf ("[eNB] dlsch1_harq->pmi_alloc %d\n", dlsch1_harq->pmi_alloc);
}
} else if (frame_parms->nb_antenna_ports_eNB == 4) {
......@@ -1738,6 +1739,7 @@ int generate_eNB_dlsch_params_from_dci(int frame,
if (dlsch1 != NULL)
dlsch1->rnti = rnti;
break;
case format2A:
......@@ -2829,8 +2831,6 @@ int generate_eNB_dlsch_params_from_dci(int frame,
int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci)
{
switch (dci->format) {
case format0: // This is an UL SCH allocation so nothing here, inform MAC
......@@ -5045,22 +5045,15 @@ int check_dci_format2_2a_coherency(DCI_format_t dci_format,
}
/*
if((pdlsch0_harq->round > 0) && (mcs1 != pdlsch0_harq->mcs))
{
// DCI false detection
return(0);
}*/
if((pdlsch0_harq->round == 0) && (rv1 > 0))
if((pdlsch0_harq->round == 0) && (rv1 > 0) && (mcs1 != 0))
{
// DCI false detection
LOG_I(PHY,"bad rv1\n");
return(0);
}
if((pdlsch1_harq->round == 0) && (rv2 > 0))
if((pdlsch1_harq->round == 0) && (rv2 > 0) && (mcs2 != 0))
{
// DCI false detection
LOG_I(PHY,"bad rv2\n");
......@@ -5202,7 +5195,6 @@ void prepare_dl_decoding_format1_1A(DCI_format_t dci_format,
if ((rnti==si_rnti) || (rnti==p_rnti) || (rnti==ra_rnti))
{
pdlsch0_harq->round = 0;
pdlsch0_harq->first_tx = 1;
pdlsch0_harq->status = ACTIVE;
}
else //CRNTI
......@@ -5214,28 +5206,37 @@ void prepare_dl_decoding_format1_1A(DCI_format_t dci_format,
rnti,harq_pid,pdlsch0_harq->DCINdi);
}
// DCI has been toggled or this is the first transmission
if (ndi1!=pdlsch0_harq->DCINdi)
// NDI has been toggled or this is the first transmission
if ((ndi1!=pdlsch0_harq->DCINdi) || (pdlsch0_harq->first_tx==1))
{
pdlsch0_harq->round = 0;
pdlsch0_harq->first_tx = 1;
pdlsch0_harq->first_tx = 0;
pdlsch0_harq->status = ACTIVE;
}
if( ((ndi1 == pdlsch0_harq->DCINdi) && (pdlsch0_harq->round == 0)) ||
((rv1 != 0) && (pdlsch0_harq->round == 0))
)
{
LOG_D(PHY,"skip pdsch decoding and report ack\n");
// skip pdsch decoding and report ack
pdlsch0_harq->status = SCH_IDLE;
pdlsch0->active = 0;
pdlsch0->harq_ack[subframe].ack = 1;
pdlsch0->harq_ack[subframe].harq_id = harq_pid;
pdlsch0->harq_ack[subframe].send_harq_status = 1;
pdlsch0_harq->first_tx = 0;
}
else if (rv1 != 0 )
//NDI has not been toggled but rv was increased by eNB: retransmission
{
if (pdlsch0_harq->status == SCH_IDLE)
//packet was actually decoded in previous transmission (ACK was missed by eNB)
//However, the round is not a good check as it might have been decoded in a retransmission prior to this one.
{
LOG_D(PHY,"skip pdsch decoding and report ack\n");
// skip pdsch decoding and report ack
//pdlsch0_harq->status = SCH_IDLE;
pdlsch0->active = 0;
pdlsch0->harq_ack[subframe].ack = 1;
pdlsch0->harq_ack[subframe].harq_id = harq_pid;
pdlsch0->harq_ack[subframe].send_harq_status = 1;
//pdlsch0_harq->first_tx = 0;
}
else //normal retransmission
{
// nothing special to do
}
}
}
pdlsch0_harq->DCINdi = ndi1;
......@@ -5494,6 +5495,9 @@ switch (tpmi) {
dlsch1_harq->pmi_alloc = pmi_alloc;
dlsch0_harq->pmi_alloc = pmi_alloc^0x1555;
}
#ifdef DEBUG_HARQ
printf ("\n \n compute_precoding_info_2cw pmi_alloc_new = %d\n", dlsch0_harq->pmi_alloc);
#endif
break;
default:
break;
......@@ -5525,19 +5529,16 @@ switch (tpmi) {
break;
case 5:
dlsch_harq->mimo_mode = PUSCH_PRECODING0;
dlsch_harq->pmi_alloc = pmi_alloc;;//pmi_convert(frame_parms,dlsch0->pmi_alloc,0);
#ifdef DEBUG_HARQ
printf ("[DCI UE] I am calling from the UE side pmi_alloc_new = %d\n", dlsch0->pmi_alloc);
#endif
dlsch_harq->pmi_alloc = pmi_alloc;//pmi_convert(frame_parms,dlsch0->pmi_alloc,0);
break;
case 6:
dlsch_harq->mimo_mode = PUSCH_PRECODING1;
dlsch_harq->pmi_alloc = pmi_alloc;;//pmi_convert(frame_parms,dlsch0->pmi_alloc,1);
#ifdef DEBUG_HARQ
printf ("[DCI UE] I am calling from the UE side pmi_alloc_new = %d\n", dlsch0->pmi_alloc);
#endif
dlsch_harq->pmi_alloc = pmi_alloc;//pmi_convert(frame_parms,dlsch0->pmi_alloc,1);
break;
}
#ifdef DEBUG_HARQ
printf ("[DCI UE] I am calling from the UE side pmi_alloc_new = %d with tpmi %d\n", dlsch_harq->pmi_alloc, tpmi);
#endif
}
void compute_precoding_info_format2A(uint8_t tpmi,
......@@ -5660,15 +5661,12 @@ void prepare_dl_decoding_format2_2A(DCI_format_t dci_format,
uint8_t ndi1 = pdci_info_extarcted->ndi1;
uint8_t ndi2 = pdci_info_extarcted->ndi2;
uint8_t TB0_active = 0;
uint8_t TB1_active = 0;
uint8_t TB0_active = 1;
uint8_t TB1_active = 1;
// printf("inside prepare pdlsch1->pmi_alloc %d \n",pdlsch1->pmi_alloc);
// check if either TB is disabled (see 36-213 V8.6 p. 26)
TB0_active = 1;
TB1_active = 1;
if ((rv1 == 1) && (mcs1 == 0)) {
TB0_active=0;
}
......@@ -5715,6 +5713,16 @@ void prepare_dl_decoding_format2_2A(DCI_format_t dci_format,
dlsch1_harq->codeword = 0;
}
if (!TB0_active && TB1_active){
dlsch1_harq->codeword = 0;
}
if (TB0_active && !TB1_active){
dlsch0_harq->codeword = 0;
}
if (TB0_active==0) {
dlsch0_harq->status = SCH_IDLE;
pdlsch0->active = 0;
......@@ -5728,9 +5736,9 @@ void prepare_dl_decoding_format2_2A(DCI_format_t dci_format,
pdlsch1->active = 0;
}
//#ifdef DEBUG_HARQ
#ifdef DEBUG_HARQ
printf("[DCI UE]: dlsch0_harq status %d , dlsch1_harq status %d\n", dlsch0_harq->status, dlsch1_harq->status);
//#endif
#endif
// compute resource allocation
if (TB0_active == 1){
......@@ -5785,10 +5793,13 @@ void prepare_dl_decoding_format2_2A(DCI_format_t dci_format,
{
if ((TB0_active) && (TB1_active)){ //two CW active
compute_precoding_info_2cw(tpmi, tbswap, pdlsch0->pmi_alloc,frame_parms, dlsch0_harq, dlsch1_harq);
// printf("[DCI UE 1]: dlsch0_harq status %d , dlsch1_harq status %d\n", dlsch0_harq->status, dlsch1_harq->status);
} else if ((TB0_active) && (!TB1_active)) { // only CW 0 active
compute_precoding_info_1cw(tpmi, pdlsch0->pmi_alloc, frame_parms, dlsch0_harq);
} else {
compute_precoding_info_1cw(tpmi, pdlsch0->pmi_alloc, frame_parms, dlsch1_harq);
compute_precoding_info_1cw(tpmi, pdlsch1->pmi_alloc, frame_parms, dlsch1_harq);
// printf("I am doing compute_precoding_info_1cw with tpmi %d \n", tpmi);
}
//printf(" UE DCI harq0 MIMO mode = %d\n", dlsch0_harq->mimo_mode);
if ((frame_parms->mode1_flag == 1) && (TB0_active))
......@@ -5803,11 +5814,14 @@ void prepare_dl_decoding_format2_2A(DCI_format_t dci_format,
dlsch0_harq,
dlsch1_harq);
}
// printf("[DCI UE 2]: dlsch0_harq status %d , dlsch1_harq status %d\n", dlsch0_harq->status, dlsch1_harq->status);
// reset round + compute Qm
if (TB0_active) {
// printf("TB0 ndi1 =%d, dlsch0_harq->DCINdi =%d, dlsch0_harq->first_tx = %d\n", ndi1, dlsch0_harq->DCINdi, dlsch0_harq->first_tx);
if ((ndi1!=dlsch0_harq->DCINdi) || (dlsch0_harq->first_tx==1)) {
dlsch0_harq->round = 0;
dlsch0_harq->round = 0;
dlsch0_harq->status = ACTIVE;
dlsch0_harq->DCINdi = ndi1;
//LOG_I(PHY,"[UE] DLSCH: New Data Indicator CW0 subframe %d (pid %d, round %d)\n",
// subframe,harq_pid,dlsch0_harq->round);
......@@ -5815,18 +5829,18 @@ void prepare_dl_decoding_format2_2A(DCI_format_t dci_format,
LOG_D(PHY,"Format 2 DCI First TX0: Clearing flag\n");
dlsch0_harq->first_tx = 0;
}
}else{
if(dlsch0_harq->round == 0) {
#if 0
// skip pdsch decoding and report ack
dlsch0_harq->status = SCH_IDLE;
pdlsch0->active = 0;
pdlsch0->harq_ack[subframe].ack = 1;
pdlsch0->harq_ack[subframe].harq_id = harq_pid;
pdlsch0->harq_ack[subframe].send_harq_status = 1;
#endif
}
}
/*else if (rv1 != 0 )
//NDI has not been toggled but rv was increased by eNB: retransmission
{
if(dlsch0_harq->status == SCH_IDLE) {
// skip pdsch decoding and report ack
//dlsch0_harq->status = SCH_IDLE;
pdlsch0->active = 0;
pdlsch0->harq_ack[subframe].ack = 1;
pdlsch0->harq_ack[subframe].harq_id = harq_pid;
pdlsch0->harq_ack[subframe].send_harq_status = 1;
}*/
// if Imcs in [29..31] TBS is assumed to be as determined from DCI transported in the latest
// PDCCH for the same trasport block using Imcs in [0 .. 28]
......@@ -5849,27 +5863,33 @@ void prepare_dl_decoding_format2_2A(DCI_format_t dci_format,
dlsch0_harq->Qm = (mcs1-28)<<1;
}
// printf("[DCI UE 3]: dlsch0_harq status %d , dlsch1_harq status %d\n", dlsch0_harq->status, dlsch1_harq->status);
if (TB1_active) {
// printf("TB1 ndi2 =%d, dlsch1_harq->DCINdi =%d, dlsch1_harq->first_tx = %d\n", ndi2, dlsch1_harq->DCINdi, dlsch1_harq->first_tx);
if ((ndi2!=dlsch1_harq->DCINdi) || (dlsch1_harq->first_tx==1)) {
dlsch1_harq->round = 0;
dlsch1_harq->status = ACTIVE;
dlsch1_harq->DCINdi = ndi2;
//LOG_I(PHY,"[UE] DLSCH: New Data Indicator CW1 subframe %d (pid %d, round %d)\n",
// subframe,harq_pid,dlsch0_harq->round);
if (dlsch1_harq->first_tx==1) {
LOG_D(PHY,"Format 2 DCI First TX1: Clearing flag\n");
dlsch1_harq->first_tx = 0;
}
}else{
#if 0
if(dlsch1_harq->round == 0) {
// skip pdsch decoding and report ack
dlsch1_harq->status = SCH_IDLE;
pdlsch1->active = 0;
pdlsch1->harq_ack[subframe].ack = 1;
pdlsch1->harq_ack[subframe].harq_id = harq_pid;
pdlsch1->harq_ack[subframe].send_harq_status = 1;
}
#endif
}
/*else if (rv1 != 0 )
//NDI has not been toggled but rv was increased by eNB: retransmission
{
if(dlsch1_harq->status == SCH_IDLE) {
// skip pdsch decoding and report ack
//dlsch1_harq->status = SCH_IDLE;
pdlsch1->active = 0;
pdlsch1->harq_ack[subframe].ack = 1;
pdlsch1->harq_ack[subframe].harq_id = harq_pid;
pdlsch1->harq_ack[subframe].send_harq_status = 1;
}
}*/
// if Imcs in [29..31] TBS is assumed to be as determined from DCI transported in the latest
// PDCCH for the same trasport block using Imcs in [0 .. 28]
......@@ -5890,18 +5910,16 @@ void prepare_dl_decoding_format2_2A(DCI_format_t dci_format,
dlsch1_harq->Qm = (mcs2-28)<<1;
}
//#ifdef DEBUG_HARQ
printf("[DCI UE]: dlsch0_harq status %d , dlsch1_harq status %d\n", dlsch0_harq->status, dlsch1_harq->status);
//#endif
#ifdef DEBUG_HARQ
/* #ifdef DEBUG_HARQ
printf("[DCI UE]: TB0_active %d , TB1_active %d\n", TB0_active, TB1_active);
if (dlsch0 != NULL && dlsch1 != NULL)
printf("[DCI UE] dlsch0_harq status = %d, dlsch1_harq status = %d\n", dlsch0_harq->status, dlsch1_harq->status);
else if (dlsch0 == NULL && dlsch1 != NULL)
printf("[DCI UE] dlsch0_harq NULL dlsch1_harq status = %d\n", dlsch1_harq->status);
else if (dlsch0 != NULL && dlsch1 == NULL)
printf("[DCI UE] dlsch1_harq NULL dlsch0_harq status = %d\n", dlsch0_harq->status);
#endif
#endif*/
}
int generate_ue_dlsch_params_from_dci(int frame,
......@@ -5919,12 +5937,12 @@ int generate_ue_dlsch_params_from_dci(int frame,
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;
LTE_DL_UE_HARQ_t *dlsch0_harq=NULL,*dlsch1_harq=NULL;
uint8_t frame_type=frame_parms->frame_type;
uint8_t tpmi=0;
LTE_UE_DLSCH_t *dlsch0=NULL,*dlsch1=NULL;
LTE_DL_UE_HARQ_t *dlsch0_harq=NULL,*dlsch1_harq=NULL;
DCI_INFO_EXTRACTED_t dci_info_extarcted;
uint8_t status=0;
......@@ -6112,7 +6130,7 @@ int generate_ue_dlsch_params_from_dci(int frame,
case format2:
{
// extract dci infomation
//extract dci infomation
//LOG_I(PHY,"[DCI-format2] AbsSubframe %d.%d extract dci infomation \n", frame, subframe);
extract_dci2_info(frame_parms->N_RB_DL,
frame_type,
......@@ -6120,20 +6138,19 @@ int generate_ue_dlsch_params_from_dci(int frame,
dci_pdu,
&dci_info_extarcted);
// check dci content
dlsch[0]->active = 0;
dlsch[1]->active = 0;
dlsch[0]->active = 1;
dlsch[1]->active = 1;
if (dci_info_extarcted.tb_swap == 0) {
dlsch0 = dlsch[0];
dlsch1 = dlsch[1];
} else {
dlsch0 = dlsch[1];
dlsch1 = dlsch[0];
}
dlsch0 = dlsch[0];
dlsch1 = dlsch[1];
dlsch0_harq = dlsch0->harq_processes[harq_pid];
dlsch1_harq = dlsch1->harq_processes[harq_pid];
dlsch0_harq = dlsch0->harq_processes[dci_info_extarcted.harq_pid];
dlsch1_harq = dlsch1->harq_processes[dci_info_extarcted.harq_pid];
// printf("before coherency dlsch[1]->pmi_alloc %d\n",dlsch[1]->pmi_alloc);
// printf("before coherency dlsch1->pmi_alloc %d\n",dlsch1->pmi_alloc);
// printf("before coherency dlsch1_harq->pmi_alloc %d\n",dlsch1_harq->pmi_alloc);
//LOG_I(PHY,"[DCI-format2] check dci content \n");
status = check_dci_format2_2a_coherency(format2,
......@@ -6148,6 +6165,7 @@ int generate_ue_dlsch_params_from_dci(int frame,
if(status == 0)
return(-1);
// dci is correct ==> update internal structure and prepare dl decoding
//LOG_I(PHY,"[DCI-format2] update internal structure and prepare dl decoding \n");
prepare_dl_decoding_format2_2A(format2,
......@@ -6159,8 +6177,7 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch1_harq,
dlsch0,
dlsch1);
}
}
break;
case format2A:
......@@ -6214,7 +6231,7 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch0,
dlsch1);
}
break;
break;
case format1E_2A_M10PRB:
if (!dlsch[0]) return -1;
......@@ -6344,11 +6361,15 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch0_harq->mimo_mode = SISO;
if (dlsch0_harq->DCINdi != ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->ndi) {
if ((dlsch0_harq->DCINdi != ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->ndi) ||
(dlsch0_harq->first_tx==1)) {
dlsch0_harq->round = 0;
dlsch0_harq->first_tx = 0;
dlsch0_harq->status = ACTIVE;
} else if (dlsch0_harq->status == SCH_IDLE) { // we got an Ndi = 0 for a previously decoded process,
}
/*
else if (dlsch0_harq->status == SCH_IDLE) { // we got same ndi for a previously decoded process,
// this happens if either another harq process in the same
// is NAK or an ACK was not received
......@@ -6358,6 +6379,7 @@ int generate_ue_dlsch_params_from_dci(int frame,
dlsch0->active = 0;
return(0);
}
*/
dlsch0_harq->DCINdi = ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->ndi;
dlsch0_harq->mcs = ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->mcs;
......@@ -6385,7 +6407,6 @@ int generate_ue_dlsch_params_from_dci(int frame,
break;
}
#ifdef UE_DEBUG_TRACE
if (dlsch[0] && (dlsch[0]->rnti != 0xffff)) {
......
......@@ -598,7 +598,9 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
// 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 \n");
#endif
/*
int i;
printf("dlsch (tx): \n");
......@@ -705,6 +707,9 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
#endif
start_meas(rm_stats);
#ifdef DEBUG_DLSCH_CODING
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
dlsch->harq_processes[harq_pid]->w[r],
......@@ -775,7 +780,9 @@ int dlsch_encoding_SIC(PHY_VARS_UE *ue,
// 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");
#endif
/*
int i;
printf("dlsch (tx): \n");
......@@ -882,6 +889,9 @@ int dlsch_encoding_SIC(PHY_VARS_UE *ue,
#endif
start_meas(rm_stats);
#ifdef DEBUG_DLSCH_CODING
printf("rvidx in SIC 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
dlsch->harq_processes[harq_pid]->w[r],
......
......@@ -393,7 +393,9 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
harq_process->round);
#endif
//printf("dlsch->harq_processes[harq_pid]->rvidx = %d\n", dlsch->harq_processes[harq_pid]->rvidx);
#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],
......
......@@ -48,6 +48,7 @@
* default value: 0
*/
int16_t dlsch_demod_shift = 0;
int16_t interf_unaw_shift = 13;
//#define DEBUG_HARQ
......@@ -61,9 +62,6 @@ int16_t dlsch_demod_shift = 0;
// [MCS][i_mod (0,1,2) = (2,4,6)]
unsigned char offset_mumimo_llr_drange_fix=0;
uint8_t interf_unaw_shift0=0;
uint8_t interf_unaw_shift1=0;
uint8_t interf_unaw_shift=0;
//inferference-free case
unsigned char interf_unaw_shift_tm4_mcs[29]={5, 3, 4, 3, 3, 2, 1, 1, 2, 0, 1, 1, 1, 1, 0, 0,
1, 1, 1, 1, 0, 2, 1, 0, 1, 0, 1, 0, 0} ;
......@@ -147,6 +145,7 @@ int rx_pdsch(PHY_VARS_UE *ue,
case PDSCH:
pdsch_vars = ue->pdsch_vars[subframe&0x1];
dlsch = ue->dlsch[subframe&0x1][eNB_id];
//printf("status TB0 = %d, status TB1 = %d \n", dlsch[0]->harq_processes[harq_pid]->status, dlsch[1]->harq_processes[harq_pid]->status);
LOG_D(PHY,"AbsSubframe %d.%d / Sym %d harq_pid %d, harq status %d.%d \n",
frame,subframe,symbol,harq_pid,
dlsch[0]->harq_processes[harq_pid]->status,
......@@ -158,6 +157,9 @@ int rx_pdsch(PHY_VARS_UE *ue,
codeword_TB1 = dlsch[1]->harq_processes[harq_pid]->codeword;
dlsch0_harq = dlsch[codeword_TB0]->harq_processes[harq_pid];
dlsch1_harq = dlsch[codeword_TB1]->harq_processes[harq_pid];
#ifdef DEBUG_HARQ
printf("[DEMOD] I am assuming both TBs are active\n");
#endif
}
else if ((dlsch[0]->harq_processes[harq_pid]->status == ACTIVE) &&
(dlsch[1]->harq_processes[harq_pid]->status != ACTIVE) ) {
......@@ -165,6 +167,9 @@ int rx_pdsch(PHY_VARS_UE *ue,
dlsch0_harq = dlsch[0]->harq_processes[harq_pid];
dlsch1_harq = NULL;
codeword_TB1 = -1;
#ifdef DEBUG_HARQ
printf("[DEMOD] I am assuming only TB0 is active\n");
#endif
}
else if ((dlsch[0]->harq_processes[harq_pid]->status != ACTIVE) &&
(dlsch[1]->harq_processes[harq_pid]->status == ACTIVE) ){
......@@ -172,6 +177,9 @@ int rx_pdsch(PHY_VARS_UE *ue,
dlsch0_harq = dlsch[1]->harq_processes[harq_pid];
dlsch1_harq = NULL;
codeword_TB0 = -1;
#ifdef DEBUG_HARQ
printf("[DEMOD] I am assuming only TB1 is active, it is in cw %d\n", dlsch0_harq->codeword);
#endif
}
else {
LOG_E(PHY,"[UE][FATAL] Frame %d subframe %d: no active DLSCH\n",ue->proc.proc_rxtx[0].frame_rx,subframe);
......@@ -192,6 +200,7 @@ int rx_pdsch(PHY_VARS_UE *ue,
DevAssert(dlsch0_harq);
round = dlsch0_harq->round;
//printf("round = %d\n", round);
if (eNB_id > 2) {
LOG_W(PHY,"dlsch_demodulation.c: Illegal eNB_id %d\n",eNB_id);
......@@ -231,7 +240,6 @@ int rx_pdsch(PHY_VARS_UE *ue,
}
if ((dlsch0_harq->mimo_mode==LARGE_CDD) || ((dlsch0_harq->mimo_mode>=DUALSTREAM_UNIFORM_PRECODING1) && (dlsch0_harq->mimo_mode<=DUALSTREAM_PUSCH_PRECODING))) {
DevAssert(dlsch1_harq);
if (eNB_id!=eNB_id_i) {
......@@ -239,6 +247,9 @@ int rx_pdsch(PHY_VARS_UE *ue,
return(-1);
}
}
#ifdef DEBUG_HARQ
printf("Demod dlsch0_harq->pmi_alloc %d\n", dlsch0_harq->pmi_alloc);
#endif
if (frame_parms->nb_antenna_ports_eNB>1 && beamforming_mode==0) {
#ifdef DEBUG_DLSCH_MOD
......@@ -408,23 +419,20 @@ int rx_pdsch(PHY_VARS_UE *ue,
nb_rb,
dlsch0_harq->mimo_mode);
LOG_D(PHY,"Channel Level TM34 avg_0 %d, avg_1 %d, rx_type %d, rx_standard %d, interf_unaw_shift %d \n", avg_0[0],
avg_1[0], rx_type, rx_standard, interf_unaw_shift);
LOG_D(PHY,"Channel Level TM34 avg_0 %d, avg_1 %d, rx_type %d, rx_standard %d, dlsch_demod_shift %d \n", avg_0[0],
avg_1[0], rx_type, rx_standard, dlsch_demod_shift);
if (rx_type>rx_standard) {
avg_0[0] = (log2_approx(avg_0[0])/2) + dlsch_demod_shift;// + 2 ;//+ 4;
avg_1[0] = (log2_approx(avg_1[0])/2) + dlsch_demod_shift;// + 2 ;//+ 4;
pdsch_vars[eNB_id]->log2_maxh0 = cmax(avg_0[0],0);
pdsch_vars[eNB_id]->log2_maxh1 = cmax(avg_1[0],0);
//printf("TM4 I-A log2_maxh0 = %d\n", pdsch_vars[eNB_id]->log2_maxh0);
//printf("TM4 I-A log2_maxh1 = %d\n", pdsch_vars[eNB_id]->log2_maxh1);
// printf("dlsch_demod_shift %d\n", dlsch_demod_shift);
}
else {
avg_0[0] = (log2_approx(avg_0[0])/2) - 13 + interf_unaw_shift;
avg_1[0] = (log2_approx(avg_1[0])/2) - 13 + interf_unaw_shift;
pdsch_vars[eNB_id]->log2_maxh0 = cmax(avg_0[0],0);
pdsch_vars[eNB_id]->log2_maxh1 = cmax(avg_1[0],0);
//printf("TM4 I-UA log2_maxh0 = %d\n", pdsch_vars[eNB_id]->log2_maxh0);
//printf("TM4 I-UA log2_maxh1 = %d\n", pdsch_vars[eNB_id]->log2_maxh1);
}
}
else if (dlsch0_harq->mimo_mode<DUALSTREAM_UNIFORM_PRECODING1) {// single-layer precoding (TM5, TM6)
......@@ -750,7 +758,7 @@ int rx_pdsch(PHY_VARS_UE *ue,
switch (dlsch0_harq->Qm) {
case 2 :
if ((rx_type==rx_standard) || (codeword_TB0 == -1) || (codeword_TB1 == -1)) {
if ((rx_type==rx_standard) || (codeword_TB1 == -1)) {
dlsch_qpsk_llr(frame_parms,
pdsch_vars[eNB_id]->rxdataF_comp0,
pdsch_vars[eNB_id]->llr[0],
......@@ -760,6 +768,18 @@ int rx_pdsch(PHY_VARS_UE *ue,
adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,2,subframe,symbol),
pdsch_vars[eNB_id]->llr128,
beamforming_mode);
} else if (codeword_TB0 == -1){
dlsch_qpsk_llr(frame_parms,
pdsch_vars[eNB_id]->rxdataF_comp0,
pdsch_vars[eNB_id]->llr[1],
symbol,
first_symbol_flag,
nb_rb,
adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,2,subframe,symbol),
pdsch_vars[eNB_id]->llr128_2ndstream,
beamforming_mode);
}
else if (rx_type >= rx_IC_single_stream) {
if (dlsch1_harq->Qm == 2) {
......@@ -829,7 +849,7 @@ int rx_pdsch(PHY_VARS_UE *ue,
}
break;
case 4 :
if ((rx_type==rx_standard ) || (codeword_TB0 == -1) || (codeword_TB1 == -1)) {
if ((rx_type==rx_standard ) || (codeword_TB1 == -1)) {
dlsch_16qam_llr(frame_parms,
pdsch_vars[eNB_id]->rxdataF_comp0,
pdsch_vars[eNB_id]->llr[0],
......@@ -838,6 +858,15 @@ int rx_pdsch(PHY_VARS_UE *ue,
adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,4,subframe,symbol),
pdsch_vars[eNB_id]->llr128,
beamforming_mode);
} else if (codeword_TB0 == -1){
dlsch_16qam_llr(frame_parms,
pdsch_vars[eNB_id]->rxdataF_comp0,
pdsch_vars[eNB_id]->llr[1],
pdsch_vars[eNB_id]->dl_ch_mag0,
symbol,first_symbol_flag,nb_rb,
adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,4,subframe,symbol),
pdsch_vars[eNB_id]->llr128_2ndstream,
beamforming_mode);
}
else if (rx_type >= rx_IC_single_stream) {
if (dlsch1_harq->Qm == 2) {
......@@ -913,9 +942,7 @@ int rx_pdsch(PHY_VARS_UE *ue,
}
break;
case 6 :
//printf("LLR rx_type %d cw0 %d cw1 %d symbol %d first symbol %d nb_rb %d rballoceven %d sfn %d beamforming_mode %d\n",
// rx_type,codeword_TB0,codeword_TB1,symbol,first_symbol_flag,nb_rb,dlsch0_harq->rb_alloc_even,subframe,beamforming_mode);
if ((rx_type==rx_standard) || (codeword_TB0 == -1) || (codeword_TB1 == -1)) {
if ((rx_type==rx_standard) || (codeword_TB1 == -1)) {
dlsch_64qam_llr(frame_parms,
pdsch_vars[eNB_id]->rxdataF_comp0,
pdsch_vars[eNB_id]->llr[0],
......@@ -925,6 +952,16 @@ int rx_pdsch(PHY_VARS_UE *ue,
adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,6,subframe,symbol),
pdsch_vars[eNB_id]->llr128,
beamforming_mode);
} else if (codeword_TB0 == -1){
dlsch_64qam_llr(frame_parms,
pdsch_vars[eNB_id]->rxdataF_comp0,
pdsch_vars[eNB_id]->llr[1],
pdsch_vars[eNB_id]->dl_ch_mag0,
pdsch_vars[eNB_id]->dl_ch_magb0,
symbol,first_symbol_flag,nb_rb,
adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,6,subframe,symbol),
pdsch_vars[eNB_id]->llr128_2ndstream,
beamforming_mode);
}
else if (rx_type >= rx_IC_single_stream) {
if (dlsch1_harq->Qm == 2) {
......@@ -3377,7 +3414,7 @@ void dlsch_channel_level(int **dl_ch_estimates_ext,
short rb;
unsigned char aatx,aarx,nre=12,symbol_mod;
__m128i *dl_ch128, avg128D, coeff128;
__m128i *dl_ch128, avg128D;
symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol;
......@@ -3388,11 +3425,10 @@ void dlsch_channel_level(int **dl_ch_estimates_ext,
else
nre=12;
double one_over_nb_re = 0.0;
one_over_nb_re = 1/((double)(nb_rb*nre));
int16_t one_over_nb_re_q1_15 = (int16_t)(one_over_nb_re * (double)(1<<15) );
coeff128 = _mm_set_epi16(one_over_nb_re_q1_15,one_over_nb_re_q1_15,one_over_nb_re_q1_15,one_over_nb_re_q1_15,
one_over_nb_re_q1_15,one_over_nb_re_q1_15,one_over_nb_re_q1_15,one_over_nb_re_q1_15);
//nb_rb*nre = y * 2^x
int16_t x = factor2(nb_rb*nre);
int16_t y = (nb_rb*nre)>>x;
//printf("nb_rb*nre = %d = %d * 2^(%d)\n",nb_rb*nre,y,x);
for (aatx=0; aatx<frame_parms->nb_antenna_ports_eNB; aatx++)
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
......@@ -3405,14 +3441,18 @@ void dlsch_channel_level(int **dl_ch_estimates_ext,
for (rb=0;rb<nb_rb;rb++) {
// printf("rb %d : ",rb);
// print_shorts("ch",&dl_ch128[0]);
avg128D = _mm_add_epi32(avg128D,_mm_madd_epi16(dl_ch128[0],_mm_srai_epi16(_mm_mulhi_epi16(dl_ch128[0], coeff128),15)));
avg128D = _mm_add_epi32(avg128D,_mm_madd_epi16(dl_ch128[1],_mm_srai_epi16(_mm_mulhi_epi16(dl_ch128[1], coeff128),15)));
avg128D = _mm_add_epi32(avg128D,_mm_srai_epi16(_mm_madd_epi16(dl_ch128[0],dl_ch128[0]),x));
avg128D = _mm_add_epi32(avg128D,_mm_srai_epi16(_mm_madd_epi16(dl_ch128[1],dl_ch128[1]),x));
//avg128D = _mm_add_epi32(avg128D,_mm_madd_epi16(dl_ch128[0],_mm_srai_epi16(_mm_mulhi_epi16(dl_ch128[0], coeff128),15)));
//avg128D = _mm_add_epi32(avg128D,_mm_madd_epi16(dl_ch128[1],_mm_srai_epi16(_mm_mulhi_epi16(dl_ch128[1], coeff128),15)));
if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))&&(frame_parms->mode1_flag==0)) {
dl_ch128+=2;
}
else {
avg128D = _mm_add_epi32(avg128D,_mm_madd_epi16(dl_ch128[2],_mm_srai_epi16(_mm_mulhi_epi16(dl_ch128[2], coeff128),15)));
avg128D = _mm_add_epi32(avg128D,_mm_srai_epi16(_mm_madd_epi16(dl_ch128[2],dl_ch128[2]),x));
//avg128D = _mm_add_epi32(avg128D,_mm_madd_epi16(dl_ch128[2],_mm_srai_epi16(_mm_mulhi_epi16(dl_ch128[2], coeff128),15)));
dl_ch128+=3;
}
/*
......@@ -3424,11 +3464,11 @@ void dlsch_channel_level(int **dl_ch_estimates_ext,
*/
}
avg[(aatx<<1)+aarx] =(((int32_t*)&avg128D)[0] +
((int32_t*)&avg128D)[1] +
((int32_t*)&avg128D)[2] +
((int32_t*)&avg128D)[3]);
// printf("Channel level : %d\n",avg[(aatx<<1)+aarx]);
avg[(aatx<<1)+aarx] = (((int32_t*)&avg128D)[0] +
((int32_t*)&avg128D)[1] +
((int32_t*)&avg128D)[2] +
((int32_t*)&avg128D)[3])/y;
//printf("Channel level : %d\n",avg[(aatx<<1)+aarx]);
}
_mm_empty();
......
......@@ -693,9 +693,8 @@ int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t num_pdcch_symbols,
uint16_t nb_rb,
uint8_t subframe,
uint32_t rb_alloc,
uint16_t mod_order_0,
LTE_UE_DLSCH_t *dlsch0)
uint32_t rb_alloc)
{
int16_t rho_amp_x0[2*frame_parms->N_RB_DL*12];
......@@ -726,7 +725,7 @@ int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
amp_tmp=0x1fff;//1.5*dlsch0->sqrt_rho_a; already taken into account
if (mod_order_0==6)
amp_tmp=amp_tmp<<1; // to compensate for >> 1 shift in modulation to avoid overflow
amp_tmp=amp_tmp<<1; // to compensate for >> 1 shift in modulation
pbch_pss_sss_adjust=adjust_G2(frame_parms,&rb_alloc,2,subframe,symbol);
......@@ -933,10 +932,8 @@ void dlsch_16qam_llr_SIC (LTE_DL_FRAME_PARMS *frame_parms,
int32_t **dl_ch_mag,
uint16_t nb_rb,
uint8_t subframe,
uint32_t rb_alloc,
uint16_t mod_order_0,
LTE_UE_DLSCH_t *dlsch0
)
uint32_t rb_alloc)
{
int16_t rho_amp_x0[2*frame_parms->N_RB_DL*12];
int16_t rho_rho_amp_x0[2*frame_parms->N_RB_DL*12];
......@@ -1197,10 +1194,8 @@ void dlsch_64qam_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **dl_ch_magb,
uint16_t nb_rb,
uint8_t subframe,
uint32_t rb_alloc,
uint16_t mod_order_0,
LTE_UE_DLSCH_t *dlsch0
)
uint32_t rb_alloc)
{
int16_t rho_amp_x0[2*frame_parms->N_RB_DL*12];
int16_t rho_rho_amp_x0[2*frame_parms->N_RB_DL*12];
......
......@@ -23,6 +23,8 @@ extern unsigned int dlsch_tbs25[27][25],TBStable[27][110],TBStable1C[32];
extern unsigned short lte_cqi_eff1024[16];
extern char lte_cqi_snr_dB[15];
extern short conjugate[8],conjugate2[8];
extern short minus_one[8];
extern short minus_one[8];
extern short *ul_ref_sigs[30][2][33];
extern short *ul_ref_sigs_rx[30][2][33];
extern unsigned short dftsizes[33];
......
......@@ -43,13 +43,13 @@ extern openair0_config_t openair0_cfg[];
//#define DEBUG_INITIAL_SYNCH
int pbch_detection(PHY_VARS_UE *ue, runmode_t mode)
int pbch_detection(PHY_VARS_UE *ue, runmode_t mode)
{
uint8_t l,pbch_decoded,frame_mod4,pbch_tx_ant,dummy;
LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
char phich_resource[6];
#ifdef DEBUG_INITIAL_SYNCH
LOG_I(PHY,"[UE%d] Initial sync: starting PBCH detection (rx_offset %d)\n",ue->Mod_id,
ue->rx_offset);
......@@ -63,7 +63,7 @@ int pbch_detection(PHY_VARS_UE *ue, runmode_t mode)
ue->rx_offset,
0,
1);
}
}
for (l=0; l<frame_parms->symbols_per_tti/2; l++) {
slot_fep(ue,
......@@ -72,7 +72,7 @@ int pbch_detection(PHY_VARS_UE *ue, runmode_t mode)
ue->rx_offset,
0,
1);
}
}
slot_fep(ue,
0,
2,
......@@ -83,9 +83,11 @@ int pbch_detection(PHY_VARS_UE *ue, runmode_t mode)
lte_ue_measurements(ue,
ue->rx_offset,
0,
0,0);
0,
0,
0);
if (ue->frame_parms.frame_type == TDD) {
ue_rrc_measurements(ue,
2,
......@@ -541,8 +543,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
ue->measurements.n0_power_tot_dBm,
10*log10(ue->measurements.rsrp[0])-ue->rx_total_gain_dB,
(10*log10(ue->measurements.rsrq[0])));
LOG_I(PHY, "[UE %d] Frame %d MIB Information => %s, %s, NidCell %d, N_RB_DL %d, PHICH DURATION %d, PHICH RESOURCE %s, TX_ANT %d\n",
ue->Mod_id,
ue->proc.proc_rxtx[0].frame_rx,
......@@ -599,7 +600,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++)
rx_power += signal_energy(&ue->common_vars.rxdata[aarx][sync_pos2],
frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples);
/*
// do a measurement on the full frame
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++)
......@@ -608,7 +609,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
*/
// we might add a low-pass filter here later
ue->measurements.rx_power_avg[0] = rx_power/frame_parms->nb_antennas_rx;
ue->measurements.rx_power_avg[0] = rx_power/frame_parms->nb_antennas_rx;
ue->measurements.rx_power_avg_dB[0] = dB_fixed(ue->measurements.rx_power_avg[0]);
......@@ -617,7 +618,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
#endif
#ifndef OAI_USRP
#ifndef OAI_BLADERF
#ifndef OAI_BLADERF
#ifndef OAI_LMSSDR
phy_adjust_gain(ue,ue->measurements.rx_power_avg_dB[0],0);
#endif
......@@ -628,7 +629,7 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
else {
#ifndef OAI_USRP
#ifndef OAI_BLADERF
#ifndef OAI_BLADERF
#ifndef OAI_LMSSDR
phy_adjust_gain(ue,dB_fixed(ue->measurements.rssi),0);
#endif
......
......@@ -112,7 +112,7 @@ LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag);
@returns status
*/
int32_t dlsch_encoding(PHY_VARS_eNB *eNB,
uint8_t *a,
uint8_t *a,
uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch,
int frame,
......@@ -157,14 +157,14 @@ int32_t dlsch_encoding_SIC(PHY_VARS_UE *ue,
@returns status
*/
int32_t dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
uint8_t *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);
uint8_t *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);
void dlsch_encoding_emul(PHY_VARS_eNB *phy_vars_eNB,
uint8_t *DLSCH_pdu,
......@@ -263,11 +263,11 @@ int32_t allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB,
uint32_t *re_allocated,
uint8_t skip_dc,
uint8_t skip_half,
uint8_t lprime,
uint8_t mprime,
uint8_t Ns,
int *P1_SHIFT,
int *P2_SHIFT);
uint8_t lprime,
uint8_t mprime,
uint8_t Ns,
int *P1_SHIFT,
int *P2_SHIFT);
/** \fn int32_t dlsch_modulation(int32_t **txdataF,
......@@ -387,7 +387,7 @@ int32_t generate_pilots_slot(PHY_VARS_eNB *phy_vars_eNB,
int32_t generate_mbsfn_pilot(PHY_VARS_eNB *phy_vars_eNB,
eNB_rxtx_proc_t *proc,
int32_t **txdataF,
int32_t **txdataF,
int16_t amp);
void generate_ue_spec_pilots(PHY_VARS_eNB *phy_vars_eNB,
......@@ -395,7 +395,7 @@ void generate_ue_spec_pilots(PHY_VARS_eNB *phy_vars_eNB,
int32_t **txdataF,
int16_t amp,
uint16_t Ntti,
uint8_t beamforming_mode);
uint8_t beamforming_mode);
int32_t generate_pss(int32_t **txdataF,
int16_t amp,
......@@ -841,16 +841,15 @@ int32_t dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms,
*/
int32_t dlsch_qpsk_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
int **rxdataF_comp,
int32_t **sic_buffer,
int **rho_i,
short *dlsch_llr,
uint8_t num_pdcch_symbols,
uint16_t nb_rb,
uint8_t subframe,
uint32_t rb_alloc,
uint16_t mod_order_0,
LTE_UE_DLSCH_t *dlsch0);
int **rxdataF_comp,
int32_t **sic_buffer,
int **rho_i,
short *dlsch_llr,
uint8_t num_pdcch_symbols,
uint16_t nb_rb,
uint8_t subframe,
uint16_t mod_order_0,
uint32_t rb_alloc);
void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
......@@ -877,30 +876,28 @@ void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
*/
void dlsch_16qam_llr_SIC (LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
int32_t **sic_buffer, //Q15
int32_t **rho_i,
int16_t *dlsch_llr,
uint8_t num_pdcch_symbols,
int32_t **dl_ch_mag,
uint16_t nb_rb,
uint8_t subframe,
uint32_t rb_alloc,
int32_t **sic_buffer, //Q15
int32_t **rho_i,
int16_t *dlsch_llr,
uint8_t num_pdcch_symbols,
int32_t **dl_ch_mag,
uint16_t nb_rb,
uint8_t subframe,
uint16_t mod_order_0,
LTE_UE_DLSCH_t *dlsch0);
uint32_t rb_alloc);
void dlsch_64qam_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
int32_t **sic_buffer, //Q15
int32_t **rho_i,
int16_t *dlsch_llr,
uint8_t num_pdcch_symbols,
int32_t **dl_ch_mag,
int32_t **dl_ch_magb,
uint16_t nb_rb,
uint8_t subframe,
uint32_t rb_alloc,
int32_t **sic_buffer, //Q15
int32_t **rho_i,
int16_t *dlsch_llr,
uint8_t num_pdcch_symbols,
int32_t **dl_ch_mag,
int32_t **dl_ch_magb,
uint16_t nb_rb,
uint8_t subframe,
uint16_t mod_order_0,
LTE_UE_DLSCH_t *dlsch0);
uint32_t rb_alloc);
void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
......@@ -1170,6 +1167,58 @@ void dlsch_dual_stream_correlationTM34(LTE_DL_FRAME_PARMS *frame_parms,
int **dl_ch_rho_ext,
unsigned char output_shift0,
unsigned char output_shift1);
//This function is used to compute multiplications in Hhermitian * H matrix
void conjch0_mult_ch1(int *ch0,
int *ch1,
int32_t *ch0conj_ch1,
unsigned short nb_rb,
unsigned char output_shift0);
void construct_HhH_elements(int *ch0conj_ch0,
int *ch1conj_ch1,
int *ch2conj_ch2,
int *ch3conj_ch3,
int *ch0conj_ch1,
int *ch1conj_ch0,
int *ch2conj_ch3,
int *ch3conj_ch2,
int32_t *after_mf_00,
int32_t *after_mf_01,
int32_t *after_mf_10,
int32_t *after_mf_11,
unsigned short nb_rb);
void squared_matrix_element(int32_t *Hh_h_00,
int32_t *Hh_h_00_sq,
unsigned short nb_rb);
void dlsch_channel_level_TM34_meas(int *ch00,
int *ch01,
int *ch10,
int *ch11,
int *avg_0,
int *avg_1,
unsigned short nb_rb);
void det_HhH(int32_t *after_mf_00,
int32_t *after_mf_01,
int32_t *after_mf_10,
int32_t *after_mf_11,
int32_t *det_fin_128,
unsigned short nb_rb);
void numer(int32_t *Hh_h_00_sq,
int32_t *Hh_h_01_sq,
int32_t *Hh_h_10_sq,
int32_t *Hh_h_11_sq,
int32_t *num_fin,
unsigned short nb_rb);
uint8_t rank_estimation_tm3_tm4(int *dl_ch_estimates_00,
int *dl_ch_estimates_01,
int *dl_ch_estimates_10,
int *dl_ch_estimates_11,
unsigned short nb_rb);
void dlsch_channel_compensation_TM56(int **rxdataF_ext,
int **dl_ch_estimates_ext,
......@@ -1325,7 +1374,7 @@ int32_t rx_pdcch(PHY_VARS_UE *ue,
int pss_sss_extract(PHY_VARS_UE *phy_vars_ue,
int32_t pss_ext[4][72],
int32_t sss_ext[4][72],
uint8_t subframe);
uint8_t subframe);
/*! \brief Extract only PSS resource elements
@param phy_vars_ue Pointer to UE variables
......@@ -1598,7 +1647,7 @@ int32_t generate_srs_tx(PHY_VARS_UE *phy_vars_ue,
*/
int32_t generate_drs_pusch(PHY_VARS_UE *phy_vars_ue,
UE_rxtx_proc_t *proc,
UE_rxtx_proc_t *proc,
uint8_t eNB_id,
int16_t amp,
uint32_t subframe,
......@@ -1681,7 +1730,7 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu,
DCI_format_t dci_format,
PHY_VARS_UE *phy_vars_ue,
UE_rxtx_proc_t *proc,
uint16_t si_rnti,
uint16_t si_rnti,
uint16_t ra_rnti,
uint16_t p_rnti,
uint16_t cba_rnti,
......@@ -1689,21 +1738,21 @@ int generate_ue_ulsch_params_from_dci(void *dci_pdu,
uint8_t use_srs);
int32_t generate_ue_ulsch_params_from_rar(PHY_VARS_UE *phy_vars_ue,
UE_rxtx_proc_t *proc,
uint8_t eNB_id);
UE_rxtx_proc_t *proc,
uint8_t eNB_id);
double sinr_eff_cqi_calc(PHY_VARS_UE *phy_vars_ue,
uint8_t eNB_id,
uint8_t subframe);
uint8_t subframe);
uint8_t sinr2cqi(double sinr,uint8_t trans_mode);
int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *PHY_vars_eNB,
eNB_rxtx_proc_t *proc,
void *dci_pdu,
eNB_rxtx_proc_t *proc,
void *dci_pdu,
rnti_t rnti,
DCI_format_t dci_format,
DCI_format_t dci_format,
uint8_t UE_id,
uint16_t si_rnti,
uint16_t si_rnti,
uint16_t ra_rnti,
uint16_t p_rnti,
uint16_t cba_rnti,
......@@ -1759,13 +1808,13 @@ int initial_sync(PHY_VARS_UE *phy_vars_ue, runmode_t mode);
void rx_ulsch(PHY_VARS_eNB *phy_vars_eNB,
eNB_rxtx_proc_t *proc,
uint8_t eNB_id, // this is the effective sector id
uint8_t eNB_id, // this is the effective sector id
uint8_t UE_id,
LTE_eNB_ULSCH_t **ulsch,
uint8_t cooperation_flag);
void rx_ulsch_emul(PHY_VARS_eNB *phy_vars_eNB,
eNB_rxtx_proc_t *proc,
eNB_rxtx_proc_t *proc,
uint8_t sect_id,
uint8_t UE_index);
......@@ -1815,7 +1864,7 @@ int32_t ulsch_encoding_emul(uint8_t *ulsch_buffer,
@returns 0 on success
*/
unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
eNB_rxtx_proc_t *proc,
eNB_rxtx_proc_t *proc,
uint8_t UE_id,
uint8_t control_only_flag,
uint8_t Nbundled,
......@@ -1830,9 +1879,9 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *phy_vars_eNB,
@returns 0 on success
*/
int ulsch_decoding_data_2thread(PHY_VARS_eNB *eNB,
int UE_id,
int harq_pid,
int llr8_flag);
int UE_id,
int harq_pid,
int llr8_flag);
/*!
\brief Decoding of ULSCH data component from 36-212. This one is single thread.
......@@ -1843,17 +1892,17 @@ int ulsch_decoding_data_2thread(PHY_VARS_eNB *eNB,
@returns 0 on success
*/
int ulsch_decoding_data(PHY_VARS_eNB *eNB,
int UE_id,
int harq_pid,
int llr8_flag);
int UE_id,
int harq_pid,
int llr8_flag);
uint32_t ulsch_decoding_emul(PHY_VARS_eNB *phy_vars_eNB,
eNB_rxtx_proc_t *proc,
uint8_t UE_index,
uint8_t UE_index,
uint16_t *crnti);
void generate_phich_top(PHY_VARS_eNB *phy_vars_eNB,
eNB_rxtx_proc_t *proc,
eNB_rxtx_proc_t *proc,
int16_t amp,
uint8_t sect_id);
......@@ -1865,7 +1914,7 @@ void generate_phich_top(PHY_VARS_eNB *phy_vars_eNB,
*/
void rx_phich(PHY_VARS_UE *phy_vars_ue,
UE_rxtx_proc_t *proc,
UE_rxtx_proc_t *proc,
uint8_t subframe,
uint8_t eNB_id);
......@@ -1977,28 +2026,28 @@ void dlsch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms,
void init_ncs_cell(LTE_DL_FRAME_PARMS *frame_parms,uint8_t ncs_cell[20][7]);
void generate_pucch1x(int32_t **txdataF,
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t ncs_cell[20][7],
PUCCH_FMT_t fmt,
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
uint16_t n1_pucch,
uint8_t shortened_format,
uint8_t *payload,
int16_t amp,
uint8_t subframe);
LTE_DL_FRAME_PARMS *frame_parms,
uint8_t ncs_cell[20][7],
PUCCH_FMT_t fmt,
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
uint16_t n1_pucch,
uint8_t shortened_format,
uint8_t *payload,
int16_t amp,
uint8_t subframe);
void generate_pucch2x(int32_t **txdataF,
LTE_DL_FRAME_PARMS *fp,
uint8_t ncs_cell[20][7],
PUCCH_FMT_t fmt,
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
uint16_t n2_pucch,
uint8_t *payload,
int A,
int B2,
int16_t amp,
uint8_t subframe,
uint16_t rnti);
LTE_DL_FRAME_PARMS *fp,
uint8_t ncs_cell[20][7],
PUCCH_FMT_t fmt,
PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
uint16_t n2_pucch,
uint8_t *payload,
int A,
int B2,
int16_t amp,
uint8_t subframe,
uint16_t rnti);
void generate_pucch3x(int32_t **txdataF,
LTE_DL_FRAME_PARMS *frame_parms,
......@@ -2013,7 +2062,7 @@ void generate_pucch3x(int32_t **txdataF,
uint16_t rnti);
void generate_pucch_emul(PHY_VARS_UE *phy_vars_ue,
UE_rxtx_proc_t *proc,
UE_rxtx_proc_t *proc,
PUCCH_FMT_t format,
uint8_t ncs1,
uint8_t *pucch_ack_payload,
......@@ -2033,11 +2082,11 @@ uint32_t rx_pucch(PHY_VARS_eNB *phy_vars_eNB,
uint8_t pucch1_thres);
int32_t rx_pucch_emul(PHY_VARS_eNB *phy_vars_eNB,
eNB_rxtx_proc_t *proc,
uint8_t UE_index,
PUCCH_FMT_t fmt,
uint8_t n1_pucch_sel,
uint8_t *payload);
eNB_rxtx_proc_t *proc,
uint8_t UE_index,
PUCCH_FMT_t fmt,
uint8_t n1_pucch_sel,
uint8_t *payload);
/*!
......
......@@ -59,8 +59,8 @@ char lte_cqi_snr_dB[15] = { -2,
unsigned char ue_power_offsets[25] = {14,11,9,8,7,6,6,5,4,4,4,3,3,3,2,2,2,1,1,1,1,1,0,0,0};
short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1} ;
short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1} ;
short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1};
short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1};
int qam64_table[8],qam16_table[4];
......
......@@ -338,6 +338,9 @@ uint8_t log2_approx64(unsigned long long int x);
int16_t invSqrt(int16_t x);
uint32_t angle(struct complex16 perrror);
/// computes the number of factors 2 in x
unsigned char factor2(unsigned int x);
/*!\fn int32_t phy_phase_compensation_top (uint32_t pilot_type, uint32_t initial_pilot,
uint32_t last_pilot, int32_t ignore_prefix);
Compensate the phase rotation of the RF. WARNING: This function is currently unused. It has not been tested!
......
......@@ -37,6 +37,26 @@ unsigned char log2_approx(unsigned int x)
return(l2);
}
unsigned char factor2(unsigned int x)
{
int i;
unsigned char l2;
l2=0;
for (i=0; i<31; i++)
if ((x&(1<<i)) != 0)
break;
l2 = i;
//printf("factor2(%d) = %d\n",x,l2);
return(l2);
}
unsigned char log2_approx64(unsigned long long int x)
{
......
......@@ -24,6 +24,7 @@
#include "lte_phy_scope.h"
#define TPUT_WINDOW_LENGTH 100
int otg_enabled;
int use_sic_receiver=0;
FL_COLOR rx_antenna_colors[4] = {FL_RED,FL_BLUE,FL_GREEN,FL_YELLOW};
float tput_time_enb[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}};
float tput_enb[NUMBER_OF_UE_MAX][TPUT_WINDOW_LENGTH] = {{0}};
......@@ -54,6 +55,21 @@ static void dl_traffic_on_off( FL_OBJECT *button, long arg)
fl_set_object_color(button, FL_RED, FL_RED);
}
}
static void sic_receiver_on_off( FL_OBJECT *button, long arg)
{
if (fl_get_button(button)) {
fl_set_object_label(button, "SIC Receiver ON");
use_sic_receiver = 1;
fl_set_object_color(button, FL_GREEN, FL_GREEN);
} else {
fl_set_object_label(button, "SIC Receiver OFF");
use_sic_receiver = 0;
fl_set_object_color(button, FL_RED, FL_RED);
}
}
FD_lte_phy_scope_enb *create_lte_phy_scope_enb( void )
{
FL_OBJECT *obj;
......@@ -398,16 +414,17 @@ FD_lte_phy_scope_ue *create_lte_phy_scope_ue( void ) {
fl_set_object_boxtype( fdui->pdsch_tput, FL_EMBOSSED_BOX );
fl_set_object_color( fdui->pdsch_tput, FL_BLACK, FL_WHITE );
fl_set_object_lcolor( fdui->pdsch_tput, FL_WHITE ); // Label color
*/
// Generic UE Button
fdui->button_0 = fl_add_button( FL_PUSH_BUTTON, 540, 720, 240, 40, "" );
fl_set_object_lalign(fdui->button_0, FL_ALIGN_CENTER );
//openair_daq_vars.use_ia_receiver = 0;
//use_sic_receiver = 0;
fl_set_button(fdui->button_0,0);
fl_set_object_label(fdui->button_0, "IA Receiver OFF");
fl_set_object_label(fdui->button_0, "SIC Receiver OFF");
fl_set_object_color(fdui->button_0, FL_RED, FL_RED);
fl_set_object_callback(fdui->button_0, ia_receiver_on_off, 0 );
fl_set_object_callback(fdui->button_0, sic_receiver_on_off, 0 );
fl_hide_object(fdui->button_0);
*/
fl_end_form( );
fdui->lte_phy_scope_ue->fdui = fdui;
return fdui;
......@@ -461,6 +478,7 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
}
*/
}
fl_show_object(form->button_0);
if (phy_vars_ue->dlsch[subframe&0x1][eNB_id][1]!=NULL) {
harq_pid = phy_vars_ue->dlsch[subframe&0x1][eNB_id][1]->current_harq_pid;
if (harq_pid>=8)
......@@ -797,4 +815,16 @@ void phy_scope_UE(FD_lte_phy_scope_ue *form,
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){
for (int i = 0; i<8; ++i)
for (int j = 0; j < 7*2*frame_parms->N_RB_DL*12+4; ++j )
phy_vars_ue->pdsch_vars[subframe&0x1][eNB_id]->rxdataF_comp1[0][0][i][j]=0;
for (int m=0; m<coded_bits_per_codeword1; ++m)
phy_vars_ue->pdsch_vars[subframe&0x1][eNB_id]->llr[0][m]=0;
}*/
}
......@@ -102,7 +102,7 @@ void phy_procedures_eNB_lte(uint8_t subframe,PHY_VARS_eNB **phy_vars_eNB,uint8_t
@param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
@param *phy_vars_rn pointer to RN variables
*/
void phy_procedures_UE_lte(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode,relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn);
void phy_procedures_UE_lte(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode,relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn);
#if defined(Rel10) || defined(Rel14)
/*! \brief Top-level entry routine for relay node procedures when acting as eNB. This proc will make us of the existing eNB procs.
......@@ -138,7 +138,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t
@param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
@param phy_vars_rn pointer to RN variables
*/
int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode,relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn);
int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,uint8_t do_pdcch_flag,runmode_t mode,relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn);
/*! \brief Scheduling for UE TX procedures in TDD S-subframes.
@param phy_vars_ue Pointer to UE variables on which to act
......@@ -163,7 +163,7 @@ void phy_procedures_UE_S_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abst
@param phy_vars_rn pointer to the RN variables
@param do_meas Do inline timing measurement
*/
void phy_procedures_eNB_TX(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc,relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn,int do_meas);
void phy_procedures_eNB_TX(PHY_VARS_eNB *phy_vars_eNB,eNB_rxtx_proc_t *proc,relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn,int do_meas, int do_pdcch_flag);
/*! \brief Scheduling for eNB RX UE-specific procedures in normal subframes.
@param phy_vars_eNB Pointer to eNB variables on which to act
......
......@@ -1147,7 +1147,8 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
eNB_rxtx_proc_t *proc,
relaying_type_t r_type,
PHY_VARS_RN *rn,
int do_meas)
int do_meas,
int do_pdcch_flag)
{
UNUSED(rn);
int frame=proc->frame_tx;
......@@ -1317,21 +1318,6 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
}
num_pdcch_symbols = DCI_pdu->num_pdcch_symbols;
LOG_D(PHY,"num_pdcch_symbols %"PRIu8",(dci common %"PRIu8", dci uespec %"PRIu8"\n",num_pdcch_symbols,
DCI_pdu->Num_common_dci,DCI_pdu->Num_ue_spec_dci);
#if defined(SMBV)
// Sets up PDCCH and DCI table
if (smbv_is_config_frame(frame) && (smbv_frame_cnt < 4) && ((DCI_pdu->Num_common_dci+DCI_pdu->Num_ue_spec_dci)>0)) {
LOG_D(PHY,"[SMBV] Frame %3d, SF %d PDCCH, number of DCIs %d\n",frame,subframe,DCI_pdu->Num_common_dci+DCI_pdu->Num_ue_spec_dci);
dump_dci(fp,&DCI_pdu->dci_alloc[0]);
smbv_configure_pdcch(smbv_fname,(smbv_frame_cnt*10) + (subframe),num_pdcch_symbols,DCI_pdu->Num_common_dci+DCI_pdu->Num_ue_spec_dci);
}
#endif
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_DCI_INFO,DCI_pdu->num_pdcch_symbols);
// loop over all DCIs for this subframe to generate DLSCH allocations
for (i=0; i<DCI_pdu->Num_common_dci + DCI_pdu->Num_ue_spec_dci ; i++) {
LOG_D(PHY,"[eNB] Subframe %d: DCI %d/%d : rnti %x, CCEind %d\n",subframe,i,DCI_pdu->Num_common_dci+DCI_pdu->Num_ue_spec_dci,DCI_pdu->dci_alloc[i].rnti,DCI_pdu->dci_alloc[i].firstCCE);
......@@ -1390,23 +1376,28 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
eNB->num_common_dci[(subframe)&1]=0;
}
if (eNB->abstraction_flag == 0) {
if (do_pdcch_flag) {
if (DCI_pdu->Num_ue_spec_dci+DCI_pdu->Num_common_dci > 0) {
LOG_D(PHY,"[eNB %"PRIu8"] Frame %d, subframe %d: Calling generate_dci_top (pdcch) (common %"PRIu8",ue_spec %"PRIu8")\n",eNB->Mod_id,frame, subframe,
DCI_pdu->Num_common_dci,DCI_pdu->Num_ue_spec_dci);
}
if (DCI_pdu->Num_ue_spec_dci+DCI_pdu->Num_common_dci > 0) {
LOG_D(PHY,"[eNB %"PRIu8"] Frame %d, subframe %d: Calling generate_dci_top (pdcch) (common %"PRIu8",ue_spec %"PRIu8")\n",eNB->Mod_id,frame, subframe,
DCI_pdu->Num_common_dci,DCI_pdu->Num_ue_spec_dci);
num_pdcch_symbols = generate_dci_top(DCI_pdu->Num_ue_spec_dci,
DCI_pdu->Num_common_dci,
DCI_pdu->dci_alloc,
0,
AMP,
fp,
eNB->common_vars.txdataF[0],
subframe);
}
else {
num_pdcch_symbols = DCI_pdu->num_pdcch_symbols;
LOG_D(PHY,"num_pdcch_symbols %"PRIu8" (dci common %"PRIu8", dci uespec %"PRIu8")\n",num_pdcch_symbols,
DCI_pdu->Num_common_dci,DCI_pdu->Num_ue_spec_dci);
}
num_pdcch_symbols = generate_dci_top(DCI_pdu->Num_ue_spec_dci,
DCI_pdu->Num_common_dci,
DCI_pdu->dci_alloc,
0,
AMP,
fp,
eNB->common_vars.txdataF[0],
subframe);
}
#ifdef PHY_ABSTRACTION // FIXME this ifdef seems suspicious
......@@ -1417,8 +1408,19 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
#endif
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_DCI_INFO,DCI_pdu->num_pdcch_symbols);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,0);
#if defined(SMBV)
// Sets up PDCCH and DCI table
if (smbv_is_config_frame(frame) && (smbv_frame_cnt < 4) && ((DCI_pdu->Num_common_dci+DCI_pdu->Num_ue_spec_dci)>0)) {
LOG_D(PHY,"[SMBV] Frame %3d, SF %d PDCCH, number of DCIs %d\n",frame,subframe,DCI_pdu->Num_common_dci+DCI_pdu->Num_ue_spec_dci);
dump_dci(fp,&DCI_pdu->dci_alloc[0]);
smbv_configure_pdcch(smbv_fname,(smbv_frame_cnt*10) + (subframe),num_pdcch_symbols,DCI_pdu->Num_common_dci+DCI_pdu->Num_ue_spec_dci);
}
#endif
// Check for SI activity
if ((eNB->dlsch_SI) && (eNB->dlsch_SI->active == 1)) {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -705,7 +705,7 @@ void fill_DCI(PHY_VARS_eNB *eNB,
dci_alloc[*num_dci].format = format2A;
dump_dci(&eNB->frame_parms,&dci_alloc[*num_dci]);
printf("Generating dlsch params for user %d / format 2A (%d)\n",k,format2A);
//printf("Generating dlsch params for user %d / format 2A (%d)\n",k,format2A);
generate_eNB_dlsch_params_from_dci(0,
subframe,
&DLSCH_alloc_pdu_1[0],
......@@ -846,7 +846,7 @@ void fill_DCI(PHY_VARS_eNB *eNB,
dci_alloc[*num_dci].firstCCE = 0;
dump_dci(&eNB->frame_parms,&dci_alloc[*num_dci]);
printf("Generating dlsch params for user %d\n",k);
//printf("Generating dlsch params for user %d\n",k);
generate_eNB_dlsch_params_from_dci(0,
subframe,
&DLSCH_alloc_pdu_1[0],
......@@ -866,7 +866,7 @@ void fill_DCI(PHY_VARS_eNB *eNB,
}
printf("Generated DCI format 2A (Transmission Mode 3)\n");
//printf("Generated DCI format 2A (Transmission Mode 3)\n");
break;
case 4:
......@@ -1292,7 +1292,6 @@ int main(int argc, char **argv)
uint16_t tdd_config=3;
SCM_t channel_model=Rayleigh1;
// unsigned char *input_data,*decoded_output;
......@@ -1366,6 +1365,7 @@ int main(int argc, char **argv)
int rballocset=0;
int print_perf=0;
int test_perf=0;
int test_passed=0;
int dump_table=0;
double effective_rate=0.0;
......@@ -1391,10 +1391,13 @@ int main(int argc, char **argv)
FILE *csv_fd=NULL;
char csv_fname[32];
//int dci_flag=1;
int dci_flag=0;
int two_thread_flag=0;
int DLSCH_RB_ALLOC = 0;
int log_level = LOG_ERR;
int dci_received;
#if defined(__arm__)
FILE *proc_fd = NULL;
char buf[64];
......@@ -1418,15 +1421,13 @@ int main(int argc, char **argv)
//signal(SIGSEGV, handler);
//signal(SIGABRT, handler);
logInit();
// default parameters
n_frames = 1000;
snr0 = 0;
// num_layers = 1;
perfect_ce = 0;
while ((c = getopt (argc, argv, "ahdpZDe:Em:n:o:s:f:t:c:g:r:F:x:q:y:z:AM:N:I:i:O:R:S:C:T:b:u:v:w:B:Pl:WXY")) != -1) {
while ((c = getopt (argc, argv, "ahdpZDe:Em:n:o:s:f:t:c:g:r:F:x:q:y:z:AM:N:I:i:O:R:S:C:T:b:u:v:w:B:Pl:WXYL:")) != -1) {
switch (c) {
case 'a':
awgn_flag = 1;
......@@ -1453,9 +1454,9 @@ int main(int argc, char **argv)
Nid_cell = atoi(optarg);
break;
//case 'd':
// dci_flag = 1;
// break;
case 'd':
dci_flag = 1;
break;
case 'D':
frame_type=TDD;
......@@ -1482,7 +1483,7 @@ int main(int argc, char **argv)
case 'i':
input_fd = fopen(optarg,"r");
input_file=1;
//dci_flag = 1;
dci_flag = 1;
break;
case 'I':
......@@ -1722,7 +1723,9 @@ int main(int argc, char **argv)
dump_table=1;
break;
case 'L':
log_level=atoi(optarg);
break;
case 'h':
default:
......@@ -1732,12 +1735,17 @@ int main(int argc, char **argv)
printf("-c Number of PDCCH symbols\n");
printf("-m MCS1 for TB 1\n");
printf("-M MCS2 for TB 2\n");
printf("-d Transmit the DCI and compute its error statistics and the overall throughput\n");
printf("-d Transmit the DCI and compute its error statistics\n");
printf("-p Use extended prefix mode\n");
printf("-n Number of frames to simulate\n");
printf("-o Sample offset for receiver\n");
printf("-s Starting SNR, runs from SNR to SNR+%.1fdB in steps of %.1fdB. If n_frames is 1 then just SNR is simulated and MATLAB/OCTAVE output is generated\n", snr_int, snr_step);
printf("-f step size of SNR, default value is 1.\n");
printf("-C cell id\n");
printf("-S subframe\n");
printf("-D use TDD mode\n");
printf("-b TDD config\n");
printf("-B bandwidth configuration (in number of ressource blocks): 6, 25, 50, 100\n");
printf("-r ressource block allocation (see section 7.1.6.3 in 36.213\n");
printf("-g [A:M] Use 3GPP 25.814 SCM-A/B/C/D('A','B','C','D') or 36-101 EPA('E'), EVA ('F'),ETU('G') models (ignores delay spread and Ricean factor), Rayghleigh8 ('H'), Rayleigh1('I'), Rayleigh1_corr('J'), Rayleigh1_anticorr ('K'), Rice8('L'), Rice1('M')\n");
printf("-F forgetting factor (0 new channel every trial, 1 channel constant\n");
......@@ -1757,6 +1765,16 @@ int main(int argc, char **argv)
}
}
logInit();
// enable these lines if you need debug info
set_comp_log(PHY,LOG_DEBUG,LOG_HIGH,1);
set_glog(log_level,LOG_HIGH);
// moreover you need to init itti with the following line
// however itti will catch all signals, so ctrl-c won't work anymore
// alternatively you can disable ITTI completely in CMakeLists.txt
//itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL);
if (common_flag == 0) {
switch (N_RB_DL) {
case 6:
......@@ -2159,7 +2177,7 @@ int main(int argc, char **argv)
TPC,
mcs1,
mcs2,
0,
1,
0,
&num_common_dci,
&num_ue_spec_dci,
......@@ -2318,10 +2336,10 @@ int main(int argc, char **argv)
//if (trials%100==0)
eNB2UE[0]->first_run = 1;
UE->dlsch[subframe&0x1][eNB_id][0]->harq_ack[subframe].ack = 0;
UE->dlsch[subframe&0x1][eNB_id][1]->harq_ack[subframe].ack = 0;
UE->dlsch_errors[0] = 1;
while ((round < num_rounds) && (UE->dlsch_errors[0] > 0)) {
while ((round < num_rounds) && (UE->dlsch[subframe&0x1][eNB_id][0]->harq_ack[subframe].ack == 0)) {
// printf("Trial %d, round %d\n",trials,round);
round_trials[round]++;
......@@ -2361,11 +2379,12 @@ int main(int argc, char **argv)
eNB->dlsch[0][0]->harq_processes[0]->rvidx = round&3;
fill_DCI(eNB,&dci_alloc[0],subframe,n_rnti,n_users,transmission_mode,common_flag,DLSCH_RB_ALLOC,TPC,mcs1,mcs2,trials&1,round&3,&num_common_dci,&num_ue_spec_dci,&num_dci);
fill_DCI(eNB,&dci_alloc[0],subframe,n_rnti,n_users,transmission_mode,common_flag,DLSCH_RB_ALLOC,TPC,
mcs1,mcs2,!(trials&1),round&3,&num_common_dci,&num_ue_spec_dci,&num_dci);
}
else {
fill_DCI(eNB,&dci_alloc[0],subframe,n_rnti,n_users,transmission_mode,common_flag,DLSCH_RB_ALLOC,TPC,
(TB0_active==1)?mcs1:0,mcs2,trials&1,(TB0_active==1)?round&3:0,&num_common_dci,&num_ue_spec_dci,&num_dci);
(TB0_active==1)?mcs1:0,mcs2,!(trials&1),(TB0_active==1)?round&3:0,&num_common_dci,&num_ue_spec_dci,&num_dci);
}
for (i=num_common_dci; i<num_dci; i++) {
......@@ -2419,7 +2438,7 @@ int main(int argc, char **argv)
proc_eNB->subframe_tx = subframe;
eNB->abstraction_flag=0;
phy_procedures_eNB_TX(eNB,proc_eNB,no_relay,NULL,1);
phy_procedures_eNB_TX(eNB,proc_eNB,no_relay,NULL,1,dci_flag);
start_meas(&eNB->ofdm_mod_stats);
......@@ -2455,7 +2474,7 @@ int main(int argc, char **argv)
proc_eNB->subframe_tx = subframe+1;
phy_procedures_eNB_TX(eNB,proc_eNB,no_relay,NULL,0);
phy_procedures_eNB_TX(eNB,proc_eNB,no_relay,NULL,0,dci_flag);
do_OFDM_mod_l(eNB->common_vars.txdataF[eNB_id],
eNB->common_vars.txdata[eNB_id],
......@@ -2496,7 +2515,7 @@ int main(int argc, char **argv)
UE_rxtx_proc_t *proc = &UE->proc.proc_rxtx[subframe&1];
proc->subframe_rx = subframe;
UE->UE_mode[0] = PUSCH;
UE->dlsch_errors[0] = 0;
// first symbol has to be done separately in one-shot mode
slot_fep(UE,
0,
......@@ -2506,12 +2525,46 @@ int main(int argc, char **argv)
0);
if (n_frames==1) printf("Running phy_procedures_UE_RX\n");
phy_procedures_UE_RX(UE,proc,0,0,normal_txrx,no_relay,NULL);
if (UE->dlsch[subframe&0x1][0][0]->active == 0) {
if (dci_flag==0) {
if (n_frames==1)
printf("bypassing PDCCH/DCI detection\n");
if (generate_ue_dlsch_params_from_dci(proc->frame_rx,
proc->subframe_rx,
(void *)&dci_alloc[0].dci_pdu,
n_rnti,
dci_alloc[0].format,
UE->dlsch[proc->subframe_rx&0x1][eNB_id],
&UE->frame_parms,
UE->pdsch_config_dedicated,
SI_RNTI,
0,
P_RNTI,
UE->transmission_mode[eNB_id]<7?0:UE->transmission_mode[eNB_id],
0)==0) {
dump_dci(&UE->frame_parms, &dci_alloc[0]);
//UE->dlsch[proc->subframe_rx&0x1][eNB_id][0]->active = 1;
//UE->dlsch[proc->subframe_rx&0x1][eNB_id][1]->active = 1;
UE->pdcch_vars[proc->subframe_rx&0x1][eNB_id]->num_pdcch_symbols = num_pdcch_symbols;
UE->dlsch_received[eNB_id]++;
} else {
LOG_E(PHY,"Problem in DCI!\n");
}
}
dci_received = UE->pdcch_vars[proc->subframe_rx & 0x1][eNB_id]->dci_received;
phy_procedures_UE_RX(UE,proc,0,0,dci_flag,normal_txrx,no_relay,NULL);
dci_received = dci_received - UE->pdcch_vars[proc->subframe_rx & 0x1][eNB_id]->dci_received;
if (dci_flag && (dci_received == 0)) {
//printf("DCI not received\n");
dci_errors[round]++;
UE->dlsch_errors[0] = 1;
/*
write_output("pdcchF0_ext.m","pdcchF_ext", UE->pdcch_vars[eNB_id]->rxdataF_ext[0],2*3*UE->frame_parms.ofdm_symbol_size,1,1);
......@@ -2582,7 +2635,7 @@ int main(int argc, char **argv)
if (UE->dlsch_errors[0] == 0) {
if (UE->dlsch[subframe&0x1][eNB_id][0]->harq_ack[subframe].ack == 1) {
avg_iter += UE->dlsch[subframe&0x1][eNB_id][0]->last_iteration_cnt;
iter_trials++;
......@@ -2862,15 +2915,15 @@ int main(int argc, char **argv)
errs2[0],
round_trials[0],
errs[1],
round_trials[0],
round_trials[1],
errs[2],
round_trials[0],
round_trials[2],
errs[3],
round_trials[0],
round_trials[3],
(double)errs[0]/(round_trials[0]),
(double)errs[1]/(round_trials[0]),
(double)errs[2]/(round_trials[0]),
(double)errs[3]/(round_trials[0]),
(double)errs[1]/(round_trials[1]),
(double)errs[2]/(round_trials[2]),
(double)errs[3]/(round_trials[3]),
dci_errors[0]+dci_errors[1]+dci_errors[2]+dci_errors[3],
round_trials[0]+round_trials[1]+round_trials[2]+round_trials[3],
(double)(dci_errors[0]+dci_errors[1]+dci_errors[2]+dci_errors[3])/(round_trials[0]+round_trials[1]+round_trials[2]+round_trials[3]),
......@@ -3193,9 +3246,11 @@ int main(int argc, char **argv)
UE->dlsch_decoding_stats[subframe&1].trials);
*/
printf("[passed] effective rate : %f (%2.1f%%,%f)): log and break \n",rate*effective_rate, 100*effective_rate, rate );
test_passed = 1;
break;
} else if (test_perf !=0 ) {
printf("[continue] effective rate : %f (%2.1f%%,%f)): increase snr \n",rate*effective_rate, 100*effective_rate, rate);
test_passed = 0;
}
if (((double)errs[0]/(round_trials[0]))<(10.0/n_frames))
......@@ -3246,8 +3301,10 @@ int main(int argc, char **argv)
free_ue_dlsch(UE->dlsch[subframe&0x1][0][i]);
}
return(0);
if (test_perf && !test_passed)
return(-1);
else
return(0);
}
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -937,6 +937,7 @@ int main(int argc, char **argv)
0,
1,
0,
0,
0);
/*
if (trial%100 == 0) {
......
......@@ -297,7 +297,7 @@ int main(int argc, char **argv)
}
logInit();
itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL);
//itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL);
g_log->log_component[PHY].level = LOG_DEBUG;
g_log->log_component[PHY].flag = LOG_HIGH;
......
......@@ -450,7 +450,7 @@ void proc_tx_high0(PHY_VARS_eNB *eNB,
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_ENB+offset, proc->frame_tx );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_ENB+offset, proc->subframe_tx );
phy_procedures_eNB_TX(eNB,proc,r_type,rn,1);
phy_procedures_eNB_TX(eNB,proc,r_type,rn,1,1);
/* we're done, let the next one proceed */
if (pthread_mutex_lock(&sync_phy_proc.mutex_phy_proc_tx) != 0) {
......
......@@ -555,7 +555,7 @@ static void *UE_thread_rxn_txnp4(void *arg) {
(sf_type==SF_UL? "SF_UL" :
(sf_type==SF_S ? "SF_S" : "UNKNOWN_SF_TYPE"))));
}
phy_procedures_UE_RX( UE, proc, 0, 0, UE->mode, no_relay, NULL );
phy_procedures_UE_RX( UE, proc, 0, 0, 1, UE->mode, no_relay, NULL );
}
#if UE_TIMING_TRACE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment