Commit bc6c0b05 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 d555f4a1 d6596227
......@@ -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
......
......@@ -189,6 +189,7 @@ void lte_ue_measurements(PHY_VARS_UE *phy_vars_ue,
unsigned int subframe_offset,
unsigned char N0_symbol,
unsigned char abstraction_flag,
unsigned char rank_adaptation,
uint8_t subframe);
//! \brief This function performance RSRP/RSCP measurements
......
......@@ -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)
......@@ -315,7 +318,6 @@ void ue_rrc_measurements(PHY_VARS_UE *ue,
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);
}
......@@ -454,6 +456,7 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
unsigned int subframe_offset,
unsigned char N0_symbol,
unsigned char abstraction_flag,
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++)
......@@ -572,7 +597,7 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
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
}
......@@ -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,27 +5206,36 @@ 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))
)
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_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;
//pdlsch0_harq->first_tx = 0;
}
else //normal retransmission
{
// nothing special to do
}
}
}
......@@ -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->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
}
/*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;
//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
}
}
}*/
// 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) {
}
/*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;
//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
}
}*/
// 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;
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_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:
......@@ -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] +
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]);
((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];
......
......@@ -83,7 +83,9 @@ 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) {
......@@ -542,7 +544,6 @@ int initial_sync(PHY_VARS_UE *ue, runmode_t mode)
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,
......
......@@ -848,9 +848,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);
void dlsch_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
......@@ -884,9 +883,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);
void dlsch_64qam_llr_SIC(LTE_DL_FRAME_PARMS *frame_parms,
int32_t **rxdataF_comp,
......@@ -898,9 +896,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);
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,
......
......@@ -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,14 +1376,14 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
eNB->num_common_dci[(subframe)&1]=0;
}
if (eNB->abstraction_flag == 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);
}
num_pdcch_symbols = generate_dci_top(DCI_pdu->Num_ue_spec_dci,
DCI_pdu->Num_common_dci,
DCI_pdu->dci_alloc,
......@@ -1406,7 +1392,12 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
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);
}
}
#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)) {
......
......@@ -1386,6 +1386,7 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empt
#if UE_TIMING_TRACE
stop_meas(&ue->ofdm_mod_stats);
#endif
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_COMMON,VCD_FUNCTION_OUT);
}
......@@ -1675,7 +1676,6 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
// compute CQI/RI resources
compute_cqi_ri_resources(ue, ue->ulsch[eNB_id], eNB_id, ue->ulsch[eNB_id]->rnti, P_RNTI, CBA_RNTI, cqi_status, ri_status);
if (ack_status_cw0 > 0) {
// check if we received a PDSCH at subframe_tx - 4
......@@ -1885,11 +1885,13 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
T(T_UE_PHY_PUSCH_TX_POWER, T_INT(eNB_id),T_INT(Mod_id), T_INT(frame_tx%1024), T_INT(subframe_tx),T_INT(ue->tx_power_dBm[subframe_tx]),
T_INT(tx_amp),T_INT(ue->ulsch[eNB_id]->f_pusch),T_INT(get_PL(Mod_id,0,eNB_id)),T_INT(nb_rb));
#endif
#ifdef UE_DEBUG_TRACE
LOG_I(PHY,"[UE %d][PUSCH %d] AbsSubFrame %d.%d, generating PUSCH, Po_PUSCH: %d dBm (max %d dBm), amp %d\n",
Mod_id,harq_pid,frame_tx%1024,subframe_tx,ue->tx_power_dBm[subframe_tx],ue->tx_power_max_dBm, tx_amp);
#endif
#if UE_TIMING_TRACE
start_meas(&ue->ulsch_modulation_stats);
#endif
ulsch_modulation(ue->common_vars.txdataF,
......@@ -2206,10 +2208,10 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
(uint8_t *)&pucch_payload,
&len);
LOG_D(PHY,"PUCCH feedback AbsSubframe %d.%d SR %d NbCW %d (%d %d) AckNack %d.%d CQI %d RI %d format %d pucch_resource %d pucch_payload %d %d \n",
frame_tx%1024, subframe_tx, SR_payload, nb_cw, ack_status_cw0, ack_status_cw1, pucch_ack_payload[0], pucch_ack_payload[1], cqi_status, ri_status, format, pucch_resource,pucch_payload[0],pucch_payload[1]);
// Part - IV
// Generate PUCCH signal
ue->generate_ul_signal[eNB_id] = 1;
......@@ -2402,6 +2404,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui
unsigned int aa;
uint8_t isSubframeSRS;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX,VCD_FUNCTION_IN);
#if T_TRACER
......@@ -2588,8 +2591,8 @@ void ue_measurement_procedures(
uint16_t slot, // slot index of each radio frame [0..19]
uint8_t abstraction_flag,runmode_t mode)
{
//LOG_I(PHY,"ue_measurement_procedures l %d Ncp %d\n",l,ue->frame_parms.Ncp);
//LOG_I(PHY,"ue_measurement_procedures l %d Ncp %d\n",l,ue->frame_parms.Ncp);
LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
......@@ -2605,12 +2608,15 @@ void ue_measurement_procedures(
lte_ue_measurements(ue,
(subframe_rx*frame_parms->samples_per_tti+ue->rx_offset)%(frame_parms->samples_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME),
(subframe_rx == 1) ? 1 : 0,
0,subframe_rx);
0,
0,
subframe_rx);
} else {
lte_ue_measurements(ue,
0,
0,
1,
0,
subframe_rx);
}
#if T_TRACER
......@@ -3146,7 +3152,6 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
(dci_alloc_rx[i].rnti == ue->pdcch_vars[subframe_rx & 0x1][eNB_id]->crnti) &&
(dci_alloc_rx[i].format != format0)) {
LOG_D(PHY,"[UE %d][DCI][PDSCH %x] AbsSubframe %d.%d: format %d, num_pdcch_symbols %d, nCCE %d, total CCEs %d\n",
ue->Mod_id,dci_alloc_rx[i].rnti,
frame_rx%1024,subframe_rx,
......@@ -3155,11 +3160,8 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
ue->pdcch_vars[subframe_rx & 0x1][eNB_id]->nCCE[subframe_rx],
get_nCCE(3,&ue->frame_parms,get_mi(&ue->frame_parms,0)));
//dump_dci(&ue->frame_parms, &dci_alloc_rx[i]);
if ((ue->UE_mode[eNB_id] > PRACH) &&
(generate_ue_dlsch_params_from_dci(frame_rx,
subframe_rx,
......@@ -3263,8 +3265,6 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
0)==0) {
ue->dlsch_p_received[eNB_id]++;
LOG_D(PHY,"[UE %d] Frame %d, subframe %d : Generate UE DLSCH P_RNTI format 1%s\n",ue->Mod_id,frame_rx,subframe_rx,dci_alloc_rx[i].format==format1A?"A":"C");
//dump_dci(&ue->frame_parms, &dci_alloc_rx[i]);
......@@ -3614,6 +3614,7 @@ void ue_pdsch_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, int eNB_id, PDSC
dual_stream_UE = 1;
eNB_id_i = ue->n_connected_eNB;
i_mod = dlsch0->harq_processes[harq_pid]->Qm;
}
else if((pdsch==PDSCH) && (ue->transmission_mode[eNB_id]==3))
{
......@@ -3695,7 +3696,6 @@ void process_rar(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, int eNB_id, runmode_t mo
&ue->pdcch_vars[subframe_rx & 0x1][eNB_id]->crnti,
ue->prach_resources[eNB_id]->ra_PreambleIndex,
dlsch0->harq_processes[0]->b); // alter the 'b' buffer so it contains only the selected RAR header and RAR payload
ue->pdcch_vars[(subframe_rx+1) & 0x1][eNB_id]->crnti = ue->pdcch_vars[subframe_rx & 0x1][eNB_id]->crnti;
......@@ -3819,7 +3819,6 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue,
break;
}
if (frame_rx < *dlsch_errors)
*dlsch_errors=0;
......@@ -3899,7 +3898,6 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue,
#endif
#endif
if(is_cw1_active)
{
// start turbo decode for CW 1
......@@ -4065,7 +4063,6 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue,
ue->total_received_bits[eNB_id] = ue->total_TBS[eNB_id] +
dlsch0->harq_processes[dlsch0->current_harq_pid]->TBS;
}
// Check CRC for CW 1
if(is_cw1_active)
{
......@@ -4110,7 +4107,6 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue,
}
}
#ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[UE %d][PDSCH %x/%d] Frame %d subframe %d: PDSCH/DLSCH decoding iter %d (mcs %d, rv %d, TBS %d)\n",
ue->Mod_id,
......@@ -4136,7 +4132,9 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue,
}
int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode,
int phy_procedures_UE_RX(PHY_VARS_UE *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) {
int l,l2;
......@@ -4169,7 +4167,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
pmch_flag = is_pmch_subframe(frame_rx,subframe_rx,&ue->frame_parms) ? 1 : 0;
if (do_pdcch_flag) {
// deactivate reception until we scan pdcch
if (ue->dlsch[subframe_rx&0x1][eNB_id][0])
ue->dlsch[subframe_rx&0x1][eNB_id][0]->active = 0;
......@@ -4182,7 +4180,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
ue->dlsch_p[eNB_id]->active = 0;
if (ue->dlsch_ra[eNB_id])
ue->dlsch_ra[eNB_id]->active = 0;
}
#ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[%s %d] Frame %d subframe %d: Doing phy_procedures_UE_RX\n",
......@@ -4239,6 +4237,8 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
}
ue_measurement_procedures(l-1,ue,proc,eNB_id,(subframe_rx<<1),abstraction_flag,mode);
if (do_pdcch_flag) {
if ((l==pilot1) ||
((pmch_flag==1)&(l==l2))) {
LOG_D(PHY,"[UE %d] Frame %d: Calling pdcch procedures (eNB %d)\n",ue->Mod_id,frame_rx,eNB_id);
......@@ -4249,6 +4249,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
}
LOG_D(PHY,"num_pdcch_symbols %d\n",ue->pdcch_vars[subframe_rx & 0x1][eNB_id]->num_pdcch_symbols);
}
}
} // for l=1..l2
ue_measurement_procedures(l-1,ue,proc,eNB_id,(subframe_rx<<1),abstraction_flag,mode);
......@@ -4284,6 +4285,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
#endif
// do procedures for C-RNTI
if (ue->dlsch[subframe_rx&0x1][eNB_id][0]->active == 1) {
LOG_D(PHY,"dlsch is active, doing ue_pdsch_procedures\n");
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN);
ue_pdsch_procedures(ue,
proc,
......@@ -4398,6 +4400,8 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
ue_pbch_procedures(eNB_id,ue,proc,abstraction_flag);
}
// do procedures for C-RNTI
LOG_D(PHY," ------ --> PDSCH ChannelComp/LLR slot 0: AbsSubframe %d.%d ------ \n", frame_rx%1024, subframe_rx);
if (ue->dlsch[subframe_rx&0x1][eNB_id][0]->active == 1) {
......@@ -4414,7 +4418,6 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
1+(ue->frame_parms.symbols_per_tti>>1),
ue->frame_parms.symbols_per_tti-1,
abstraction_flag);
LOG_D(PHY," ------ end PDSCH ChannelComp/LLR slot 0: AbsSubframe %d.%d ------ \n", frame_rx%1024, subframe_rx);
LOG_D(PHY," ------ --> PDSCH Turbo Decoder slot 0/1: AbsSubframe %d.%d ------ \n", frame_rx%1024, subframe_rx);
#if UE_TIMING_TRACE
......@@ -4599,6 +4602,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
}
#if defined(Rel10) || defined(Rel14)
int phy_procedures_RN_UE_RX(uint8_t slot_rx, uint8_t next_slot, relaying_type_t r_type)
{
......@@ -4627,8 +4631,7 @@ int phy_procedures_RN_UE_RX(uint8_t slot_rx, uint8_t next_slot, relaying_type_t
}
#endif
void phy_procedures_UE_lte(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode,
void phy_procedures_UE_lte(PHY_VARS_UE *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(ENABLE_ITTI)
......@@ -4700,7 +4703,7 @@ void phy_procedures_UE_lte(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,u
if (phy_procedures_RN_UE_RX(subframe_rx, subframe_tx, r_type) != 0 )
#endif
phy_procedures_UE_RX(ue,proc,eNB_id,abstraction_flag,mode,r_type,phy_vars_rn);
phy_procedures_UE_RX(ue,proc,eNB_id,abstraction_flag,do_pdcch_flag,mode,r_type,phy_vars_rn);
}
if ((subframe_select(&ue->frame_parms,subframe_tx)==SF_S) &&
......@@ -4714,7 +4717,7 @@ void phy_procedures_UE_lte(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,u
if (phy_procedures_RN_UE_RX(subframe_rx, subframe_tx, r_type) != 0 )
#endif
phy_procedures_UE_RX(ue,proc,eNB_id,abstraction_flag,mode,r_type,phy_vars_rn);
phy_procedures_UE_RX(ue,proc,eNB_id,abstraction_flag,do_pdcch_flag,mode,r_type,phy_vars_rn);
}
if (ue->mac_enabled==1) {
......
......@@ -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,7 +3301,9 @@ int main(int argc, char **argv)
free_ue_dlsch(UE->dlsch[subframe&0x1][0][i]);
}
if (test_perf && !test_passed)
return(-1);
else
return(0);
}
......
......@@ -56,10 +56,8 @@
extern unsigned int dlsch_tbs25[27][25],TBStable[27][110];
extern unsigned char offset_mumimo_llr_drange_fix;
extern uint8_t interf_unaw_shift0;
extern uint8_t interf_unaw_shift1;
extern uint8_t interf_unaw_shift;
extern int16_t dlsch_demod_shift;
extern int16_t cond_num_threshold;
#include "PHY/TOOLS/lte_phy_scope.h"
......@@ -151,6 +149,8 @@ int main(int argc, char **argv)
double forgetting_factor=0.0; //in [0,1] 0 means a new channel every time, 1 means keep the same channel
double iqim=0.0;
extern int use_sic_receiver;
uint8_t extended_prefix_flag=0,transmission_mode=1,n_tx_port=1, n_tx_phy=1, n_rx=1;
uint16_t Nid_cell=0;
......@@ -162,13 +162,19 @@ int main(int argc, char **argv)
uint16_t tdd_config=3;
uint16_t n_rnti=0x1234;
int n_users = 1;
int active_tb0_sent[4]={0,0,0,0};
int active_tb1_sent[4]={0,0,0,0};
int failed_tb0[4]={0,0,0,0};
int failed_tb1[4]={0,0,0,0};
int TB=0;
RX_type_t rx_type=rx_standard;
unsigned char cur_harq_pid;
int hold_rank1_precoder=0;
int tpmi_retr=0;
bool is_first_time;
int rank_adapt =0;
int updated_csi = 0;
SCM_t channel_model=Rayleigh1;
......@@ -195,6 +201,8 @@ int main(int argc, char **argv)
char bler_fname[256];
FILE *time_meas_fd;
char time_meas_fname[256];
FILE *rankadapt_fd;
char rankadapt_fname[256];
FILE *input_trch_fd=NULL;
unsigned char input_trch_file=0;
......@@ -251,6 +259,7 @@ int main(int argc, char **argv)
FD_lte_phy_scope_ue *form_ue = NULL;
char title[255];
uint32_t DLSCH_RB_ALLOC = 0x1fff;
int log_level = LOG_ERR;
int numCCE=0;
int dci_length_bytes=0,dci_length=0;
int common_flag=0,TPC=0;
......@@ -258,6 +267,7 @@ int main(int argc, char **argv)
double cpu_freq_GHz;
//time_stats_t ts;//,sts,usts;
int avg_iter[2],iter_trials[2];
int rank_indc[4]={0,0,0,0};
int rballocset=0;
int print_perf=0;
int test_perf=0;
......@@ -266,7 +276,8 @@ int main(int argc, char **argv)
double effective_rate=0.0;
double thr_cw0_tm4 = 0.0;
double thr_cw0_tm4 = 0.0, throug_tb0=0.0, throug_tb1=0.0, throug_tb0_acc[4]={0,0,0,0}, throug_tb1_acc[4]={0,0,0,0}, throug_tb0_acc_aver[4]={0,0,0,0}, throug_tb1_acc_aver[4]={0,0,0,0};
double throug_tot_acc_aver[4]={0,0,0,0}, throug_tot_acc_aver_all_rounds=0;
double thr_cw0_tm4_nonconst = 0.0;
double thr_cw0[4]={0,0,0,0}, thr_cw1[4]={0,0,0,0}, thr_cw0_tot = 0.0, thr_cw1_tot = 0.0;
unsigned int tbs0_init=0, tbs1_init=0;
......@@ -276,6 +287,7 @@ int main(int argc, char **argv)
int TB0_active = 1;
int TB1_active = 1;
int decoded_tb[2]={0,0};
uint32_t perfect_ce = 0;
......@@ -322,9 +334,6 @@ int main(int argc, char **argv)
//signal(SIGSEGV, handler);
//signal(SIGABRT, handler);
logInit();
set_glog(LOG_INFO, LOG_MED);
// default parameters
n_frames = 1000;
snr0 = 0;
......@@ -332,7 +341,7 @@ int main(int argc, char **argv)
perfect_ce = 0;
while ((c = getopt (argc, argv, "ahdpZDe:Em:n:o:s:f:t:c:g:r:F:x:y:z:AM:N:I:i:O:R:S:C:T:b:u:v:w:B:PLl:XYv:W:J:K:U")) != -1) {
while ((c = getopt (argc, argv, "ahdpZDe:Em:n:o:s:f:t:c:g:r:F:x:y:z:AM:N:I:i:O:R:S:C:T:b:u:v:w:B:Pl:XYWv:V:J:K:UL:")) != -1) {
switch (c) {
case 'a':
......@@ -397,10 +406,6 @@ int main(int argc, char **argv)
input_trch_file=1;
break;
case 'L':
llr8_flag=1;
break;
case 'l':
offset_mumimo_llr_drange_fix=atoi(optarg);
break;
......@@ -616,14 +621,14 @@ int main(int argc, char **argv)
case 'Y':
perfect_ce=1;
break;
case 'V':
interf_unaw_shift0=atoi(optarg);
break;
case 'W':
interf_unaw_shift1=atoi(optarg);
rank_adapt=1;
break;
case 'V':
cond_num_threshold = atoi(optarg);
break;
case 'J':
interf_unaw_shift=atoi(optarg);
dlsch_demod_shift = atoi(optarg);
break;
case 'K':
tpmi_retr = atoi(optarg);
......@@ -631,6 +636,9 @@ int main(int argc, char **argv)
case 'U':
updated_csi=1;
break;
case 'L':
log_level=atoi(optarg);
break;
case 'h':
default:
printf("%s -h(elp) -a(wgn on) -d(ci decoding on) -p(extended prefix on) -m mcs1 -M mcs2 -n n_frames -s snr0 -x transmission mode (1,2,3,5,6) -y TXant -z RXant -I trch_file\n",argv[0]);
......@@ -664,6 +672,25 @@ int main(int argc, char **argv)
}
}
if (dlsch_demod_shift==0) {
if ((transmission_mode==3 || transmission_mode==4) && (rx_type>rx_standard)) {
if (mcs1<17)
dlsch_demod_shift=0;
else
dlsch_demod_shift=-2;
}
}
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:
......@@ -700,6 +727,12 @@ int main(int argc, char **argv)
exit(-1);
}
if (transmission_mode==4 && rx_type == rx_SIC_dual_stream )
use_sic_receiver = 1;
else if (transmission_mode==4 && rx_type < rx_SIC_dual_stream )
use_sic_receiver = 0;
if (xforms==1) {
fl_initialize (&argc, argv, NULL, 0, 0);
......@@ -707,15 +740,20 @@ int main(int argc, char **argv)
sprintf (title, "LTE PHY SCOPE eNB");
fl_show_form (form_ue->lte_phy_scope_ue, FL_PLACE_HOTSPOT, FL_FULLBORDER, title);
/*
if (rx_type==rx_IC_single_stream) {
openair_daq_vars.use_ia_receiver = 1;
fl_set_button(form_ue->button_0,1);
fl_set_object_label(form_ue->button_0, "IA Receiver ON");
if (transmission_mode==4 && use_sic_receiver == 1) {
use_sic_receiver = 1;
fl_set_button(form_ue->button_0, use_sic_receiver);
fl_set_object_label(form_ue->button_0, "SIC Receiver ON");
fl_set_object_color(form_ue->button_0, FL_GREEN, FL_GREEN);
}else if (transmission_mode==4 && use_sic_receiver == 0 ){
use_sic_receiver = 0;
fl_set_button(form_ue->button_0, use_sic_receiver);
fl_set_object_label(form_ue->button_0, "SIC Receiver OFF");
fl_set_object_color(form_ue->button_0, FL_RED, FL_RED);
}
*/
}
if (transmission_mode==5) {
......@@ -746,9 +784,10 @@ int main(int argc, char **argv)
printf("n_frames = %d\n",n_frames);
printf("Transmission mode %d with %dx%d antenna configuration, Extended Prefix %d\n",transmission_mode,n_tx_phy,n_rx,extended_prefix_flag);
printf("Using receiver type %d\n", rx_type);
printf("TM1 shift %d\n", interf_unaw_shift);
//printf("Using I_UA rec shift layer 1 %d\n", interf_unaw_shift0);
//printf("Using I_UA rec shift layer 2 %d\n", interf_unaw_shift1);
printf("dlsch_demod_shift %d\n", dlsch_demod_shift);
printf("rank adaptation %d\n", rank_adapt);
//printf("Using I_UA rec shift layer 1 %d\n", dlsch_demod_shift0);
//printf("Using I_UA rec shift layer 2 %d\n", dlsch_demod_shift1);
snr1 = snr0+snr_int;
printf("SNR0 %f, SNR1 %f\n",snr0,snr1);
......@@ -782,27 +821,51 @@ int main(int argc, char **argv)
sprintf(bler_fname,"bler_tx%d_rec%d_chan%d_nrx%d_mcs%d_mcsi%d_u%d_imod%d.csv",transmission_mode,rx_type,channel_model,n_rx,mcs1,mcs_i,rx_type,i_mod);
else if (abstx == 1){
if (perfect_ce==1)
sprintf(bler_fname,"bler_tx%d_r%d_ch%d_%d_nrx%d_rnd%d_mcs%d_mcsi%d_ab_pce_sh%d_rpmi%d_n.csv",transmission_mode,rx_type,channel_model,n_frames, n_rx, num_rounds, mcs1, mcs2,interf_unaw_shift, tpmi_retr);
sprintf(bler_fname,"bler_tx%d_r%d_ch%d_%d_nrx%d_rnd%d_mcs%d_mcsi%d_ab_pce_sh%d_rpmi%d_n.csv",transmission_mode,rx_type,channel_model,n_frames, n_rx, num_rounds, mcs1, mcs2,dlsch_demod_shift, tpmi_retr);
else
sprintf(bler_fname,"bler_tx%d_r%d_ch%d_%d_nrx%d_rnd%d_mcs%d_mcsi%d_ab_sh%d_rtpmi%d_n.csv",transmission_mode,rx_type,channel_model, n_frames, n_rx, num_rounds, mcs1, mcs2,interf_unaw_shift, tpmi_retr);
sprintf(bler_fname,"bler_tx%d_r%d_ch%d_%d_nrx%d_rnd%d_mcs%d_mcsi%d_ab_sh%d_rtpmi%d_n.csv",transmission_mode,rx_type,channel_model, n_frames, n_rx, num_rounds, mcs1, mcs2,dlsch_demod_shift, tpmi_retr);
}
else {//abstx=0
if (perfect_ce==1){
if (updated_csi==1){
sprintf(bler_fname,"bler_tx%d_r%d_ch%d_%d_nrx%d_rnd%d_mcs%d_mcsi%d_pce_sh%d_up_rtpmi%d_n.csv",transmission_mode,rx_type,channel_model,n_frames, n_rx, num_rounds, mcs1, mcs2, interf_unaw_shift, tpmi_retr);
sprintf(bler_fname,"bler_tx%d_r%d_ch%d_%d_nrx%d_rnd%d_mcs%d_mcsi%d_pce_sh%d_up_rtpmi%d_n.csv",transmission_mode,rx_type,channel_model,n_frames, n_rx, num_rounds, mcs1, mcs2, dlsch_demod_shift, tpmi_retr);
}
else{
sprintf(bler_fname,"bler_tx%d_r%d_ch%d_%d_nrx%d_rnd%d_mcs%d_mcsi%d_pce_sh%d_rtpmi%d_n.csv",transmission_mode,rx_type, channel_model,n_frames, n_rx, num_rounds, mcs1, mcs2, interf_unaw_shift, tpmi_retr);
sprintf(bler_fname,"bler_tx%d_r%d_ch%d_%d_nrx%d_rnd%d_mcs%d_mcsi%d_pce_sh%d_rtpmi%d_n.csv",transmission_mode,rx_type, channel_model,n_frames, n_rx, num_rounds, mcs1, mcs2, dlsch_demod_shift, tpmi_retr);
}
}
else{
if (updated_csi==1){
sprintf(bler_fname,"bler_tx%d_r%d_ch%d_%d_nrx%d_rnd%d_mcs%d_mcsi%d_sh%d_up_rtpmi%d_n.csv",transmission_mode,rx_type,channel_model,n_frames, n_rx, num_rounds, mcs1, mcs2, interf_unaw_shift, tpmi_retr);
sprintf(bler_fname,"bler_tx%d_r%d_ch%d_%d_nrx%d_rnd%d_mcs%d_mcsi%d_sh%d_up_rtpmi%d_n.csv",transmission_mode,rx_type,channel_model,n_frames, n_rx, num_rounds, mcs1, mcs2, dlsch_demod_shift, tpmi_retr);
}
else{
sprintf(bler_fname,"bler_tx%d_r%d_ch%d_%d_nrx%d_rnd%d_mcs%d_mcsi%d_sh%d_rtpmi%csv",transmission_mode,rx_type, channel_model,n_frames, n_rx, num_rounds, mcs1, mcs2, interf_unaw_shift, tpmi_retr);
sprintf(bler_fname,"bler_tx%d_r%d_ch%d_%d_nrx%d_rnd%d_mcs%d_mcsi%d_sh%d_rtpmi%csv",transmission_mode,rx_type, channel_model,n_frames, n_rx, num_rounds, mcs1, mcs2, dlsch_demod_shift, tpmi_retr);
}
}
}
if (transmission_mode==3 || transmission_mode==4){
if (rank_adapt==1){
if (perfect_ce==1)
sprintf(rankadapt_fname,"rank_adapt1_tx%d_r%d_ch%d_%d_nrx%d_rnd%d_mcs%d_mcsi%d_pce_sh%d_connum_%d.csv",transmission_mode,rx_type,channel_model,n_frames, n_rx, num_rounds, mcs1, mcs2, dlsch_demod_shift, cond_num_threshold);
else
sprintf(rankadapt_fname,"rank_adapt1_tx%d_r%d_ch%d_%d_nrx%d_rnd%d_mcs%d_mcsi%d_sh%d_connum_%d.csv",transmission_mode,rx_type,channel_model,n_frames, n_rx, num_rounds, mcs1, mcs2, dlsch_demod_shift, cond_num_threshold);
} else {
if (perfect_ce==1)
sprintf(rankadapt_fname,"rank_adapt0_tx%d_r%d_ch%d_%d_nrx%d_rnd%d_mcs%d_mcsi%d_pce_sh%d_connum_%d.csv",transmission_mode,rx_type,channel_model,n_frames, n_rx, num_rounds, mcs1, mcs2, dlsch_demod_shift, cond_num_threshold);
else
sprintf(rankadapt_fname,"rank_adapt0_tx%d_r%d_ch%d_%d_nrx%d_rnd%d_mcs%d_mcsi%d_sh%d_connum_%d.csv",transmission_mode,rx_type,channel_model,n_frames, n_rx, num_rounds, mcs1, mcs2, dlsch_demod_shift, cond_num_threshold);
}
rankadapt_fd = fopen(rankadapt_fname,"w");
if (rankadapt_fd==NULL) {
fprintf(stderr,"Cannot create file %s!\n",rankadapt_fname);
exit(-1);
}
if (rx_type == rx_SIC_dual_stream)
fprintf(rankadapt_fd,"SNR; rank_adapt; clsm_counter; MCS1; MCS2; TBS1; TBS2; rate 0; rate 1; err0_tb0; err0_tb1; trials_tb0_r0; trials_tb1_r0; sic_att0; sic_suc0; ret_both0; ret_one0; err1_tb0; err1_tb1; trials_tb0_r1; trials_tb1_r1; sic_att1; sic_suc1; ret_both1; ret_one1; err2_tb0; err2_tb1; trials_tb0_r2; trials1_tb1_r2; sic_att2; sic_suc2; ret_both2; ret_one2; err3_tb0; err3_tb1; trials_tb0_r3; trials_tb1_r3; sic_att3; sic_suc3; th_tb0_r0; th_tb1_r0; th_sum_r0; th_tb0_r1; th_tb1_r1; th_sum_r1; th_tb0_r2; th_tb1_r2; th_sum_r2; th_tb0_r3; th_tb1_r3; th_sum_r3; tot_th\n");
else
fprintf(rankadapt_fd,"SNR; rank_adapt; clsm_counter; MCS1; MCS2; TBS1; TBS2; rate 0; rate 1; err0_tb0; err0_tb1; trials_tb0_r0; trials_tb1_r0; deact_tb0_r0; deact_tb1_r0; ret_both0; ret_one0; err1_tb0; err1_tb1; trials_tb0_r1; trials_tb1_r1; deact_tb0_r1; deact_tb1_r1; ret_both1; ret_one1; err2_tb0; err2_tb1; trials_tb0_r2; trials1_tb1_r2; deact_tb0_r2; deact_tb1_r2; ret_both2; ret_one2; err3_tb0; err3_tb1; trials_tb0_r3; trials_tb1_r3; th_tb0_r0; th_tb1_r0; th_sum_r0; th_tb0_r1; th_tb1_r1; th_sum_r1; th_tb0_r2; th_tb1_r2; th_sum_r2; th_tb0_r3; th_tb1_r3; th_sum_r3; tot_th\n");
}
bler_fd = fopen(bler_fname,"w");
......@@ -812,11 +875,13 @@ int main(int argc, char **argv)
}
if ((transmission_mode != 3) && (transmission_mode != 4))
fprintf(bler_fd,"SNR; MCS1; MCS2; TBS1; TBS2; rate 0; rate 1; err0_st1; err0_st2 trials0; err1_st1; err1_st2; trials1; err2_st1; err2_st2; trials2; err3_st1; err3_st2; trials3; throug 0; throug 1; sum throug; dci_err\n");
fprintf(bler_fd,"SNR; MCS1; TBS1; rate 0; err0; trials0; err1;trials1; err2;trials2; err3; trials3\n");
else if (rx_type == rx_SIC_dual_stream)
fprintf(bler_fd,"SNR; MCS1; MCS2; TBS1; TBS2; rate 0; rate 1; err0_tb0; err0_tb1; trials_tb0_r0; trials_tb1_r0; sic_att0; sic_suc0; ret_both0; ret_one0; err1_tb0; err1_tb1; trials_tb0_r1; trials_tb1_r1; sic_att1; sic_suc1; ret_both1; ret_one1; err2_tb0; err2_tb1; trials_tb0_r2; trials1_tb1_r2; sic_att2; sic_suc2; ret_both2; ret_one2; err3_tb0; err3_tb1; trials_tb0_r3; trials_tb1_r3; sic_att3; sic_suc3; th_tb0_r0; th_tb1_r0; th_sum_r0; th_tb0_r1; th_tb1_r1; th_sum_r1; th_tb0_r2; th_tb1_r2; th_sum_r2; th_tb0_r3; th_tb1_r3; th_sum_r3; tot_th\n");
fprintf(bler_fd,"SNR; rank_adapt; rank; MCS1; MCS2; TBS1; TBS2; rate 0; rate 1; err0_tb0; err0_tb1; trials_tb0_r0; trials_tb1_r0; sic_att0; sic_suc0; ret_both0; ret_one0; err1_tb0; err1_tb1; trials_tb0_r1; trials_tb1_r1; sic_att1; sic_suc1; ret_both1; ret_one1; err2_tb0; err2_tb1; trials_tb0_r2; trials1_tb1_r2; sic_att2; sic_suc2; ret_both2; ret_one2; err3_tb0; err3_tb1; trials_tb0_r3; trials_tb1_r3; sic_att3; sic_suc3; th_tb0_r0; th_tb1_r0; th_sum_r0; th_tb0_r1; th_tb1_r1; th_sum_r1; th_tb0_r2; th_tb1_r2; th_sum_r2; th_tb0_r3; th_tb1_r3; th_sum_r3; tot_th\n");
else
fprintf(bler_fd,"SNR; MCS1; MCS2; TBS1; TBS2; rate 0; rate 1; err0_tb0; err0_tb1; trials_tb0_r0; trials_tb1_r0; deact_tb0_r0; deact_tb1_r0; ret_both0; ret_one0; err1_tb0; err1_tb1; trials_tb0_r1; trials_tb1_r1; deact_tb0_r1; deact_tb1_r1; ret_both1; ret_one1; err2_tb0; err2_tb1; trials_tb0_r2; trials1_tb1_r2; deact_tb0_r2; deact_tb1_r2; ret_both2; ret_one2; err3_tb0; err3_tb1; trials_tb0_r3; trials_tb1_r3; th_tb0_r0; th_tb1_r0; th_sum_r0; th_tb0_r1; th_tb1_r1; th_sum_r1; th_tb0_r2; th_tb1_r2; th_sum_r2; th_tb0_r3; th_tb1_r3; th_sum_r3; tot_th\n");
fprintf(bler_fd,"SNR; rank_adapt; clsm_counter; MCS1; MCS2; TBS1; TBS2; rate 0; rate 1; err0_tb0; err0_tb1; trials_tb0_r0; trials_tb1_r0; deact_tb0_r0; deact_tb1_r0; ret_both0; ret_one0; err1_tb0; err1_tb1; trials_tb0_r1; trials_tb1_r1; deact_tb0_r1; deact_tb1_r1; ret_both1; ret_one1; err2_tb0; err2_tb1; trials_tb0_r2; trials1_tb1_r2; deact_tb0_r2; deact_tb1_r2; ret_both2; ret_one2; err3_tb0; err3_tb1; trials_tb0_r3; trials_tb1_r3; th_tb0_r0; th_tb1_r0; th_sum_r0; th_tb0_r1; th_tb1_r1; th_sum_r1; th_tb0_r2; th_tb1_r2; th_sum_r2; th_tb0_r3; th_tb1_r3; th_sum_r3; tot_th\n");
if (test_perf != 0) {
......@@ -845,9 +910,9 @@ int main(int argc, char **argv)
else
if (perfect_ce==1)
sprintf(csv_fname,"dout_tx%d_r%d_ch%d_%d_rnd%d_mcs%d_mcsi%d_pce_sh%d_%d_csi.m",transmission_mode,rx_type, channel_model, n_frames, num_rounds, mcs1, mcs2, interf_unaw_shift, n_ch_rlz);
sprintf(csv_fname,"dout_tx%d_r%d_ch%d_%d_rnd%d_mcs%d_mcsi%d_pce_sh%d_%d_csi.m",transmission_mode,rx_type, channel_model, n_frames, num_rounds, mcs1, mcs2, dlsch_demod_shift, n_ch_rlz);
else
sprintf(csv_fname,"dout_tx%d_r%d_ch%d_%d_rnd%d_mcs%d_mcsi%d_sh%d_%d_csi.m",transmission_mode,rx_type, channel_model, n_frames, num_rounds, mcs1, mcs2, interf_unaw_shift, n_ch_rlz);
sprintf(csv_fname,"dout_tx%d_r%d_ch%d_%d_rnd%d_mcs%d_mcsi%d_sh%d_%d_csi.m",transmission_mode,rx_type, channel_model, n_frames, num_rounds, mcs1, mcs2, dlsch_demod_shift, n_ch_rlz);
csv_fd = fopen(csv_fname,"w");
fprintf(csv_fd,"data_all%d=[",mcs1);
......@@ -943,6 +1008,10 @@ int main(int argc, char **argv)
exit(-1);
}
if ((transmission_mode == 3) && (transmission_mode == 4))
for (n=0; n<4; ++n)
rank_indc[n]=1;
if ((transmission_mode == 3) || (transmission_mode==4) || (transmission_mode==8))
Kmimo=2;
else
......@@ -2048,7 +2117,6 @@ int main(int argc, char **argv)
}
for (SNR=snr0; SNR<snr1; SNR+=snr_step) {
UE->proc.proc_rxtx[0].frame_rx=0;
for (i=0; i<4; i++) {
errs[0][i]=0; //CW_0
......@@ -2062,6 +2130,17 @@ int main(int argc, char **argv)
round_trials[1][i] = 0; // CW_1
TB0_deact[i]=0;
TB1_deact[i]=0;
throug_tb0_acc[i] = 0;
throug_tb1_acc[i] = 0;
throug_tb0_acc_aver[i]=0;
throug_tb1_acc_aver[i]=0;
throug_tot_acc_aver[i]=0;
active_tb0_sent[i]=0;
active_tb1_sent[i]=0;
failed_tb0[i]=0;
failed_tb1[i]=0;
throug_tot_acc_aver_all_rounds=0;
}
dci_errors=0;
......@@ -2072,6 +2151,9 @@ int main(int argc, char **argv)
iter_trials[0]=0;
iter_trials[1]=0;
uint32_t clsm_counter=0;
uint32_t two_tb_flag=0;
reset_meas(&eNB->phy_proc_tx); // total eNB tx
reset_meas(&eNB->dlsch_scrambling_stats);
reset_meas(&UE->dlsch_unscrambling_stats);
......@@ -2128,7 +2210,7 @@ int main(int argc, char **argv)
is_first_time = true;
#ifdef DEBUG_HARQ
printf("[DLSIM] TRIAL %d\n", trials);
printf("TPMI_retr= %d\n", tpmi_retr);
printf("[DLSIM] TPMI_retr= %d\n", tpmi_retr);
#endif
for (i=0; i<frame_parms->nb_antennas_tx; i++) {
......@@ -2145,18 +2227,28 @@ int main(int argc, char **argv)
TB0_active=1;
TB1_active=1;
if (transmission_mode == 3 || transmission_mode == 4)
rank_indc[0]=1;
while (((transmission_mode == 3 || transmission_mode == 4) &&
((round < num_rounds) && ((ret[0] > UE->dlsch[subframe&0x1][0][0]->max_turbo_iterations) ||
(ret[1] > UE->dlsch[subframe&0x1][0][0]->max_turbo_iterations)))) ||
((round < num_rounds) && (((rank_indc[0] == 1) ||((rank_indc[0] == 0) && (rank_adapt==0))) &&
((ret[0] > UE->dlsch[subframe&0x1][0][0]->max_turbo_iterations) ||
(ret[1] > UE->dlsch[subframe&0x1][0][0]->max_turbo_iterations))||
(rank_indc[0] ==0 && rank_adapt==1 && ret[0] > UE->dlsch[subframe&0x1][0][0]->max_turbo_iterations )))) ||
((transmission_mode!=4 && transmission_mode != 3) && ((round< num_rounds) &&
(ret[0] > UE->dlsch[subframe&0x1][0][0]->max_turbo_iterations)))) {
// printf("ret[0] =% d UE->dlsch[subframe&0x1][0][0]->max_turbo_iterations = %d\n", ret[0], UE->dlsch[subframe&0x1][0][0]->max_turbo_iterations);
// printf("ret[1] =% d UE->dlsch[subframe&0x1][0][0]->max_turbo_iterations = %d\n", ret[1], UE->dlsch[subframe&0x1][0][0]->max_turbo_iterations);
#ifdef DEBUG_HARQ
printf("\n [DLSIM] On top round is %d\n", round);
#endif
round_trials[0][round]++;
round_trials[1][round]++;
decoded_tb[0]=0;
decoded_tb[1]=0;
//printf("Trial %d, round %d , ret[0] %d, ret[1] %d, round_trials %d\n",trials,round, ret[0], ret[1], round_trials[round]);
......@@ -2212,9 +2304,19 @@ int main(int argc, char **argv)
eNB->dlsch[0][1]->harq_processes[0]->rvidx = round&3;
if (round == 0) { // First round
if ((rank_indc[0]==1) || (rank_indc[0]==0 && rank_adapt==0)) {
TB0_active = 1;
TB1_active = 1;
#ifdef DEBUG_HARQ
printf("Simulating HARQ both active \n");
#endif
}else {
TB0_active = 1;
TB1_active = 0;
#ifdef DEBUG_HARQ
printf("Simulating HARQ only TB0 active \n");
#endif
}
if (eNB->frame_parms.frame_type == TDD) {
switch (transmission_mode) {
......@@ -2276,6 +2378,7 @@ int main(int argc, char **argv)
}
break;
case 4:
if ((TB0_active == 1) && (TB1_active == 1)) {
switch (eNB->frame_parms.N_RB_DL) {
case 6:
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 2;
......@@ -2318,6 +2421,56 @@ int main(int argc, char **argv)
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu_1[0],sizeof(DCI2_20MHz_2A_TDD_t));
break;
}
} else if ((TB0_active == 1) && (TB1_active == 0)) {
switch (eNB->frame_parms.N_RB_DL) {
case 6:
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 0;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->ndi1 = trials&1;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = round&3;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->mcs2 = 0;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = 1;
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu_1[0],sizeof(DCI2_1_5MHz_2A_TDD_t));
break;
case 25:
((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 0;
((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->ndi1 = trials&1;
((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = round&3;
((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->mcs2 = 0;
((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = 1;
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu_1[0],sizeof(DCI2_5MHz_2A_TDD_t));
break;
case 50:
((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 0;
((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->ndi1 = trials&1;
((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = round&3;
((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->mcs2 = 0;
((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = 1;
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu_1[0],sizeof(DCI2_10MHz_2A_TDD_t));
break;
case 100:
((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 0;
((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->ndi1 = trials&1;
((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = round&3;
((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->mcs2 = 0;
((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = 1;
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu_1[0],sizeof(DCI2_20MHz_2A_TDD_t));
break;
}
generate_eNB_dlsch_params_from_dci(0,
subframe,
&DLSCH_alloc_pdu_1[0],
n_rnti+k,
format2,
eNB->dlsch[0],
&eNB->frame_parms,
eNB->pdsch_config_dedicated,
SI_RNTI,
0,
P_RNTI,
UE->dlsch[subframe&0x1][0][1]->pmi_alloc,
transmission_mode>=7?transmission_mode:0
);
}
break;
case 5:
case 6:
......@@ -2326,8 +2479,7 @@ int main(int argc, char **argv)
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu2_1E[0],sizeof(DCI1E_5MHz_2A_M10PRB_TDD_t));
break;
}
}
else { // FDD
} else { // FDD
switch (transmission_mode) {
case 1:
case 2:
......@@ -2387,6 +2539,7 @@ int main(int argc, char **argv)
}
break;
case 4:
if ((TB0_active == 1) && (TB1_active == 1)) {
switch (eNB->frame_parms.N_RB_DL) {
case 6:
((DCI2_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 2;
......@@ -2429,7 +2582,58 @@ int main(int argc, char **argv)
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu_1[0],sizeof(DCI2_20MHz_2A_FDD_t));
break;
}
} else if ((TB0_active == 1) && (TB1_active == 0)) {
switch (eNB->frame_parms.N_RB_DL) {
case 6:
((DCI2_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 0;
((DCI2_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->ndi1 = trials&1;
((DCI2_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = round&3;
((DCI2_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->mcs2 = 0;
((DCI2_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = 1;
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu_1[0],sizeof(DCI2_1_5MHz_2A_FDD_t));
break;
case 25:
((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 0;
((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->ndi1 = trials&1;
((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = round&3;
((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->mcs2 = 0;
((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = 1;
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu_1[0],sizeof(DCI2_5MHz_2A_FDD_t));
break;
case 50:
((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 0;
((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->ndi1 = trials&1;
((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = round&3;
((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->mcs2 = 0;
((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = 1;
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu_1[0],sizeof(DCI2_10MHz_2A_FDD_t));
break;
case 100:
((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 0;
((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->ndi1 = trials&1;
((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = round&3;
((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->mcs2 = 0;
((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = 1;
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu_1[0],sizeof(DCI2_20MHz_2A_FDD_t));
break;
}
}
generate_eNB_dlsch_params_from_dci(0,
subframe,
&DLSCH_alloc_pdu_1[0],
n_rnti+k,
format2,
eNB->dlsch[0],
&eNB->frame_parms,
eNB->pdsch_config_dedicated,
SI_RNTI,
0,
P_RNTI,
UE->dlsch[subframe&0x1][0][1]->pmi_alloc,
transmission_mode>=7?transmission_mode:0
);
break;
case 5:
case 6:
DLSCH_alloc_pdu2_1E[0].ndi = trials&1;
......@@ -2557,10 +2761,11 @@ int main(int argc, char **argv)
}
break;
case 4:
if ((rank_indc[0]==1 )|| ((rank_indc[0]==0) && (rank_adapt==0))){
switch (eNB->frame_parms.N_RB_DL) {
case 6:
if (TB0_active == 1 && TB1_active == 1) {
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 2;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = tpmi_retr; // you have choice
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->mcs1 = mcs1;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->mcs2 = mcs2;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->ndi1 = trials&1;
......@@ -2595,9 +2800,6 @@ int main(int argc, char **argv)
((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = round&3;
}
else if (TB0_active == 0){ // deactivate TB0
#ifdef DEBUG_HARQ
printf("\n[DLSIM] Requesting only TB1 from temp DCI\n");
#endif
((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = tpmi_retr;
((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->mcs1 = 0;
((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = 1;
......@@ -2605,9 +2807,6 @@ int main(int argc, char **argv)
((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = round&3;
}
else { // deactivate TB1
#ifdef DEBUG_HARQ
printf("\n[DLSIM] TDD Requesting only TB0 from temp DCI\n");
#endif
((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = tpmi_retr;
((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->ndi1 = trials&1;
((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = round&3;
......@@ -2615,20 +2814,6 @@ int main(int argc, char **argv)
((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = 1;
}
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu_1[0],sizeof(DCI2_5MHz_2A_TDD_t));
generate_eNB_dlsch_params_from_dci(0,
subframe,
&DLSCH_alloc_pdu_1[0],
n_rnti+k,
format2,
eNB->dlsch[0],
&eNB->frame_parms,
eNB->pdsch_config_dedicated,
SI_RNTI,
0,
P_RNTI,
UE->dlsch[subframe&0x1][0][1]->pmi_alloc,
transmission_mode>=7?transmission_mode:0
);
break;
case 50:
if (TB0_active == 1 && TB1_active == 1) {
......@@ -2682,9 +2867,73 @@ int main(int argc, char **argv)
}
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu_1[0],sizeof(DCI2_20MHz_2A_TDD_t));
break;
}
generate_eNB_dlsch_params_from_dci(0,
subframe,
&DLSCH_alloc_pdu_1[0],
n_rnti+k,
format2,
eNB->dlsch[0],
&eNB->frame_parms,
eNB->pdsch_config_dedicated,
SI_RNTI,
0,
P_RNTI,
UE->dlsch[subframe&0x1][0][1]->pmi_alloc,
transmission_mode>=7?transmission_mode:0
);
} else if (rank_indc[0]==0 && rank_adapt==1) {
//in this case only TB0 is active for the retransmissions, deactivatiing TB1
switch (eNB->frame_parms.N_RB_DL) {
case 6:
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 0; //no choice, only alamouti
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->ndi1 = trials&1;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = round&3;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->mcs2 = 0;
((DCI2_1_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = 1;
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu_1[0],sizeof(DCI2_1_5MHz_2A_TDD_t));
break;
case 25:
((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 0;
((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->ndi1 = trials&1;
((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = round&3;
((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->mcs2 = 0;
((DCI2_5MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = 1;
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu_1[0],sizeof(DCI2_5MHz_2A_TDD_t));
break;
case 50:
((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 0;
((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->ndi1 = trials&1;
((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = round&3;
((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->mcs2 = 0;
((DCI2_10MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = 1;
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu_1[0],sizeof(DCI2_10MHz_2A_TDD_t));
break;
case 100:
((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 0;
((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->ndi1 = trials&1;
((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = round&3;
((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->mcs2 = 0;
((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = 1;
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu_1[0],sizeof(DCI2_20MHz_2A_TDD_t));
break;
}
generate_eNB_dlsch_params_from_dci(0,
subframe,
&DLSCH_alloc_pdu_1[0],
n_rnti+k,
format2,
eNB->dlsch[0],
&eNB->frame_parms,
eNB->pdsch_config_dedicated,
SI_RNTI,
0,
P_RNTI,
UE->dlsch[subframe&0x1][0][1]->pmi_alloc,
transmission_mode>=7?transmission_mode:0
);
}
break;
case 5:
case 6:
DLSCH_alloc_pdu2_1E[0].ndi = trials&1;
......@@ -2785,6 +3034,7 @@ int main(int argc, char **argv)
}
break;
case 4:
if ((rank_indc[0]==1 )|| ((rank_indc[0]==0) && (rank_adapt==0))){
switch (eNB->frame_parms.N_RB_DL) {
case 6:
if (TB0_active == 1 && TB1_active == 1) {
......@@ -2823,9 +3073,6 @@ int main(int argc, char **argv)
((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = round&3;
}
else if (TB0_active == 0){ // deactivate TB0
#ifdef DEBUG_HARQ
printf("\n [DLSIM] Requesting only TB1 from temp DCI\n");
#endif
((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = tpmi_retr;
((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->mcs1 = 0;
((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = 1;
......@@ -2833,9 +3080,6 @@ int main(int argc, char **argv)
((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = round&3;
}
else { // deactivate TB1
#ifdef DEBUG_HARQ
printf("\n[DLSIM] FDD Requesting only TB0 from temp DCI\n");
#endif
((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = tpmi_retr;
((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->ndi1 = trials&1;
((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = round&3;
......@@ -2843,20 +3087,6 @@ int main(int argc, char **argv)
((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = 1;
}
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu_1[0],sizeof(DCI2_5MHz_2A_FDD_t));
generate_eNB_dlsch_params_from_dci(0,
subframe,
&DLSCH_alloc_pdu_1[0],
n_rnti+k,
format2,
eNB->dlsch[0],
&eNB->frame_parms,
eNB->pdsch_config_dedicated,
SI_RNTI,
0,
P_RNTI,
UE->dlsch[subframe&0x1][0][1]->pmi_alloc,
transmission_mode>=7?transmission_mode:0
);
break;
case 50:
if (TB0_active == 1 && TB1_active == 1) {
......@@ -2911,9 +3141,72 @@ int main(int argc, char **argv)
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu_1[0],sizeof(DCI2_20MHz_2A_FDD_t));
break;
}
generate_eNB_dlsch_params_from_dci(0,
subframe,
&DLSCH_alloc_pdu_1[0],
n_rnti+k,
format2,
eNB->dlsch[0],
&eNB->frame_parms,
eNB->pdsch_config_dedicated,
SI_RNTI,
0,
P_RNTI,
UE->dlsch[subframe&0x1][0][1]->pmi_alloc,
transmission_mode>=7?transmission_mode:0
);
} else if (rank_indc[0]==0 && rank_adapt==1) {
//in this case only TB0 is active for the retransmissions, deactivatiing TB1
switch (eNB->frame_parms.N_RB_DL) {
case 6:
((DCI2_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 0; //no choice, only alamouti
((DCI2_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->ndi1 = trials&1;
((DCI2_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = round&3;
((DCI2_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->mcs2 = 0;
((DCI2_1_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = 1;
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu_1[0],sizeof(DCI2_1_5MHz_2A_FDD_t));
break;
case 25:
((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 0;
((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->ndi1 = trials&1;
((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = round&3;
((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->mcs2 = 0;
((DCI2_5MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = 1;
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu_1[0],sizeof(DCI2_5MHz_2A_FDD_t));
break;
case 50:
((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 0;
((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->ndi1 = trials&1;
((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = round&3;
((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->mcs2 = 0;
((DCI2_10MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = 1;
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu_1[0],sizeof(DCI2_10MHz_2A_FDD_t));
break;
case 100:
((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->tpmi = 0;
((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->ndi1 = trials&1;
((DCI2_20MHz_2A_TDD_t *)&DLSCH_alloc_pdu_1[0])->rv1 = round&3;
((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->mcs2 = 0;
((DCI2_20MHz_2A_FDD_t *)&DLSCH_alloc_pdu_1[0])->rv2 = 1;
memcpy(&dci_alloc[0].dci_pdu[0],&DLSCH_alloc_pdu_1[0],sizeof(DCI2_20MHz_2A_FDD_t));
break;
}
generate_eNB_dlsch_params_from_dci(0,
subframe,
&DLSCH_alloc_pdu_1[0],
n_rnti+k,
format2,
eNB->dlsch[0],
&eNB->frame_parms,
eNB->pdsch_config_dedicated,
SI_RNTI,
0,
P_RNTI,
UE->dlsch[subframe&0x1][0][1]->pmi_alloc,
transmission_mode>=7?transmission_mode:0
);
}
break;
case 5:
case 6:
DLSCH_alloc_pdu2_1E[0].ndi = trials&1;
......@@ -2996,6 +3289,9 @@ int main(int argc, char **argv)
}
*/
}
#ifdef DEBUG_HARQ
printf("[DLSIM] UE->dlsch[subframe&0x1][0][%d]->pmi_alloc %d \n", TB, UE->dlsch[subframe&0x1][0][TB]->pmi_alloc);
#endif
//if standard case when both TBs are active
if (transmission_mode == 4) {
......@@ -3081,6 +3377,9 @@ int main(int argc, char **argv)
}
}
#ifdef DEBUG_HARQ
printf("[DLSIM 2 ] UE->dlsch[subframe&0x1][0][%d]->pmi_alloc %d \n", TB, UE->dlsch[subframe&0x1][0][TB]->pmi_alloc);
#endif
start_meas(&eNB->dlsch_encoding_stats);
if (dlsch_encoding(eNB,
......@@ -3165,7 +3464,7 @@ int main(int argc, char **argv)
(subframe*2)+2,
&eNB->frame_parms);
if (n_frames==1) {
if (n_frames==2) {
write_output("txsigF0.m","txsF0", &eNB->common_vars.txdataF[eNB_id][0][subframe*nsymb*eNB->frame_parms.ofdm_symbol_size],nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
if (eNB->frame_parms.nb_antennas_tx>1)
write_output("txsigF1.m","txsF1", &eNB->common_vars.txdataF[eNB_id][1][subframe*nsymb*eNB->frame_parms.ofdm_symbol_size],nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
......@@ -3179,7 +3478,7 @@ int main(int argc, char **argv)
}
tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
if (n_frames==1) {
if (n_frames==2) {
write_output("txsigF0.m","txsF0", &eNB->common_vars.txdataF[eNB_id][0][subframe*nsymb*eNB->frame_parms.ofdm_symbol_size],nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
if (eNB->frame_parms.nb_antennas_tx>1)
write_output("txsigF1.m","txsF1", &eNB->common_vars.txdataF[eNB_id][1][subframe*nsymb*eNB->frame_parms.ofdm_symbol_size],nsymb*eNB->frame_parms.ofdm_symbol_size,1,1);
......@@ -3317,6 +3616,16 @@ int main(int argc, char **argv)
if (n_frames==1)
printf("Sigma2 %f (sigma2_dB %f,%f,%f )\n",sigma2,sigma2_dB,10*log10((double)eNB->frame_parms.ofdm_symbol_size/(double)(NB_RB*12)),get_pa_dB(eNB->pdsch_config_dedicated));
for (i=0; i<10*frame_parms->samples_per_tti; i++) {
for (aa=0;aa<eNB->frame_parms.nb_antennas_rx;aa++) {
//printf("s_re[0][%d]=> %f , r_re[0][%d]=> %f\n",i,s_re[aa][i],i,r_re[aa][i]);
((short*) UE->common_vars.rxdata[aa])[2*i] =
(short) (sqrt(sigma2/2)*gaussdouble(0.0,1.0));
((short*) UE->common_vars.rxdata[aa])[2*i+1] =
(short) (sqrt(sigma2/2)*gaussdouble(0.0,1.0));
}
}
for (i=0; i<2*frame_parms->samples_per_tti; i++) {
for (aa=0;aa<eNB->frame_parms.nb_antennas_rx;aa++) {
//printf("s_re[0][%d]=> %f , r_re[0][%d]=> %f\n",i,s_re[aa][i],i,r_re[aa][i]);
......@@ -3370,7 +3679,7 @@ int main(int argc, char **argv)
for (Ns=(2*subframe);Ns<((2*subframe)+3);Ns++) {
for (l=0;l<pilot2;l++) {
if (n_frames==1)
printf("Ns %d, l %d, l2 %d\n",Ns, l, l+(Ns%2)*pilot2);
// printf("Ns %d, l %d, l2 %d\n",Ns, l, l+(Ns%2)*pilot2);
/*
This function implements the OFDM front end processor (FEP).
......@@ -3435,11 +3744,19 @@ int main(int argc, char **argv)
}
if ((Ns==((2*subframe))) && (l==0)) {
/*ue_rrc_measurements(UE,
0,
0);*/
lte_ue_measurements(UE,
subframe*UE->frame_parms.samples_per_tti,
1,
0,
rank_adapt,
subframe);
if ((transmission_mode == 3) || (transmission_mode == 4))
rank_indc[round] = UE->measurements.rank[0];
//printf ("Trial %d, Measurements are done \n", trials);
/*
debug_msg("RX RSSI %d dBm, digital (%d, %d) dB, linear (%d, %d), avg rx power %d dB (%d lin), RX gain %d dB\n",
......@@ -3597,6 +3914,18 @@ int main(int argc, char **argv)
UE->dlsch[subframe&0x1][0][0]->harq_processes[0]->first_tx=1;
UE->dlsch[subframe&0x1][0][1]->harq_processes[0]->first_tx=1;
}
#ifdef DEBUG_HARQ
printf("[DLSIM 3 ] UE->dlsch[subframe&0x1][0][1]->pmi_alloc %d \n", UE->dlsch[subframe&0x1][0][1]->pmi_alloc);
#endif
if (transmission_mode==4 && use_sic_receiver==1){
if (rx_type>rx_IC_single_stream)
rx_type=rx_SIC_dual_stream;
}
else if (transmission_mode==4 && use_sic_receiver==0){
if (rx_type>rx_IC_single_stream)
rx_type=rx_IC_dual_stream;
}
switch (transmission_mode) {
case 1:
......@@ -3648,7 +3977,6 @@ int main(int argc, char **argv)
P_RNTI,
transmission_mode<7?0:transmission_mode,
UE->pdcch_vars[subframe&0x1][0]->crnti_is_temporary? UE->pdcch_vars[subframe&0x1][0]->crnti: 0);
break;
case 5:
case 6:
......@@ -3775,15 +4103,14 @@ int main(int argc, char **argv)
printf("[DLSIM] Skip TB0 \n");
#endif
TB++;
}
#ifdef DEBUG_HARQ
printf("[DLSIM] process TB %d \n", TB);
printf("[DLSIM] process TB %d Kmimo %d \n", TB, Kmimo);
#endif
if (TB==1 && TB1_active == 0){
#ifdef DEBUG_HARQ
printf("[DLSIM] Skip TB1 \n");
printf("[DLSIM] Skip TB1 round %d\n", round);
#endif
break;
}
......@@ -3844,21 +4171,25 @@ int main(int argc, char **argv)
0,
UE->dlsch[subframe&0x1][0][TB],
coded_bits_per_codeword[TB],
UE->pdsch_vars[subframe&0x1][eNB_id]->llr[UE->dlsch[subframe&0x1][0][TB]->harq_processes[UE->dlsch[subframe&0x1][0][TB]->current_harq_pid]->codeword],
UE->pdsch_vars[subframe&0x1][eNB_id]->llr[TB],
TB,
subframe<<1);
stop_meas(&UE->dlsch_unscrambling_stats);
start_meas(&UE->dlsch_decoding_stats[subframe&0x1]);
#ifdef DEBUG_HARQ
//printf("non-SIC decoding TB %d LLR is %d\n", TB, UE->dlsch[subframe&0x1][0][TB]->harq_processes[UE->dlsch[subframe&0x1][0][TB]->current_harq_pid]->codeword);
#endif
ret[TB] = dlsch_decoding(UE,
UE->pdsch_vars[subframe&0x1][eNB_id]->llr[UE->dlsch[subframe&0x1][0][TB]->harq_processes[UE->dlsch[subframe&0x1][0][TB]->current_harq_pid]->codeword],
UE->pdsch_vars[subframe&0x1][eNB_id]->llr[TB],
&UE->frame_parms,
UE->dlsch[subframe&0x1][0][TB],
UE->dlsch[subframe&0x1][0][TB]->harq_processes[UE->dlsch[subframe&0x1][0][TB]->current_harq_pid],
0,
subframe,
UE->dlsch[subframe&0x1][0][TB]->current_harq_pid,
1,llr8_flag);
1,
llr8_flag);
stop_meas(&UE->dlsch_decoding_stats[subframe&0x1]);
#ifdef DEBUG_HARQ
printf("[DLSIM] ret[%d] = %d\n", TB, ret[TB]);
......@@ -3870,6 +4201,7 @@ int main(int argc, char **argv)
if (ret[TB] <= UE->dlsch[subframe&0x1][0][0]->max_turbo_iterations ) { //if CW0 is decoded, approach CW1
decoded_tb[TB]=1;
#ifdef DEBUG_HARQ
printf("[DLSIM] TB%d is decoded\n", TB);
#endif
......@@ -3877,7 +4209,7 @@ int main(int argc, char **argv)
/*avg_iter[TB] += ret[TB];
iter_trials[TB]++;*/
if (n_frames==2) {
if (n_frames==1) {
printf("cw non sic %d, round %d: No DLSCH errors found, uncoded ber %f\n",TB,round,uncoded_ber);
#ifdef PRINT_BYTES
for (s=0;s<UE->dlsch[subframe&0x1][0][TB]->harq_processes[0]->C;s++) {
......@@ -4003,12 +4335,10 @@ int main(int argc, char **argv)
(rx_type==rx_SIC_dual_stream)) {
#ifdef DEBUG_HARQ
printf("[DLSIM] Starting SIC procedure\n");
printf("current round = %d\n", PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid]->round);
printf("\n CW 0 is decoded, i go for , round %d\n", round);
printf("\n ret[TB0] = %d round %d\n", ret[TB], round);
#endif
// printf("current round = %d\n", PHY_vars_UE->dlsch_ue[eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid]->round);
//printf("\n CW 0 is decoded, i go for , round %d\n", round);
//printf("\n ret[TB0] = %d round %d\n", ret[TB], round);
sic_attempt[round]++;
for (round_sic = 0 ; round_sic < (round +1); round_sic++) {
......@@ -4025,38 +4355,29 @@ int main(int argc, char **argv)
dlsch0_eNB_harq->rb_alloc[0] = dlsch0_ue_harq->rb_alloc_even[0];
dlsch0_eNB_harq->nb_rb = dlsch0_ue_harq->nb_rb;
dlsch0_eNB_harq->mcs = dlsch0_ue_harq->mcs;
dlsch0_eNB_harq->rvidx = dlsch0_ue_harq->rvidx;
dlsch0_eNB_harq->rvidx = round_sic;//dlsch0_ue_harq->rvidx;
//printf("dlsch0_eNB_harq->rvidx = %d \n", dlsch0_eNB_harq->rvidx);
dlsch0_eNB_harq->Nl = dlsch0_ue_harq->Nl;
dlsch0_eNB_harq->round = dlsch0_ue_harq->round;
dlsch0_eNB_harq->round = round_sic; //dlsch0_ue_harq->round;
dlsch0_eNB_harq->TBS = dlsch0_ue_harq->TBS;
dlsch0_eNB_harq->dl_power_off = dlsch0_ue_harq->dl_power_off;
dlsch0_eNB_harq->status = dlsch0_ue_harq->status;
if (round_sic == 0){
UE->dlsch_eNB[eNB_id]->harq_processes[UE->dlsch[subframe&0x1][eNB_id][1]->current_harq_pid]->rvidx = 0;
UE->dlsch[subframe&0x1][0][1]->harq_processes[UE->dlsch[subframe&0x1][0][1]->current_harq_pid]->rvidx=0;
}
else if (round_sic == 1){
UE->dlsch_eNB[eNB_id]->harq_processes[UE->dlsch[subframe&0x1][eNB_id][1]->current_harq_pid]->rvidx = 1;
UE->dlsch[subframe&0x1][0][1]->harq_processes[UE->dlsch[subframe&0x1][0][1]->current_harq_pid]->rvidx=1;
}
else if (round_sic == 2){
UE->dlsch_eNB[eNB_id]->harq_processes[UE->dlsch[subframe&0x1][eNB_id][1]->current_harq_pid]->rvidx = 2;
UE->dlsch[subframe&0x1][0][1]->harq_processes[UE->dlsch[subframe&0x1][0][1]->current_harq_pid]->rvidx=2;
}
else{
UE->dlsch_eNB[eNB_id]->harq_processes[UE->dlsch[subframe&0x1][eNB_id][1]->current_harq_pid]->rvidx = 3;
UE->dlsch[subframe&0x1][0][1]->harq_processes[UE->dlsch[subframe&0x1][0][1]->current_harq_pid]->rvidx=3;
}
UE->dlsch_eNB[eNB_id]->harq_processes[UE->dlsch[subframe&0x1][eNB_id][0]->current_harq_pid]->rvidx = round_sic;
UE->dlsch[subframe&0x1][0][1]->harq_processes[UE->dlsch[subframe&0x1][0][1]->current_harq_pid]->rvidx=round_sic;
UE->dlsch_eNB[eNB_id]->harq_processes[UE->dlsch[subframe&0x1][eNB_id][0]->current_harq_pid]->round = round_sic;
UE->dlsch[subframe&0x1][0][1]->harq_processes[UE->dlsch[subframe&0x1][0][1]->current_harq_pid]->round=round_sic;
UE->dlsch_eNB[eNB_id]->active = UE->dlsch[subframe&0x1][eNB_id][0]->active;
UE->dlsch_eNB[eNB_id]->rnti = UE->dlsch[subframe&0x1][eNB_id][0]->rnti;
UE->dlsch_eNB[eNB_id]->current_harq_pid = UE->dlsch[subframe&0x1][eNB_id][0]->current_harq_pid;
#ifdef DEBUG_HARQ
printf("UE->dlsch_eNB[eNB_id]->harq_processes[UE->dlsch[subframe&0x1][eNB_id][0]->current_harq_pid]->round = %d\n", UE->dlsch_eNB[eNB_id]->harq_processes[UE->dlsch[subframe&0x1][eNB_id][0]->current_harq_pid]->round);
#endif
dlsch_encoding_SIC(UE,
input_buffer0[0], //UE->dlsch[subframe&0x1][eNB_id][0]->harq_processes[PHY_vars_UE->dlsch_ue[eNB_id][0]->current_harq_pid]->b,,
num_pdcch_symbols,
UE->dlsch_eNB[eNB_id],
&UE->dlsch_eNB[0][0],
0,
subframe,
&UE->dlsch_rate_matching_stats,
......@@ -4076,7 +4397,7 @@ int main(int argc, char **argv)
dlsch_scrambling(&UE->frame_parms,
0,
UE->dlsch_eNB[eNB_id],
&UE->dlsch_eNB[0][0],
coded_bits_per_codeword[0],
0,
subframe<<1);
......@@ -4100,47 +4421,44 @@ int main(int argc, char **argv)
case 2:
dlsch_qpsk_llr_SIC(&UE->frame_parms,
UE->pdsch_vars[subframe&0x1][eNB_id]->rxdataF_comp1[UE->dlsch[subframe&0x1][0][0]->current_harq_pid][round_sic],
UE->pdsch_vars[subframe&0x1][eNB_id]->rxdataF_comp1[UE->dlsch[subframe&0x1][0][1]->current_harq_pid][round_sic],
sic_buffer,
UE->pdsch_vars[subframe&0x1][eNB_id]->dl_ch_rho_ext[UE->dlsch[subframe&0x1][0][0]->current_harq_pid][round_sic],
UE->pdsch_vars[subframe&0x1][eNB_id]->llr[UE->dlsch[subframe&0x1][0][1]->harq_processes[UE->dlsch[subframe&0x1][0][1]->current_harq_pid]->codeword],
UE->pdsch_vars[subframe&0x1][eNB_id]->dl_ch_rho_ext[UE->dlsch[subframe&0x1][0][1]->current_harq_pid][round_sic],
UE->pdsch_vars[subframe&0x1][eNB_id]->llr[1],
num_pdcch_symbols,
dlsch0_eNB_harq->nb_rb,
subframe,
dlsch0_eNB_harq->rb_alloc[0],
get_Qm(eNB->dlsch[0][0]->harq_processes[0]->mcs),
UE->dlsch[subframe&0x1][eNB_id][0]);
dlsch0_eNB_harq->rb_alloc[0]);
break;
case 4:
dlsch_16qam_llr_SIC(&UE->frame_parms,
UE->pdsch_vars[subframe&0x1][eNB_id]->rxdataF_comp1[UE->dlsch[subframe&0x1][0][0]->current_harq_pid][round_sic],
UE->pdsch_vars[subframe&0x1][eNB_id]->rxdataF_comp1[UE->dlsch[subframe&0x1][0][1]->current_harq_pid][round_sic],
sic_buffer,
UE->pdsch_vars[subframe&0x1][eNB_id]->dl_ch_rho_ext[UE->dlsch[subframe&0x1][0][0]->current_harq_pid][round_sic],
UE->pdsch_vars[subframe&0x1][eNB_id]->llr[UE->dlsch[subframe&0x1][0][1]->harq_processes[UE->dlsch[subframe&0x1][0][1]->current_harq_pid]->codeword],
UE->pdsch_vars[subframe&0x1][eNB_id]->dl_ch_rho_ext[UE->dlsch[subframe&0x1][0][1]->current_harq_pid][round_sic],
UE->pdsch_vars[subframe&0x1][eNB_id]->llr[1],
num_pdcch_symbols,
UE->pdsch_vars[subframe&0x1][eNB_id]->dl_ch_mag1[UE->dlsch[subframe&0x1][0][0]->current_harq_pid][round_sic],
UE->pdsch_vars[subframe&0x1][eNB_id]->dl_ch_mag1[UE->dlsch[subframe&0x1][0][1]->current_harq_pid][round_sic],
dlsch0_eNB_harq->nb_rb,
subframe,
dlsch0_eNB_harq->rb_alloc[0],
get_Qm(eNB->dlsch[0][TB]->harq_processes[0]->mcs),
UE->dlsch[subframe&0x1][eNB_id][0]);
get_Qm(eNB->dlsch[0][0]->harq_processes[0]->mcs),
dlsch0_eNB_harq->rb_alloc[0]);
break;
case 6:
dlsch_64qam_llr_SIC(&UE->frame_parms,
UE->pdsch_vars[subframe&0x1][eNB_id]->rxdataF_comp1[UE->dlsch[subframe&0x1][0][0]->current_harq_pid][round_sic],
UE->pdsch_vars[subframe&0x1][eNB_id]->rxdataF_comp1[UE->dlsch[subframe&0x1][0][1]->current_harq_pid][round_sic],
sic_buffer,
UE->pdsch_vars[subframe&0x1][eNB_id]->dl_ch_rho_ext[UE->dlsch[subframe&0x1][0][0]->current_harq_pid][round_sic],
UE->pdsch_vars[subframe&0x1][eNB_id]->llr[UE->dlsch[subframe&0x1][0][1]->harq_processes[UE->dlsch[subframe&0x1][0][1]->current_harq_pid]->codeword],
UE->pdsch_vars[subframe&0x1][eNB_id]->dl_ch_rho_ext[UE->dlsch[subframe&0x1][0][1]->current_harq_pid][round_sic],
UE->pdsch_vars[subframe&0x1][eNB_id]->llr[1],
num_pdcch_symbols,
UE->pdsch_vars[subframe&0x1][eNB_id]->dl_ch_mag1[UE->dlsch[subframe&0x1][0][0]->current_harq_pid][round_sic],
UE->pdsch_vars[subframe&0x1][eNB_id]->dl_ch_magb1[UE->dlsch[subframe&0x1][0][0]->current_harq_pid][round_sic],
UE->pdsch_vars[subframe&0x1][eNB_id]->dl_ch_mag1[UE->dlsch[subframe&0x1][0][1]->current_harq_pid][round_sic],
UE->pdsch_vars[subframe&0x1][eNB_id]->dl_ch_magb1[UE->dlsch[subframe&0x1][0][1]->current_harq_pid][round_sic],
dlsch0_eNB_harq->nb_rb,
subframe,
dlsch0_eNB_harq->rb_alloc[0],
get_Qm(eNB->dlsch[0][0]->harq_processes[0]->mcs),
UE->dlsch[subframe&0x1][eNB_id][TB]);
dlsch0_eNB_harq->rb_alloc[0]);
break;
}
//}// rouns sic
......@@ -4165,7 +4483,7 @@ int main(int argc, char **argv)
UE->dlsch[subframe&0x1][0][1]->harq_processes[UE->dlsch[subframe&0x1][0][1]->current_harq_pid]->G = coded_bits_per_codeword[1];
UE->dlsch[subframe&0x1][0][1]->harq_processes[UE->dlsch[subframe&0x1][0][1]->current_harq_pid]->Qm = get_Qm(eNB->dlsch[0][1]->harq_processes[0]->mcs);
if (n_frames==2) {
if (n_frames==1) {
printf("Kmimo=%d, cw=%d, G=%d, TBS=%d\n",Kmimo,1,coded_bits_per_codeword[1],
UE->dlsch[subframe&0x1][0][1]->harq_processes[UE->dlsch[subframe&0x1][0][1]->current_harq_pid]->TBS);
......@@ -4203,7 +4521,7 @@ int main(int argc, char **argv)
0,
UE->dlsch[subframe&0x1][0][1],
coded_bits_per_codeword[1],
UE->pdsch_vars[subframe&0x1][eNB_id]->llr[UE->dlsch[subframe&0x1][0][1]->harq_processes[UE->dlsch[subframe&0x1][0][1]->current_harq_pid]->codeword],
UE->pdsch_vars[subframe&0x1][eNB_id]->llr[1],
1,
subframe<<1);
stop_meas(&UE->dlsch_unscrambling_stats);
......@@ -4211,7 +4529,7 @@ int main(int argc, char **argv)
start_meas(&UE->dlsch_decoding_stats[subframe&0x1]);
ret[1] = dlsch_decoding(UE,
UE->pdsch_vars[subframe&0x1][eNB_id]->llr[UE->dlsch[subframe&0x1][0][1]->harq_processes[UE->dlsch[subframe&0x1][0][1]->current_harq_pid]->codeword],
UE->pdsch_vars[subframe&0x1][eNB_id]->llr[1],
&UE->frame_parms,
UE->dlsch[subframe&0x1][0][1],
UE->dlsch[subframe&0x1][0][1]->harq_processes[UE->dlsch[subframe&0x1][0][1]->current_harq_pid],
......@@ -4228,6 +4546,7 @@ int main(int argc, char **argv)
//printf("ret TB 1 = %d round %d \n", ret[1], round);
if (ret[1] <=UE->dlsch[subframe&0x1][0][0]->max_turbo_iterations ) {
decoded_tb[1]=1;
decoded_in_sic[round]++;
round_sic = round+1; // to exit round_sic
#ifdef DEBUG_HARQ
......@@ -4237,7 +4556,7 @@ int main(int argc, char **argv)
iter_trials[1]++;
if (n_frames==2) {
if (n_frames==1) {
printf("cw sic %d, round %d: No DLSCH errors found, uncoded ber %f\n",1,round,uncoded_ber);
#ifdef PRINT_BYTES
......@@ -4262,6 +4581,7 @@ int main(int argc, char **argv)
if (ret[1] > UE->dlsch[subframe&0x1][0][0]->max_turbo_iterations ){
decoded_tb[1]=0;
errs[1][round]++;
#ifdef DEBUG_HARQ
printf("[DLSIM] TB1 is not decoded in SIC loop, errs[TB1][round %d] = %d\n",round, errs[1][round]);
......@@ -4272,7 +4592,7 @@ int main(int argc, char **argv)
avg_iter[1] += ret[1]-1;
iter_trials[1]++;
if (n_frames==2) {
if (n_frames==1) {
//if ((n_frames==1) || (SNR>=30)) {
printf("cw sic %d, round %d: DLSCH errors found, uncoded ber %f\n",1,round,uncoded_ber);
#ifdef PRINT_BYTES
......@@ -4296,6 +4616,10 @@ int main(int argc, char **argv)
}//if SIC
} else {
if (TB0_active && TB1_active)
UE->dlsch[subframe&0x1][0][1]->harq_processes[UE->dlsch[subframe&0x1][0][1]->current_harq_pid]->round++;
decoded_tb[TB]=0;
errs[TB][round]++;
#ifdef DEBUG_HARQ
printf("[DLSIM] TB%d is not decoded outside SIC loop, errs[TB%d][round %d] = %d\n", TB, TB, round, errs[TB][round]);
......@@ -4323,7 +4647,7 @@ int main(int argc, char **argv)
}*/
if (n_frames==2) {
if (n_frames==1) {
//if ((n_frames==1) || (SNR>=30)) {
printf("cw %d, round %d: DLSCH errors found, uncoded ber %f\n",TB,round,uncoded_ber);
#ifdef PRINT_BYTES
......@@ -4349,7 +4673,7 @@ int main(int argc, char **argv)
stop_meas(&UE->phy_proc_rx[subframe&0x1]);
if (n_frames==1) {
if (n_frames==4) {
//rxsig
sprintf(fname,"rxsig0_r%d.m",round);
......@@ -4444,8 +4768,66 @@ int main(int argc, char **argv)
round++;
}
/* if ((rank_indc[0]==0) && (rank_adapt==1))
errs[1][0]++;*/
if (transmission_mode == 3 || transmission_mode == 4 ) {
if (TB0_active==1)
active_tb0_sent[round]++;
if (TB1_active==1)
active_tb1_sent[round]++;
if (TB0_active==1 && decoded_tb[0]==0)
failed_tb0[round]++;
if (TB1_active==1 && decoded_tb[1]==0)
failed_tb1[round]++;
if (round==0){
if (rank_adapt==1){
if (rank_indc[0]==1)
clsm_counter++;
}
}
if (rank_indc[0]==1 || (rank_indc[0]==0 && rank_adapt==0)){
if ((TB0_active==1) && (decoded_tb[0]==1)){
throug_tb0=rate0_init*get_Qm(eNB->dlsch[0][0]->harq_processes[0]->mcs)/(round+1);
#ifdef DEBUG_HARQ
printf("rank 2 round %d, TB0 contributes to throughput throug_tb0 %f \n", round, throug_tb0 );
#endif
} else if (((TB0_active==1) && (decoded_tb[0]==0)) || (TB0_active==0)){
throug_tb0=0;
}
throug_tb0_acc[round]+=throug_tb0;
} else if ((rank_indc[0]==0) && (rank_adapt==1)){
if ((TB0_active==1) && (decoded_tb[0]==1)){
throug_tb0=rate0_init*get_Qm(eNB->dlsch[0][0]->harq_processes[0]->mcs)/(round+1);
#ifdef DEBUG_HARQ
printf("rank 1 round %d, TB0 contributes to throughput throug_tb0 %f \n", round, throug_tb0 );
#endif
} else if (((TB0_active==1) && (decoded_tb[0]==0)) || (TB0_active==0)){
throug_tb0=0;
}
throug_tb0_acc[round]+=throug_tb0;
}
if (rank_indc[0]==1 || (rank_indc[0]==0 && rank_adapt==0)){
if ((TB1_active==1) && (decoded_tb[1]==1)){
throug_tb1=rate1_init*get_Qm(eNB->dlsch[0][1]->harq_processes[0]->mcs)/(round+1);
#ifdef DEBUG_HARQ
printf("rank 2 round %d, TB1 contributes to throughput throug_tb1 %f \n", round, throug_tb1 );
#endif
} else if (((TB1_active==1) && (decoded_tb[1]==0)) || (TB1_active==0)){
throug_tb1=0;
}
throug_tb1_acc[round]+=throug_tb1;
}
if (rank_indc[0] == 1 || (rank_indc[0] == 0 && rank_adapt==0)) {
if (ret[0] > UE->dlsch[subframe&0x1][0][0]->max_turbo_iterations &&
ret[1] > UE->dlsch[subframe&0x1][0][0]->max_turbo_iterations){
resend_both[round]++;
......@@ -4491,19 +4873,34 @@ int main(int argc, char **argv)
else
hold_rank1_precoder = 1;
#ifdef DEBUG_HARQ
#ifdef DEBUG_HARQ
printf("[DLSIM] ret[TB0] =%d, ret[TB1] =%d, trial %d \n", ret[0], ret[1], trials);
printf("[DLSIM] TB1 deactivated\n");
#endif
round++;
}
} else if (rank_indc[0] == 0 && rank_adapt == 1){
#ifdef DEBUG_HARQ
printf("I am in case rank_indc[0] == 0 && rank_adapt == 1, decoded_tb[0] = %d\n", decoded_tb[0]);
#endif
if (ret[0] > UE->dlsch[subframe&0x1][0][0]->max_turbo_iterations){
resend_one[round]++;
round++;
resend_cw0_cw1=0; //resend both cws
resend_cw1=0;
TB0_active=1;
TB1_active=0;
}
}
}
#ifdef DEBUG_HARQ
printf("[DLSIM] Now round is %d, trial %d\n" , round, trials);
#endif
}
}
if(transmission_mode != 3 && transmission_mode !=4 ){
if ((errs[0][0]>=n_frames/10) && (trials>(n_frames/2)) )
......@@ -4561,9 +4958,9 @@ int main(int argc, char **argv)
push_front(&time_vector_rx_demod, t_rx_demod);
push_front(&time_vector_rx_dec, t_rx_dec);
} //trials
#ifdef DEBUG_HARQ
printf("\n both failed round 0 = %d, both failed round 1 = %d, both failed round 2 = %d, both failed round 3 = %d\n", resend_both[0], resend_both[1], resend_both[2], resend_both[3]);
printf(" only one failed round 0 = %d, only one failed round 1 = %d, only one failed round 2 = %d, only one failed round 3 = %d\n", resend_one[0], resend_one[1], resend_one[2], resend_one[3]);
......@@ -4680,6 +5077,31 @@ int main(int argc, char **argv)
*/
if (transmission_mode == 3 || transmission_mode == 4) {
throug_tb0_acc_aver[0]=throug_tb0_acc[0]/(double)round_trials[1][0];//active_tb0_sent[0];
throug_tb0_acc_aver[1]=throug_tb0_acc[1]/(double)round_trials[1][0];//active_tb0_sent[1];
throug_tb0_acc_aver[2]=throug_tb0_acc[2]/(double)round_trials[1][0];//active_tb0_sent[2];
throug_tb0_acc_aver[3]=throug_tb0_acc[3]/(double)round_trials[1][0];//active_tb0_sent[3];
throug_tb1_acc_aver[0]=throug_tb1_acc[0]/(double)round_trials[1][0];//active_tb1_sent[0];
throug_tb1_acc_aver[1]=throug_tb1_acc[1]/(double)round_trials[1][0];//active_tb1_sent[1];
throug_tb1_acc_aver[2]=throug_tb1_acc[2]/(double)round_trials[1][0];//active_tb1_sent[2];
throug_tb1_acc_aver[3]=throug_tb1_acc[3]/(double)round_trials[1][0];//active_tb1_sent[3];
throug_tot_acc_aver[0]= throug_tb0_acc_aver[0]+throug_tb1_acc_aver[0];
throug_tot_acc_aver[1]= throug_tb0_acc_aver[1]+throug_tb1_acc_aver[1];
throug_tot_acc_aver[2]= throug_tb0_acc_aver[2]+throug_tb1_acc_aver[2];
throug_tot_acc_aver[3]= throug_tb0_acc_aver[3]+throug_tb1_acc_aver[3];
throug_tot_acc_aver_all_rounds= throug_tot_acc_aver[0]+throug_tot_acc_aver[1]+throug_tot_acc_aver[2]+throug_tot_acc_aver[3];
// FOR CW0
thr_cw0[0] = rate0_init*get_Qm(eNB->dlsch[0][0]->harq_processes[0]->mcs)*(1-((double)errs[0][0]/(double)round_trials[0][0]));
if (num_rounds > 1)
......@@ -4698,17 +5120,25 @@ int main(int argc, char **argv)
#ifdef PRINT_THROUGHPUT
printf("rate %f \n", rate0_init);
printf("rate*mod_order %f \n", rate0_init*get_Qm(eNB->dlsch[0][0]->harq_processes[0]->mcs));
printf("Probability %f \n", (1-((double)errs[0][0]/(double)round_trials[0][0])));
printf("Throughput cw0 sum = %f \n", thr_cw0_tot);
printf("Throughput cw0 round 0 = %f \n", thr_cw0[0]);
printf("Throughput cw0 round 1 = %f \n", thr_cw0[1]);
printf("Throughput cw0 round 2 = %f \n", thr_cw0[2]);
printf("Throughput cw0 round 3 = %f \n", thr_cw0[3]);
printf("Accumulated throughput TB0 round 0 = %f \n", throug_tb0_acc_aver[0]);
printf("Accumulated throughput TB0 round 1 = %f \n", throug_tb0_acc_aver[1]);
printf("Accumulated throughput TB0 round 2 = %f \n", throug_tb0_acc_aver[2]);
printf("Accumulated throughput TB0 round 3 = %f \n", throug_tb0_acc_aver[3]);
printf("Accumulated throughput TB1 round 0 = %f \n", throug_tb1_acc_aver[0]);
printf("Accumulated throughput TB1 round 1 = %f \n", throug_tb1_acc_aver[1]);
printf("Accumulated throughput TB1 round 2 = %f \n", throug_tb1_acc_aver[2]);
printf("Accumulated throughput TB1 round 3 = %f \n", throug_tb1_acc_aver[3]);
printf("round_trials = %d, errs[0][0] = %d, round_trials[0][1] = %d, errs[0][1] = %d, round_trials[0][2] = %d, errs[0][2] = %d, \
round_trials[0][3] = %d, errs[0][3] = %d \n", round_trials[0][0], errs[0][0],round_trials[0][1], errs[0][1], round_trials[0][2], \
errs[0][2], round_trials[0][3], errs[0][3]);
#endif
thr_cw1[0] = rate1_init*get_Qm(eNB->dlsch[0][1]->harq_processes[0]->mcs)*(1-((double)errs[1][0]/(double)round_trials[1][0]));
if (num_rounds > 1)
thr_cw1[1] = (rate1_init*get_Qm(eNB->dlsch[0][1]->harq_processes[0]->mcs)/2)*(((double)errs[1][0] - (double)errs[1][1])/(double)round_trials[1][0]);
......@@ -4806,7 +5236,7 @@ int main(int argc, char **argv)
thr_cw0_tot + thr_cw1_tot,
rate[0],
rate[1]);
}else{
}else if (((transmission_mode==3) || (transmission_mode==4)) && (rank_adapt==0)){
printf("Errors (%d(%d)/%d %d(%d)/%d %d(%d)/%d %d(%d)/%d),"
"dci_errors %d/%d, thr TB0 = %f , thr TB1 = %f, overall thr = %f , rate 0 = %f , rate 1 = %f \n",
errs[0][0],
......@@ -4828,6 +5258,29 @@ int main(int argc, char **argv)
thr_cw0_tot + thr_cw1_tot,
rate0_init,
rate1_init);
} else{
printf("Errors: r0 TB0 %d/%d TB1 %d/%d, r1 TB0 %d/%d TB1 %d/%d, r2 TB0 %d/%d TB1 %d/%d, r3 TB0 %d/%d TB1 %d/%d,"
"Through tot: TB0 = %f, TB1 = %f, overall thr = %f, clsm applied %d times\n",
failed_tb0[0],
active_tb0_sent[0],
failed_tb1[0],
active_tb1_sent[0],
failed_tb0[1],
active_tb0_sent[1],
failed_tb1[1],
active_tb1_sent[1],
failed_tb0[2],
active_tb0_sent[2],
failed_tb1[2],
active_tb1_sent[2],
failed_tb0[3],
active_tb0_sent[3],
failed_tb1[3],
active_tb1_sent[3],
throug_tb0_acc_aver[0]+throug_tb0_acc_aver[1]+throug_tb0_acc_aver[2]+throug_tb0_acc_aver[3],
throug_tb1_acc_aver[0]+throug_tb1_acc_aver[1]+throug_tb1_acc_aver[2]+throug_tb1_acc_aver[3],
throug_tot_acc_aver_all_rounds,
clsm_counter);
}
if (print_perf==1) {
......@@ -4934,7 +5387,7 @@ int main(int argc, char **argv)
}
if ((transmission_mode != 3) && (transmission_mode != 4)) {
fprintf(bler_fd,"%f;%d;%d;%f;%d;%d;%d;%d;%d;%d;%d;%d;%d\n",
fprintf(bler_fd,"%f;%d;%d;%f;%d;%d;%d;%d;%d;%d;%d;%d\n",
SNR,
mcs1,
eNB->dlsch[0][0]->harq_processes[0]->TBS,
......@@ -4946,112 +5399,225 @@ int main(int argc, char **argv)
errs[0][2],
round_trials[0][2],
errs[0][3],
round_trials[0][3],
dci_errors);
}
else if ( rx_type== rx_SIC_dual_stream) {
fprintf(bler_fd,"%f;%d;%d;%d;%d;%f;%f;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f\n",
round_trials[0][3]);
} else if(rx_type== rx_SIC_dual_stream){
fprintf(bler_fd,"%f;%d;%d;%d;%d;%d;%d;%f;%f;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f\n",
SNR,
rank_adapt,
clsm_counter,
mcs1,
mcs2,
tbs0_init,
tbs1_init,
rate0_init,
rate1_init,
errs[0][0],
errs[1][0],
round_trials[0][0],
round_trials[1][0],
failed_tb0[0],
failed_tb1[0],
active_tb0_sent[0],
active_tb1_sent[0],
sic_attempt[0],
decoded_in_sic[0],
resend_both[0],
resend_one[0],
errs[0][1],
errs[1][1],
round_trials[0][1],
round_trials[1][1],
failed_tb0[1],
failed_tb1[1],
active_tb0_sent[1],
active_tb1_sent[1],
sic_attempt[1],
decoded_in_sic[1],
resend_both[1],
resend_one[1],
errs[0][2],
errs[1][2],
round_trials[0][2],
round_trials[1][2],
failed_tb0[2],
failed_tb1[2],
active_tb0_sent[2],
active_tb1_sent[2],
sic_attempt[2],
decoded_in_sic[2],
resend_both[2],
resend_one[2],
errs[0][3],
errs[1][3],
round_trials[0][3],
round_trials[1][3],
failed_tb0[3],
failed_tb1[3],
active_tb0_sent[3],
active_tb1_sent[3],
sic_attempt[3],
decoded_in_sic[3],
thr_cw0[0],
thr_cw1[0],
thr_cw0[0]+thr_cw1[0],
thr_cw0[1],
thr_cw1[1],
thr_cw0[1]+thr_cw1[1],
thr_cw0[2],
thr_cw1[2],
thr_cw0[2]+thr_cw1[2],
thr_cw0[3],
thr_cw1[3],
thr_cw0[3]+thr_cw1[3],
thr_cw0[0]+thr_cw0[1]+thr_cw0[2]+thr_cw0[3]+thr_cw1[0]+thr_cw1[1]+thr_cw1[2]+ thr_cw1[3]);
throug_tb0_acc_aver[0],
throug_tb1_acc_aver[0],
throug_tb0_acc_aver[0]+throug_tb1_acc_aver[0],
throug_tb0_acc_aver[1],
throug_tb1_acc_aver[1],
throug_tb0_acc_aver[1]+throug_tb1_acc_aver[1],
throug_tb0_acc_aver[2],
throug_tb1_acc_aver[2],
throug_tb0_acc_aver[2]+throug_tb1_acc_aver[2],
throug_tb0_acc_aver[3],
throug_tb1_acc_aver[3],
throug_tb0_acc_aver[3]+throug_tb1_acc_aver[3],
throug_tot_acc_aver_all_rounds);
} else if ((rx_type!= rx_SIC_dual_stream)){
fprintf(bler_fd,"%f;%d;%d;%d;%d;%d;%d;%f;%f;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f\n",
SNR,
rank_adapt,
clsm_counter,
mcs1,
mcs2,
tbs0_init,
tbs1_init,
rate0_init,
rate1_init,
failed_tb0[0],
failed_tb1[0],
active_tb0_sent[0],
active_tb1_sent[0],
TB0_deact[0],
TB1_deact[0],
resend_both[0],
resend_one[0],
failed_tb0[1],
failed_tb1[1],
active_tb0_sent[1],
active_tb1_sent[1],
TB0_deact[1],
TB1_deact[1],
resend_both[1],
resend_one[1],
failed_tb0[2],
failed_tb1[2],
active_tb0_sent[2],
active_tb1_sent[2],
TB0_deact[2],
TB1_deact[2],
resend_both[2],
resend_one[2],
failed_tb0[3],
failed_tb1[3],
active_tb0_sent[3],
active_tb1_sent[3],
throug_tb0_acc_aver[0],
throug_tb1_acc_aver[0],
throug_tb0_acc_aver[0]+throug_tb1_acc_aver[0],
throug_tb0_acc_aver[1],
throug_tb1_acc_aver[1],
throug_tb0_acc_aver[1]+throug_tb1_acc_aver[1],
throug_tb0_acc_aver[2],
throug_tb1_acc_aver[2],
throug_tb0_acc_aver[2]+throug_tb1_acc_aver[2],
throug_tb0_acc_aver[3],
throug_tb1_acc_aver[3],
throug_tb0_acc_aver[3]+throug_tb1_acc_aver[3],
throug_tot_acc_aver_all_rounds);
}
if (transmission_mode==3 || transmission_mode==4){
if (rx_type== rx_SIC_dual_stream){
fprintf(rankadapt_fd,"%f;%d;%d;%d;%d;%d;%d;%f;%f;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f\n",
SNR,
rank_adapt,
clsm_counter,
mcs1,
mcs2,
tbs0_init,
tbs1_init,
rate0_init,
rate1_init,
failed_tb0[0],
failed_tb1[0],
active_tb0_sent[0],
active_tb1_sent[0],
sic_attempt[0],
decoded_in_sic[0],
resend_both[0],
resend_one[0],
failed_tb0[1],
failed_tb1[1],
active_tb0_sent[1],
active_tb1_sent[1],
sic_attempt[1],
decoded_in_sic[1],
resend_both[1],
resend_one[1],
failed_tb0[2],
failed_tb1[2],
active_tb0_sent[2],
active_tb1_sent[2],
sic_attempt[2],
decoded_in_sic[2],
resend_both[2],
resend_one[2],
failed_tb0[3],
failed_tb1[3],
active_tb0_sent[3],
active_tb1_sent[3],
sic_attempt[3],
decoded_in_sic[3],
throug_tb0_acc_aver[0],
throug_tb1_acc_aver[0],
throug_tb0_acc_aver[0]+throug_tb1_acc_aver[0],
throug_tb0_acc_aver[1],
throug_tb1_acc_aver[1],
throug_tb0_acc_aver[1]+throug_tb1_acc_aver[1],
throug_tb0_acc_aver[2],
throug_tb1_acc_aver[2],
throug_tb0_acc_aver[2]+throug_tb1_acc_aver[2],
throug_tb0_acc_aver[3],
throug_tb1_acc_aver[3],
throug_tb0_acc_aver[3]+throug_tb1_acc_aver[3],
throug_tot_acc_aver_all_rounds);
}
else{
fprintf(bler_fd,"%f;%d;%d;%d;%d;%f;%f;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f\n",
fprintf(rankadapt_fd,"%f;%d;%d;%d;%d;%d;%d;%f;%f;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f;%f\n",
SNR,
rank_adapt,
clsm_counter,
mcs1,
mcs2,
tbs0_init,
tbs1_init,
rate0_init,
rate1_init,
errs[0][0],
errs[1][0],
round_trials[0][0],
round_trials[1][0],
failed_tb0[0],
failed_tb1[0],
active_tb0_sent[0],
active_tb1_sent[0],
TB0_deact[0],
TB1_deact[0],
resend_both[0],
resend_one[0],
errs[0][1],
errs[1][1],
round_trials[0][1],
round_trials[1][1],
failed_tb0[1],
failed_tb1[1],
active_tb0_sent[1],
active_tb1_sent[1],
TB0_deact[1],
TB1_deact[1],
resend_both[1],
resend_one[1],
errs[0][2],
errs[1][2],
round_trials[0][2],
round_trials[1][2],
failed_tb0[2],
failed_tb1[2],
active_tb0_sent[2],
active_tb1_sent[2],
TB0_deact[2],
TB1_deact[2],
resend_both[2],
resend_one[2],
errs[0][3],
errs[1][3],
round_trials[0][3],
round_trials[1][3],
thr_cw0[0],
thr_cw1[0],
thr_cw0[0]+thr_cw1[0],
thr_cw0[1],
thr_cw1[1],
thr_cw0[1]+thr_cw1[1],
thr_cw0[2],
thr_cw1[2],
thr_cw0[2]+thr_cw1[2],
thr_cw0[3],
thr_cw1[3],
thr_cw0[3]+thr_cw1[3],
thr_cw0[0]+thr_cw0[1]+thr_cw0[2]+thr_cw0[3]+thr_cw1[0]+thr_cw1[1]+thr_cw1[2]+ thr_cw1[3]);
failed_tb0[3],
failed_tb1[3],
active_tb0_sent[3],
active_tb1_sent[3],
throug_tb0_acc_aver[0],
throug_tb1_acc_aver[0],
throug_tb0_acc_aver[0]+throug_tb1_acc_aver[0],
throug_tb0_acc_aver[1],
throug_tb1_acc_aver[1],
throug_tb0_acc_aver[1]+throug_tb1_acc_aver[1],
throug_tb0_acc_aver[2],
throug_tb1_acc_aver[2],
throug_tb0_acc_aver[2]+throug_tb1_acc_aver[2],
throug_tb0_acc_aver[3],
throug_tb1_acc_aver[3],
throug_tb0_acc_aver[3]+throug_tb1_acc_aver[3],
throug_tot_acc_aver_all_rounds);
}
}
......@@ -5281,7 +5847,7 @@ int main(int argc, char **argv)
}
if (n_frames==1)
if (n_frames==2)
break;
}// SNR
......
......@@ -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