Commit 4aed32e7 authored by hbilel's avatar hbilel

[OAI-UE] slot0 / slot1 parallelization

parent 7580d021
......@@ -5138,10 +5138,70 @@ int check_dci_format2_2a_coherency(DCI_format_t dci_format,
return(1);
}
void compute_llr_offset(LTE_DL_FRAME_PARMS *frame_parms,
LTE_UE_PDCCH *pdcch_vars,
LTE_UE_PDSCH *pdsch_vars,
LTE_DL_UE_HARQ_t *dlsch0_harq,
uint8_t nb_rb_alloc,
uint8_t subframe)
{
uint32_t pbch_pss_sss_re;
uint32_t crs_re;
uint32_t granted_re;
uint32_t data_re;
uint32_t llr_offset;
uint8_t symbol;
uint8_t symbol_mod;
pdsch_vars->llr_offset[pdcch_vars->num_pdcch_symbols] = 0;
LOG_I(PHY,"compute_llr_offset: nb RB %d - Qm %d \n", nb_rb_alloc, dlsch0_harq->Qm);
//dlsch0_harq->rb_alloc_even;
//dlsch0_harq->rb_alloc_odd;
for(symbol=pdcch_vars->num_pdcch_symbols; symbol<frame_parms->symbols_per_tti; symbol++)
{
symbol_mod = (symbol >= (7-frame_parms->Ncp))? (symbol-(7-frame_parms->Ncp)) : symbol;
if((symbol_mod == 0) || symbol_mod == (4-frame_parms->Ncp))
{
if (frame_parms->mode1_flag==0)
crs_re = 4;
else
crs_re = 2;
}
else
{
crs_re = 0;
}
granted_re = nb_rb_alloc * (12-crs_re);
pbch_pss_sss_re = adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,dlsch0_harq->Qm,subframe,symbol);
pbch_pss_sss_re = (double)pbch_pss_sss_re * ((double)(12-crs_re)/12);
data_re = granted_re - pbch_pss_sss_re;
llr_offset = data_re * dlsch0_harq->Qm * 2;
pdsch_vars->llr_length[symbol] = data_re;
if(symbol < (frame_parms->symbols_per_tti-1))
pdsch_vars->llr_offset[symbol+1] = pdsch_vars->llr_offset[symbol] + llr_offset;
//LOG_I(PHY,"Granted Re subframe %d / symbol %d => %d (%d RBs)\n", subframe, symbol_mod, granted_re,dlsch0_harq->nb_rb);
//LOG_I(PHY,"Pbch/PSS/SSS Re subframe %d / symbol %d => %d \n", subframe, symbol_mod, pbch_pss_sss_re);
//LOG_I(PHY,"CRS Re Per PRB subframe %d / symbol %d => %d \n", subframe, symbol_mod, crs_re);
//LOG_I(PHY,"Data Re subframe %d / symbol %d => %d \n", subframe, symbol_mod, data_re);
//LOG_I(PHY,"Data Re subframe %d-symbol %d => llr length %d, llr offset %d \n", subframe, symbol,
// pdsch_vars->llr_length[symbol], pdsch_vars->llr_offset[symbol]);
}
}
void prepare_dl_decoding_format1_1A(DCI_format_t dci_format,
uint8_t N_RB_DL,
DCI_INFO_EXTRACTED_t *pdci_info_extarcted,
LTE_DL_FRAME_PARMS *frame_parms,
LTE_UE_PDCCH *pdcch_vars,
LTE_UE_PDSCH *pdsch_vars,
uint8_t subframe,
uint16_t rnti,
uint16_t tc_rnti,
......@@ -5163,12 +5223,27 @@ void prepare_dl_decoding_format1_1A(DCI_format_t dci_format,
uint8_t dai = pdci_info_extarcted->dai;
uint8_t NPRB = 0;
uint8_t nb_rb_alloc = 0;
if(dci_format == format1A)
{
if ((rnti==si_rnti) || (rnti==p_rnti) || (rnti==ra_rnti))
{
NPRB = (TPC&1) + 2;
switch (N_RB_DL) {
case 6:
nb_rb_alloc = RIV2nb_rb_LUT6[rballoc];//NPRB;
break;
case 25:
nb_rb_alloc = RIV2nb_rb_LUT25[rballoc];//NPRB;
break;
case 50:
nb_rb_alloc = RIV2nb_rb_LUT50[rballoc];//NPRB;
break;
case 100:
nb_rb_alloc = RIV2nb_rb_LUT100[rballoc];//NPRB;
break;
}
}
else
{
......@@ -5186,6 +5261,7 @@ void prepare_dl_decoding_format1_1A(DCI_format_t dci_format,
NPRB = RIV2nb_rb_LUT100[rballoc];//NPRB;
break;
}
nb_rb_alloc = NPRB;
}
}
else // format1
......@@ -5345,7 +5421,6 @@ void prepare_dl_decoding_format1_1A(DCI_format_t dci_format,
pdlsch0_harq->rb_alloc_odd[2]= pdlsch0_harq->rb_alloc_even[2];
pdlsch0_harq->rb_alloc_odd[3]= pdlsch0_harq->rb_alloc_even[3];
}
if ((rnti==si_rnti) || (rnti==p_rnti) || (rnti==ra_rnti))
{
pdlsch0_harq->TBS = TBStable[mcs1][NPRB-1];
......@@ -5359,11 +5434,20 @@ void prepare_dl_decoding_format1_1A(DCI_format_t dci_format,
pdlsch0_harq->Qm = get_Qm(mcs1);
}
}
compute_llr_offset(frame_parms,
pdcch_vars,
pdsch_vars,
pdlsch0_harq,
nb_rb_alloc,
subframe);
}
void prepare_dl_decoding_format1C(uint8_t N_RB_DL,
DCI_INFO_EXTRACTED_t *pdci_info_extarcted,
LTE_DL_FRAME_PARMS *frame_parms,
LTE_UE_PDCCH *pdcch_vars,
LTE_UE_PDSCH *pdsch_vars,
uint32_t rnti,
uint32_t si_rnti,
uint32_t ra_rnti,
......@@ -5466,6 +5550,14 @@ void prepare_dl_decoding_format1C(uint8_t N_RB_DL,
AssertFatal(0,"Format 1C: Unknown N_RB_DL %d\n",frame_parms->N_RB_DL);
break;
}
compute_llr_offset(frame_parms,
pdcch_vars,
pdsch_vars,
pdlsch0_harq,
pdlsch0_harq->nb_rb,
subframe);
}
void compute_precoding_info_2cw(uint8_t tpmi, uint8_t tbswap, uint16_t pmi_alloc, LTE_DL_FRAME_PARMS *frame_parms, LTE_DL_UE_HARQ_t *dlsch0_harq, LTE_DL_UE_HARQ_t *dlsch1_harq)
......@@ -5639,6 +5731,8 @@ void compute_precoding_info_format2A(uint8_t tpmi,
void prepare_dl_decoding_format2_2A(DCI_format_t dci_format,
DCI_INFO_EXTRACTED_t *pdci_info_extarcted,
LTE_DL_FRAME_PARMS *frame_parms,
LTE_UE_PDCCH *pdcch_vars,
LTE_UE_PDSCH *pdsch_vars,
uint16_t rnti,
uint8_t subframe,
LTE_DL_UE_HARQ_t *dlsch0_harq,
......@@ -5890,9 +5984,16 @@ void prepare_dl_decoding_format2_2A(DCI_format_t dci_format,
dlsch1_harq->Qm = (mcs2-28)<<1;
}
//#ifdef DEBUG_HARQ
compute_llr_offset(frame_parms,
pdcch_vars,
pdsch_vars,
dlsch0_harq,
dlsch0_harq->nb_rb,
subframe);
#ifdef DEBUG_HARQ
printf("[DCI UE]: dlsch0_harq status %d , dlsch1_harq status %d\n", dlsch0_harq->status, dlsch1_harq->status);
//#endif
#endif
#ifdef DEBUG_HARQ
if (dlsch0 != NULL && dlsch1 != NULL)
......@@ -5909,6 +6010,8 @@ int generate_ue_dlsch_params_from_dci(int frame,
void *dci_pdu,
uint16_t rnti,
DCI_format_t dci_format,
LTE_UE_PDCCH *pdcch_vars,
LTE_UE_PDSCH *pdsch_vars,
LTE_UE_DLSCH_t **dlsch,
LTE_DL_FRAME_PARMS *frame_parms,
PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
......@@ -5998,6 +6101,8 @@ int generate_ue_dlsch_params_from_dci(int frame,
frame_parms->N_RB_DL,
&dci_info_extarcted,
frame_parms,
pdcch_vars,
pdsch_vars,
subframe,
rnti,
tc_rnti,
......@@ -6048,6 +6153,8 @@ int generate_ue_dlsch_params_from_dci(int frame,
prepare_dl_decoding_format1C(frame_parms->N_RB_DL,
&dci_info_extarcted,
frame_parms,
pdcch_vars,
pdsch_vars,
rnti,
si_rnti,
ra_rnti,
......@@ -6099,6 +6206,8 @@ int generate_ue_dlsch_params_from_dci(int frame,
frame_parms->N_RB_DL,
&dci_info_extarcted,
frame_parms,
pdcch_vars,
pdsch_vars,
subframe,
rnti,
tc_rnti,
......@@ -6153,6 +6262,8 @@ int generate_ue_dlsch_params_from_dci(int frame,
prepare_dl_decoding_format2_2A(format2,
&dci_info_extarcted,
frame_parms,
pdcch_vars,
pdsch_vars,
rnti,
subframe,
dlsch0_harq,
......@@ -6207,6 +6318,8 @@ int generate_ue_dlsch_params_from_dci(int frame,
prepare_dl_decoding_format2_2A(format2A,
&dci_info_extarcted,
frame_parms,
pdcch_vars,
pdsch_vars,
rnti,
subframe,
dlsch0_harq,
......
......@@ -91,6 +91,7 @@ extern void print_shorts(char *s,int16_t *x);
int rx_pdsch(PHY_VARS_UE *ue,
UE_rxtx_proc_t *proc,
PDSCH_t type,
unsigned char eNB_id,
unsigned char eNB_id_i, //if this == ue->n_connected_eNB, we assume MU interference
......@@ -747,18 +748,35 @@ int rx_pdsch(PHY_VARS_UE *ue,
}
//printf("LLR dlsch0_harq->Qm %d rx_type %d cw0 %d cw1 %d symbol %d \n",dlsch0_harq->Qm,rx_type,codeword_TB0,codeword_TB1,symbol);
// compute LLRs
// -> // compute @pointer where llrs should filled for this ofdm-symbol
int8_t *pllr_symbol_cw0;
int8_t *pllr_symbol_cw1;
uint32_t llr_offset_symbol;
llr_offset_symbol = pdsch_vars[eNB_id]->llr_offset[symbol];
pllr_symbol_cw0 = (int8_t*)pdsch_vars[eNB_id]->llr[0];
pllr_symbol_cw1 = (int8_t*)pdsch_vars[eNB_id]->llr[1];
pllr_symbol_cw0 += llr_offset_symbol;
pllr_symbol_cw1 += llr_offset_symbol;
/*LOG_I(PHY,"compute LLRs [AbsSubframe %d.%d-%d] NbRB %d Qm %d LLRs-Length %d LLR-Offset %d @LLR Buff %x @LLR Buff(symb) %x\n",
proc->frame_rx, proc->subframe_rx,symbol,
nb_rb,dlsch0_harq->Qm,
pdsch_vars[eNB_id]->llr_length[symbol],
pdsch_vars[eNB_id]->llr_offset[symbol],
(int16_t*)pdsch_vars[eNB_id]->llr[0],
pllr_symbol);*/
switch (dlsch0_harq->Qm) {
case 2 :
if ((rx_type==rx_standard) || (codeword_TB0 == -1) || (codeword_TB1 == -1)) {
dlsch_qpsk_llr(frame_parms,
pdsch_vars[eNB_id]->rxdataF_comp0,
pdsch_vars[eNB_id]->llr[0],
(int16_t*)pllr_symbol_cw0,
symbol,
first_symbol_flag,
nb_rb,
adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,2,subframe,symbol),
pdsch_vars[eNB_id]->llr128,
beamforming_mode);
}
else if (rx_type >= rx_IC_single_stream) {
......@@ -918,12 +936,12 @@ int rx_pdsch(PHY_VARS_UE *ue,
if ((rx_type==rx_standard) || (codeword_TB0 == -1) || (codeword_TB1 == -1)) {
dlsch_64qam_llr(frame_parms,
pdsch_vars[eNB_id]->rxdataF_comp0,
pdsch_vars[eNB_id]->llr[0],
(int16_t*)pllr_symbol_cw0,
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,
pdsch_vars[eNB_id]->llr_offset[symbol],
beamforming_mode);
}
else if (rx_type >= rx_IC_single_stream) {
......@@ -980,10 +998,10 @@ int rx_pdsch(PHY_VARS_UE *ue,
pdsch_vars[eNB_id]->dl_ch_mag0,
dl_ch_mag_ptr,//i
pdsch_vars[eNB_id]->dl_ch_rho2_ext,
pdsch_vars[eNB_id]->llr[0],
(int16_t*)pllr_symbol_cw0,
symbol,first_symbol_flag,nb_rb,
adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,6,subframe,symbol),
pdsch_vars[eNB_id]->llr128);
pdsch_vars[eNB_id]->llr_offset[symbol]);
if (rx_type==rx_IC_dual_stream) {
dlsch_64qam_64qam_llr(frame_parms,
rxdataF_comp_ptr,
......@@ -991,10 +1009,10 @@ int rx_pdsch(PHY_VARS_UE *ue,
dl_ch_mag_ptr,
pdsch_vars[eNB_id]->dl_ch_mag0,//i
pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round],
pdsch_vars[eNB_id]->llr[1],
(int16_t*)pllr_symbol_cw1,
symbol,first_symbol_flag,nb_rb,
adjust_G2(frame_parms,dlsch1_harq->rb_alloc_even,6,subframe,symbol),
pdsch_vars[eNB_id]->llr128_2ndstream);
pdsch_vars[eNB_id]->llr_offset[symbol]);
}
}
}
......@@ -1010,10 +1028,9 @@ int rx_pdsch(PHY_VARS_UE *ue,
if (rx_type==rx_standard) {
dlsch_qpsk_llr(frame_parms,
pdsch_vars[eNB_id]->rxdataF_comp0,
pdsch_vars[eNB_id]->llr[0],
(int16_t*)pllr_symbol_cw0,
symbol,first_symbol_flag,nb_rb,
adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,2,subframe,symbol),
pdsch_vars[eNB_id]->llr128,
beamforming_mode);
}
break;
......@@ -1033,12 +1050,12 @@ int rx_pdsch(PHY_VARS_UE *ue,
if (rx_type==rx_standard) {
dlsch_64qam_llr(frame_parms,
pdsch_vars[eNB_id]->rxdataF_comp0,
pdsch_vars[eNB_id]->llr[0],
(int16_t*)pllr_symbol_cw0,
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,
pdsch_vars[eNB_id]->llr_offset[symbol],
beamforming_mode);
}
break;
......@@ -1096,6 +1113,9 @@ int rx_pdsch(PHY_VARS_UE *ue,
2 * /* ulsch[UE_id]->harq_processes[harq_pid]->nb_rb */ frame_parms->N_RB_UL *12*frame_parms->symbols_per_tti*2));
#endif
if(symbol == (ue->frame_parms.symbols_per_tti>>1)) //(first_symbol_flag)
proc->first_symbol_available = 1;
return(0);
}
......@@ -4604,7 +4624,7 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF,
unsigned char subframe,
uint32_t high_speed_flag,
LTE_DL_FRAME_PARMS *frame_parms,
MIMO_mode_t mimo_mode) {
MIMO_mode_t mimo_mode) {
int prb,nb_rb=0;
int prb_off,prb_off2;
......
......@@ -636,7 +636,6 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t first_symbol_flag,
uint16_t nb_rb,
uint16_t pbch_pss_sss_adjust,
int16_t **llr32p,
uint8_t beamforming_mode)
{
......@@ -645,12 +644,14 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms,
int i,len;
uint8_t symbol_mod = (symbol >= (7-frame_parms->Ncp))? (symbol-(7-frame_parms->Ncp)) : symbol;
/*
if (first_symbol_flag==1) {
llr32 = (uint32_t*)dlsch_llr;
} else {
llr32 = (uint32_t*)(*llr32p);
}
}*/
llr32 = (uint32_t*)dlsch_llr;
if (!llr32) {
msg("dlsch_qpsk_llr: llr is null, symbol %d, llr32=%p\n",symbol, llr32);
return(-1);
......@@ -672,6 +673,13 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms,
//printf("dlsch_qpsk_llr: symbol %d,nb_rb %d, len %d,pbch_pss_sss_adjust %d\n",symbol,nb_rb,len,pbch_pss_sss_adjust);
/*LOG_I(PHY,"dlsch_qpsk_llr: [symb %d / FirstSym %d / Length %d]: @LLR Buff %x, @LLR Buff(symb) %x \n",
symbol,
first_symbol_flag,
len,
dlsch_llr,
llr32);*/
//printf("ll32p=%p , dlsch_llr=%p, symbol=%d, flag=%d \n", llr32, dlsch_llr, symbol, first_symbol_flag);
for (i=0; i<len; i++) {
*llr32 = *rxF;
......@@ -680,7 +688,7 @@ int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms,
llr32++;
}
*llr32p = (int16_t *)llr32;
//*llr32p = (int16_t *)llr32;
return(0);
}
......@@ -1043,7 +1051,8 @@ void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t first_symbol_flag,
uint16_t nb_rb,
uint16_t pbch_pss_sss_adjust,
int16_t **llr_save,
//int16_t **llr_save,
uint32_t llr_offset,
uint8_t beamforming_mode)
{
#if defined(__x86_64__) || defined(__i386__)
......@@ -1057,11 +1066,18 @@ void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
unsigned char symbol_mod,len_mod4;
short *llr;
int16_t *llr2;
int8_t *pllr_symbol;
/*
if (first_symbol_flag==1)
llr = dlsch_llr;
else
llr = *llr_save;
*/
llr = dlsch_llr;
pllr_symbol = (int8_t*)dlsch_llr;
pllr_symbol += llr_offset;
symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol;
......@@ -1085,6 +1101,15 @@ void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
len = (nb_rb*12) - pbch_pss_sss_adjust;
}
// printf("dlsch_64qam_llr: symbol %d,nb_rb %d, len %d,pbch_pss_sss_adjust %d\n",symbol,nb_rb,len,pbch_pss_sss_adjust);
/* LOG_I(PHY,"dlsch_64qam_llr [symb %d / FirstSym %d / Length %d]: @LLR Buff %x \n",
symbol,
first_symbol_flag,
len,
dlsch_llr,
pllr_symbol);*/
llr2 = llr;
llr += (len*6);
......@@ -1179,7 +1204,6 @@ void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
}
*llr_save = llr;
#if defined(__x86_64__) || defined(__i386__)
_mm_empty();
_m_empty();
......@@ -8794,7 +8818,8 @@ int dlsch_64qam_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t first_symbol_flag,
uint16_t nb_rb,
uint16_t pbch_pss_sss_adjust,
int16_t **llr16p)
//int16_t **llr16p,
uint32_t llr_offset)
{
int16_t *rxF = (int16_t*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)];
......@@ -8803,16 +8828,18 @@ int dlsch_64qam_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
int16_t *ch_mag_i = (int16_t*)&dl_ch_mag_i[0][(symbol*frame_parms->N_RB_DL*12)];
int16_t *rho = (int16_t*)&rho_i[0][(symbol*frame_parms->N_RB_DL*12)];
int16_t *llr16;
int8_t *pllr_symbol; // pointer where llrs should filled for this ofdm symbol
int len;
uint8_t symbol_mod = (symbol >= (7-frame_parms->Ncp))? (symbol-(7-frame_parms->Ncp)) : symbol;
//first symbol has different structure due to more pilots
if (first_symbol_flag == 1) {
/*if (first_symbol_flag == 1) {
llr16 = (int16_t*)dlsch_llr;
} else {
llr16 = (int16_t*)(*llr16p);
}
}*/
llr16 = (int16_t*)dlsch_llr;
if (!llr16) {
msg("dlsch_64qam_64qam_llr: llr is null, symbol %d\n",symbol);
return(-1);
......@@ -8831,6 +8858,18 @@ int dlsch_64qam_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
len = (nb_rb*12) - pbch_pss_sss_adjust;
}
pllr_symbol = (int8_t*)dlsch_llr;
pllr_symbol += llr_offset;
//printf("dlsch_64qam_64qam_llr: symbol %d,nb_rb %d, len %d,pbch_pss_sss_adjust %d\n",symbol,nb_rb,len,pbch_pss_sss_adjust);
/*LOG_I(PHY,"dlsch_64qam_64qam_llr [symb %d / FirstSym %d / Length %d / LLR Offset %d]: @LLR Buff %x, @LLR Buff(symb) %x, , @Compute LLR Buff(symb) %x \n",
symbol,
first_symbol_flag,
len,
llr_offset,
(int16_t*)dlsch_llr,
llr16,
pllr_symbol);*/
#ifdef __AVX2__
// Round length up to multiple of 16 words
......@@ -8864,6 +8903,7 @@ int dlsch_64qam_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
(int32_t *) rho_256i,
len);
#endif
free16(rxF_256i, sizeof(rxF_256i));
free16(rxF_i_256i, sizeof(rxF_i_256i));
free16(ch_mag_256i, sizeof(ch_mag_256i));
......@@ -8881,6 +8921,7 @@ int dlsch_64qam_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
#endif
llr16 += (6*len);
*llr16p = (short *)llr16;
//*llr16p = (short *)llr16;
return(0);
}
......@@ -802,7 +802,8 @@ int dlsch_64qam_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
unsigned char first_symbol_flag,
unsigned short nb_rb,
uint16_t pbch_pss_sss_adjust,
short **llr16p);
//short **llr16p,
uint32_t llr_offset);
/** \brief This function generates log-likelihood ratios (decoder input) for single-stream QPSK received waveforms.
......@@ -823,7 +824,7 @@ int32_t dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t first_symbol_flag,
uint16_t nb_rb,
uint16_t pbch_pss_sss_adj,
int16_t **llr128p,
//int16_t **llr128p,
uint8_t beamforming_mode);
/**
......@@ -912,7 +913,8 @@ void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t first_symbol_flag,
uint16_t nb_rb,
uint16_t pbch_pss_sss_adjust,
int16_t **llr_save,
//int16_t **llr_save,
uint32_t llr_offset,
uint8_t beamforming_mode);
......@@ -1297,6 +1299,7 @@ uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue,
@param i_mod Modulation order of the interfering stream
*/
int32_t rx_pdsch(PHY_VARS_UE *phy_vars_ue,
UE_rxtx_proc_t *proc,
PDSCH_t type,
uint8_t eNB_id,
uint8_t eNB_id_i,
......@@ -1646,6 +1649,8 @@ int generate_ue_dlsch_params_from_dci(int frame,
void *dci_pdu,
rnti_t rnti,
DCI_format_t dci_format,
LTE_UE_PDCCH *pdcch_vars,
LTE_UE_PDSCH *pdsch_vars,
LTE_UE_DLSCH_t **dlsch,
LTE_DL_FRAME_PARMS *frame_parms,
PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
......
......@@ -78,6 +78,17 @@ int slot_fep_ul(LTE_DL_FRAME_PARMS *frame_parms,
unsigned char eNb_id,
int no_prefix);
int front_end_fft(PHY_VARS_UE *ue,
unsigned char l,
unsigned char Ns,
int sample_offset,
int no_prefix);
int front_end_chanEst(PHY_VARS_UE *ue,
unsigned char l,
unsigned char Ns,
int reset_freq_est);
void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRAME_PARMS *frame_parms);
void do_OFDM_mod(int32_t **txdataF, int32_t **txdata, uint32_t frame,uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms);
......
......@@ -240,3 +240,215 @@ int slot_fep(PHY_VARS_UE *ue,
#endif
return(0);
}
int front_end_fft(PHY_VARS_UE *ue,
unsigned char l,
unsigned char Ns,
int sample_offset,
int no_prefix)
{
LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
LTE_UE_COMMON *common_vars = &ue->common_vars;
unsigned char aa;
unsigned char symbol = l+((7-frame_parms->Ncp)*(Ns&1)); ///symbol within sub-frame
unsigned int nb_prefix_samples = (no_prefix ? 0 : frame_parms->nb_prefix_samples);
unsigned int nb_prefix_samples0 = (no_prefix ? 0 : frame_parms->nb_prefix_samples0);
unsigned int subframe_offset;//,subframe_offset_F;
unsigned int slot_offset;
unsigned int frame_length_samples = frame_parms->samples_per_tti * 10;
unsigned int rx_offset;
/*LTE_UE_DLSCH_t **dlsch_ue = phy_vars_ue->dlsch_ue[eNB_id];
unsigned char harq_pid = dlsch_ue[0]->current_harq_pid;
LTE_DL_UE_HARQ_t *dlsch0_harq = dlsch_ue[0]->harq_processes[harq_pid];
int uespec_pilot[9][1200];*/
void (*dft)(int16_t *,int16_t *, int);
int tmp_dft_in[2048] __attribute__ ((aligned (32))); // This is for misalignment issues for 6 and 15 PRBs
switch (frame_parms->ofdm_symbol_size) {
case 128:
dft = dft128;
break;
case 256:
dft = dft256;
break;
case 512:
dft = dft512;
break;
case 1024:
dft = dft1024;
break;
case 1536:
dft = dft1536;
break;
case 2048:
dft = dft2048;
break;
default:
dft = dft512;
break;
}
if (no_prefix) {
subframe_offset = frame_parms->ofdm_symbol_size * frame_parms->symbols_per_tti * (Ns>>1);
slot_offset = frame_parms->ofdm_symbol_size * (frame_parms->symbols_per_tti>>1) * (Ns%2);
} else {
subframe_offset = frame_parms->samples_per_tti * (Ns>>1);
slot_offset = (frame_parms->samples_per_tti>>1) * (Ns%2);
}
// subframe_offset_F = frame_parms->ofdm_symbol_size * frame_parms->symbols_per_tti * (Ns>>1);
if (l<0 || l>=7-frame_parms->Ncp) {
printf("slot_fep: l must be between 0 and %d\n",7-frame_parms->Ncp);
return(-1);
}
if (Ns<0 || Ns>=20) {
printf("slot_fep: Ns must be between 0 and 19\n");
return(-1);
}
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
memset(&common_vars->common_vars_rx_data_per_thread[(Ns>>1)&0x1].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],0,frame_parms->ofdm_symbol_size*sizeof(int));
rx_offset = sample_offset + slot_offset + nb_prefix_samples0 + subframe_offset - SOFFSET;
// Align with 256 bit
// rx_offset = rx_offset&0xfffffff8;
if (l==0) {
if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size))
memcpy((short *)&common_vars->rxdata[aa][frame_length_samples],
(short *)&common_vars->rxdata[aa][0],
frame_parms->ofdm_symbol_size*sizeof(int));
if ((rx_offset&7)!=0) { // if input to dft is not 256-bit aligned, issue for size 6,15 and 25 PRBs
memcpy((void *)tmp_dft_in,
(void *)&common_vars->rxdata[aa][rx_offset % frame_length_samples],
frame_parms->ofdm_symbol_size*sizeof(int));
dft((int16_t *)tmp_dft_in,
(int16_t *)&common_vars->common_vars_rx_data_per_thread[(Ns>>1)&0x1].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
} else { // use dft input from RX buffer directly
start_meas(&ue->rx_dft_stats);
dft((int16_t *)&common_vars->rxdata[aa][(rx_offset) % frame_length_samples],
(int16_t *)&common_vars->common_vars_rx_data_per_thread[(Ns>>1)&0x1].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
stop_meas(&ue->rx_dft_stats);
}
} else {
rx_offset += (frame_parms->ofdm_symbol_size+nb_prefix_samples)*l;// +
// (frame_parms->ofdm_symbol_size+nb_prefix_samples)*(l-1);
#ifdef DEBUG_FEP
// if (ue->frame <100)
LOG_I(PHY,"slot_fep: frame %d: slot %d, symbol %d, nb_prefix_samples %d, nb_prefix_samples0 %d, slot_offset %d, subframe_offset %d, sample_offset %d,rx_offset %d, frame_length_samples %d\n", ue->proc.proc_rxtx[(Ns>>1)&1].frame_rx,Ns, symbol,
nb_prefix_samples,nb_prefix_samples0,slot_offset,subframe_offset,sample_offset,rx_offset,frame_length_samples);
#endif
if (rx_offset > (frame_length_samples - frame_parms->ofdm_symbol_size))
memcpy((void *)&common_vars->rxdata[aa][frame_length_samples],
(void *)&common_vars->rxdata[aa][0],
frame_parms->ofdm_symbol_size*sizeof(int));
start_meas(&ue->rx_dft_stats);
if ((rx_offset&7)!=0) { // if input to dft is not 128-bit aligned, issue for size 6 and 15 PRBs
memcpy((void *)tmp_dft_in,
(void *)&common_vars->rxdata[aa][(rx_offset) % frame_length_samples],
frame_parms->ofdm_symbol_size*sizeof(int));
dft((int16_t *)tmp_dft_in,
(int16_t *)&common_vars->common_vars_rx_data_per_thread[(Ns>>1)&0x1].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
} else { // use dft input from RX buffer directly
dft((int16_t *)&common_vars->rxdata[aa][(rx_offset) % frame_length_samples],
(int16_t *)&common_vars->common_vars_rx_data_per_thread[(Ns>>1)&0x1].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
}
stop_meas(&ue->rx_dft_stats);
}
#ifdef DEBUG_FEP
// if (ue->frame <100)
printf("slot_fep: frame %d: symbol %d rx_offset %d\n", ue->proc.proc_rxtx[(Ns>>1)&1].frame_rx, symbol,rx_offset);
#endif
}
return(0);
}
int front_end_chanEst(PHY_VARS_UE *ue,
unsigned char l,
unsigned char Ns,
int reset_freq_est)
{
LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
LTE_UE_COMMON *common_vars = &ue->common_vars;
uint8_t eNB_id = 0;//ue_common_vars->eNb_id;
unsigned char aa;
unsigned char symbol = l+((7-frame_parms->Ncp)*(Ns&1)); ///symbol within sub-frame
int i;
/*LTE_UE_DLSCH_t **dlsch_ue = phy_vars_ue->dlsch_ue[eNB_id];
unsigned char harq_pid = dlsch_ue[0]->current_harq_pid;
LTE_DL_UE_HARQ_t *dlsch0_harq = dlsch_ue[0]->harq_processes[harq_pid];
int uespec_pilot[9][1200];*/
if (ue->perfect_ce == 0) {
if ((l==0) || (l==(4-frame_parms->Ncp))) {
for (aa=0; aa<frame_parms->nb_antenna_ports_eNB; aa++) {
#ifdef DEBUG_FEP
printf("Channel estimation eNB %d, aatx %d, slot %d, symbol %d\n",eNB_id,aa,Ns,l);
#endif
start_meas(&ue->dlsch_channel_estimation_stats);
lte_dl_channel_estimation(ue,eNB_id,0,
Ns,
aa,
l,
symbol);
stop_meas(&ue->dlsch_channel_estimation_stats);
for (i=0; i<ue->measurements.n_adj_cells; i++) {
lte_dl_channel_estimation(ue,eNB_id,i+1,
Ns,
aa,
l,
symbol);
}
}
// do frequency offset estimation here!
// use channel estimates from current symbol (=ch_t) and last symbol (ch_{t-1})
#ifdef DEBUG_FEP
printf("Frequency offset estimation\n");
#endif
if (l==(4-frame_parms->Ncp)) {
start_meas(&ue->dlsch_freq_offset_estimation_stats);
lte_est_freq_offset(common_vars->common_vars_rx_data_per_thread[(Ns>>1)&0x1].dl_ch_estimates[0],
frame_parms,
l,
&common_vars->freq_offset,
reset_freq_est);
stop_meas(&ue->dlsch_freq_offset_estimation_stats);
}
}
}
return(0);
}
......@@ -392,6 +392,25 @@ typedef struct {
pthread_mutex_t mutex_rxtx;
/// scheduling parameters for RXn-TXnp4 thread
struct sched_param sched_param_rxtx;
/// internal This variable is protected by ref mutex_fep_slot1.
int instance_cnt_fep_slot1;
/// pthread descriptor fep_slot1 thread
pthread_t pthread_fep_slot1;
/// pthread attributes for fep_slot1 processing thread
pthread_attr_t attr_fep_slot1;
/// condition variable for UE fep_slot1 thread;
pthread_cond_t cond_fep_slot1;
/// mutex for UE synch thread
pthread_mutex_t mutex_fep_slot1;
//
uint8_t chan_est_pilot0_slot1_available;
uint8_t llr_slot1_available;
uint8_t dci_slot0_available;
uint8_t first_symbol_available;
/// scheduling parameters for fep_slot1 thread
struct sched_param sched_param_fep_slot1;
int sub_frame_start;
int sub_frame_step;
unsigned long long gotIQs;
......@@ -931,6 +950,14 @@ typedef struct {
} PHY_VARS_UE;
/* this structure is used to pass both UE phy vars and
* proc to the function UE_thread_rxn_txnp4
*/
struct rx_tx_thread_data {
PHY_VARS_UE *UE;
UE_rxtx_proc_t *proc;
};
void exit_fun(const char* s);
static inline int wait_on_condition(pthread_mutex_t *mutex,pthread_cond_t *cond,int *instance_cnt,char *name) {
......
......@@ -925,6 +925,10 @@ typedef struct {
//uint32_t *rb_alloc;
//uint8_t Qm[2];
//MIMO_mode_t mimo_mode;
// llr offset per ofdm symbol
uint32_t llr_offset[14];
// llr length per ofdm symbol
uint32_t llr_length[14];
} LTE_UE_PDSCH;
typedef struct {
......
......@@ -140,6 +140,8 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,UE_rxtx_proc_t *proc,uint8_t
*/
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);
void *UE_thread_fep_slot1(void *arg);
/*! \brief Scheduling for UE TX procedures in TDD S-subframes.
@param phy_vars_ue Pointer to UE variables on which to act
@param eNB_id Local id of eNB on which to act
......
This diff is collapsed.
This diff is collapsed.
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