Commit d3b5de3e authored by Raymond Knopp's avatar Raymond Knopp

multiple threads for SLDCH

parent d52aee11
......@@ -965,11 +965,26 @@ int init_lte_ue_signal(PHY_VARS_UE *ue,
ue->pusch_slsch->rxdataF_comp = (int32_t **)malloc(2*sizeof(int32_t*));
ue->pusch_slsch->ul_ch_mag = (int32_t **)malloc(2*sizeof(int32_t*));
ue->pusch_sldch = (LTE_eNB_PUSCH*)malloc(sizeof(LTE_eNB_PUSCH));
ue->pusch_sldch->rxdataF_ext = (int32_t **)malloc(2*sizeof(int32_t*));
ue->pusch_sldch->drs_ch_estimates = (int32_t **)malloc(2*sizeof(int32_t*));
ue->pusch_sldch->rxdataF_comp = (int32_t **)malloc(2*sizeof(int32_t*));
ue->pusch_sldch->ul_ch_mag = (int32_t **)malloc(2*sizeof(int32_t*));
for (th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
ue->pusch_sldch[th_id] = (LTE_eNB_PUSCH*)malloc(sizeof(LTE_eNB_PUSCH));
ue->pusch_sldch[th_id]->rxdataF_ext = (int32_t **)malloc(2*sizeof(int32_t*));
ue->pusch_sldch[th_id]->drs_ch_estimates = (int32_t **)malloc(2*sizeof(int32_t*));
ue->pusch_sldch[th_id]->rxdataF_comp = (int32_t **)malloc(2*sizeof(int32_t*));
ue->pusch_sldch[th_id]->ul_ch_mag = (int32_t **)malloc(2*sizeof(int32_t*));
ue->sl_rxdata_7_5kHz[th_id] = (int16_t **)malloc(2*sizeof(int32_t*));
ue->sl_rxdataF[th_id] = (int16_t **)malloc(2*sizeof(int32_t*));
for (int aa=0;aa<ue->frame_parms.nb_antennas_rx;aa++) {
ue->sl_rxdataF[th_id][aa] = (int16_t*)malloc16_clear(ue->frame_parms.ofdm_symbol_size*14*sizeof(int32_t));
ue->sl_rxdata_7_5kHz[th_id][aa] = (int16_t*)malloc16_clear(ue->frame_parms.samples_per_tti*sizeof(int32_t));
ue->pusch_sldch[th_id]->rxdataF_ext[aa] = (int32_t*)malloc16_clear(ue->frame_parms.N_RB_DL*12*14*sizeof(int32_t));
ue->pusch_sldch[th_id]->drs_ch_estimates[aa] = (int32_t*)malloc16_clear(ue->frame_parms.N_RB_DL*12*14*sizeof(int32_t));
ue->pusch_sldch[th_id]->rxdataF_comp[aa] = (int32_t*)malloc16_clear(ue->frame_parms.N_RB_DL*12*14*sizeof(int32_t));
ue->pusch_sldch[th_id]->ul_ch_mag[aa] = (int32_t*)malloc16_clear(ue->frame_parms.N_RB_DL*12*14*sizeof(int32_t));
}
ue->sldch_dlsch_llr[th_id] = (int16_t *)malloc(2*2*12*1200*sizeof(int16_t*));
ue->sldch_ulsch_llr[th_id] = (int16_t *)malloc(2*2*12*1200*sizeof(int16_t*));
}
ue->pusch_slbch = (LTE_eNB_PUSCH*)malloc(sizeof(LTE_eNB_PUSCH));
ue->pusch_slbch->rxdataF_ext = (int32_t **)malloc(2*sizeof(int32_t*));
......@@ -977,12 +992,8 @@ int init_lte_ue_signal(PHY_VARS_UE *ue,
ue->pusch_slbch->rxdataF_comp = (int32_t **)malloc(2*sizeof(int32_t*));
ue->pusch_slbch->ul_ch_mag = (int32_t **)malloc(2*sizeof(int32_t*));
ue->sl_rxdata_7_5kHz = (int16_t **)malloc(2*sizeof(int32_t*));
ue->sl_rxdataF = (int16_t **)malloc(2*sizeof(int32_t*));
for (int aa=0;aa<ue->frame_parms.nb_antennas_rx;aa++) {
ue->sl_rxdataF[aa] = (int16_t*)malloc16_clear(ue->frame_parms.ofdm_symbol_size*14*sizeof(int32_t));
ue->sl_rxdata_7_5kHz[aa] = (int16_t*)malloc16_clear(ue->frame_parms.samples_per_tti*sizeof(int32_t));
ue->pusch_slcch->rxdataF_ext[aa] = (int32_t*)malloc16_clear(ue->frame_parms.N_RB_DL*12*14*sizeof(int32_t));
ue->pusch_slcch->drs_ch_estimates[aa] = (int32_t*)malloc16_clear(ue->frame_parms.N_RB_DL*12*14*sizeof(int32_t));
......@@ -992,10 +1003,6 @@ int init_lte_ue_signal(PHY_VARS_UE *ue,
ue->pusch_slsch->drs_ch_estimates[aa] = (int32_t*)malloc16_clear(ue->frame_parms.N_RB_DL*12*14*sizeof(int32_t));
ue->pusch_slsch->rxdataF_comp[aa] = (int32_t*)malloc16_clear(ue->frame_parms.N_RB_DL*12*14*sizeof(int32_t));
ue->pusch_slsch->ul_ch_mag[aa] = (int32_t*)malloc16_clear(ue->frame_parms.N_RB_DL*12*14*sizeof(int32_t));
ue->pusch_sldch->rxdataF_ext[aa] = (int32_t*)malloc16_clear(ue->frame_parms.N_RB_DL*12*14*sizeof(int32_t));
ue->pusch_sldch->drs_ch_estimates[aa] = (int32_t*)malloc16_clear(ue->frame_parms.N_RB_DL*12*14*sizeof(int32_t));
ue->pusch_sldch->rxdataF_comp[aa] = (int32_t*)malloc16_clear(ue->frame_parms.N_RB_DL*12*14*sizeof(int32_t));
ue->pusch_sldch->ul_ch_mag[aa] = (int32_t*)malloc16_clear(ue->frame_parms.N_RB_DL*12*14*sizeof(int32_t));
ue->pusch_slbch->rxdataF_ext[aa] = (int32_t*)malloc16_clear(ue->frame_parms.N_RB_DL*12*14*sizeof(int32_t));
ue->pusch_slbch->drs_ch_estimates[aa] = (int32_t*)malloc16_clear(ue->frame_parms.N_RB_DL*12*14*sizeof(int32_t));
ue->pusch_slbch->rxdataF_comp[aa] = (int32_t*)malloc16_clear(ue->frame_parms.N_RB_DL*12*14*sizeof(int32_t));
......@@ -1003,8 +1010,6 @@ int init_lte_ue_signal(PHY_VARS_UE *ue,
}
ue->slsch_dlsch_llr = (int16_t *)malloc(2*6*12*1200*sizeof(int16_t*));
ue->slsch_ulsch_llr = (int16_t *)malloc(2*6*12*1200*sizeof(int16_t*));
ue->sldch_dlsch_llr = (int16_t *)malloc(2*2*12*1200*sizeof(int16_t*));
ue->sldch_ulsch_llr = (int16_t *)malloc(2*2*12*1200*sizeof(int16_t*));
......@@ -1297,10 +1302,14 @@ void free_ue_resources(PHY_VARS_UE *ue) {
free(ue->pusch_slsch->drs_ch_estimates[aa]);
free(ue->pusch_slsch->rxdataF_comp[aa]);
free(ue->pusch_slsch->ul_ch_mag[aa]);
free(ue->pusch_sldch->rxdataF_ext[aa]);
free(ue->pusch_sldch->drs_ch_estimates[aa]);
free(ue->pusch_sldch->rxdataF_comp[aa]);
free(ue->pusch_sldch->ul_ch_mag[aa]);
for (int th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
free(ue->sl_rxdataF[th_id][aa]);
free(ue->sl_rxdata_7_5kHz[th_id][aa]);
free(ue->pusch_sldch[th_id]->rxdataF_ext[aa]);
free(ue->pusch_sldch[th_id]->drs_ch_estimates[aa]);
free(ue->pusch_sldch[th_id]->rxdataF_comp[aa]);
free(ue->pusch_sldch[th_id]->ul_ch_mag[aa]);
}
}
}
if (ue->sidelink_active == 1) {
......@@ -1314,13 +1323,15 @@ void free_ue_resources(PHY_VARS_UE *ue) {
free(ue->pusch_slsch->drs_ch_estimates);
free(ue->pusch_slsch->rxdataF_comp);
free(ue->pusch_slsch->ul_ch_mag);
free(ue->pusch_sldch->rxdataF_ext);
free(ue->pusch_sldch->drs_ch_estimates);
free(ue->pusch_sldch->rxdataF_comp);
free(ue->pusch_sldch->ul_ch_mag);
for (int th_id=0; th_id<RX_NB_TH_MAX; th_id++) {
free(ue->pusch_sldch[th_id]->rxdataF_ext);
free(ue->pusch_sldch[th_id]->drs_ch_estimates);
free(ue->pusch_sldch[th_id]->rxdataF_comp);
free(ue->pusch_sldch[th_id]->ul_ch_mag);
free(ue->sldch_dlsch_llr[th_id]);
free(ue->sldch_ulsch_llr[th_id]);
}
free(ue->slsch_dlsch_llr);
free(ue->slsch_ulsch_llr);
free(ue->sldch_dlsch_llr);
free(ue->sldch_ulsch_llr);
}
}
......@@ -132,11 +132,11 @@ int generate_slbch(int32_t **txdataF,
int rx_psbch(PHY_VARS_UE *ue,int frame_rx,int subframe_rx) {
int16_t **rxdataF = ue->sl_rxdataF;
int16_t **rxdataF = ue->sl_rxdataF[ue->current_thread_id[subframe_rx]];
int16_t **rxdataF_ext = ue->pusch_slbch->rxdataF_ext;
int16_t **drs_ch_estimates = ue->pusch_sldch->drs_ch_estimates;
int16_t **rxdataF_comp = ue->pusch_sldch->rxdataF_comp;
int16_t **ul_ch_mag = ue->pusch_sldch->ul_ch_mag;
int16_t **drs_ch_estimates = ue->pusch_slbch->drs_ch_estimates;
int16_t **rxdataF_comp = ue->pusch_slbch->rxdataF_comp;
int16_t **ul_ch_mag = ue->pusch_slbch->ul_ch_mag;
int32_t avgs;
uint8_t log2_maxh=0;
int32_t avgU[2];
......
......@@ -34,17 +34,17 @@
#include "PHY/defs.h"
#include "PHY/LTE_TRANSPORT/proto.h"
//#define PSDCH_DEBUG 1
#define PSDCH_DEBUG 1
void sldch_decoding(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,int frame_rx,int subframe_rx,int npsdch,int nprb,int rvidx) {
int Nsymb = 7;
int16_t **rxdataF_ext = (int16_t**)ue->pusch_sldch->rxdataF_ext;
int16_t **drs_ch_estimates = (int16_t**)ue->pusch_sldch->drs_ch_estimates;
int16_t **rxdataF_comp = (int16_t**)ue->pusch_sldch->rxdataF_comp;
int16_t **ul_ch_mag = (int16_t**)ue->pusch_sldch->ul_ch_mag;
int16_t **rxdata_7_5kHz = (int16_t**)ue->sl_rxdata_7_5kHz;
int16_t **rxdataF = (int16_t**)ue->sl_rxdataF;
int16_t **rxdataF_ext = (int16_t**)ue->pusch_sldch[ue->current_thread_id[subframe_rx]]->rxdataF_ext;
int16_t **drs_ch_estimates = (int16_t**)ue->pusch_sldch[ue->current_thread_id[subframe_rx]]->drs_ch_estimates;
int16_t **rxdataF_comp = (int16_t**)ue->pusch_sldch[ue->current_thread_id[subframe_rx]]->rxdataF_comp;
int16_t **ul_ch_mag = (int16_t**)ue->pusch_sldch[ue->current_thread_id[subframe_rx]]->ul_ch_mag;
int16_t **rxdata_7_5kHz = (int16_t**)ue->sl_rxdata_7_5kHz[ue->current_thread_id[subframe_rx]];
int16_t **rxdataF = (int16_t**)ue->sl_rxdataF[ue->current_thread_id[subframe_rx]];
int32_t avgs;
uint8_t log2_maxh=0;
int32_t avgU[2];
......@@ -75,7 +75,7 @@ void sldch_decoding(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,int frame_rx,int subfra
slot_fep_ul(&ru_tmp,l,(subframe_rx<<1)+1,0);
}
}
LOG_I(PHY,"sldch_decoding: FEP for npsdch %d rvidx %d rx signal energy %d dB %d dB\n",npsdch,rvidx,
LOG_I(PHY,"sldch_decoding: FEP in %d.%d for npsdch %d rvidx %d rx signal energy %d dB %d dB\n",frame_rx,subframe_rx,npsdch,rvidx,
dB_fixed(signal_energy(&ue->common_vars.rxdata[0][ue->frame_parms.samples_per_tti*subframe_rx],ue->frame_parms.samples_per_tti)),
dB_fixed(signal_energy(ue->sl_rxdata_7_5kHz[0],ue->frame_parms.samples_per_tti)));
......@@ -204,7 +204,7 @@ void sldch_decoding(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,int frame_rx,int subfra
int E = 12*2*2*((Nsymb-1)<<1);
int16_t *llrp = ue->sldch_ulsch_llr;
int16_t *llrp = ue->sldch_ulsch_llr[ue->current_thread_id[subframe_rx]];
for (int l=0; l<(Nsymb<<1)-1; l++) {
......@@ -215,13 +215,13 @@ void sldch_decoding(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,int frame_rx,int subfra
ulsch_qpsk_llr(&ue->frame_parms,
(int32_t **)rxdataF_comp,
(int16_t *)ue->sldch_ulsch_llr,
(int16_t *)ue->sldch_ulsch_llr[ue->current_thread_id[subframe_rx]],
l,
2,
&llrp);
}
#ifdef PSDCH_DEBUG
write_output("sldch_llr.m","sldchllr",ue->sldch_ulsch_llr,
write_output("sldch_llr.m","sldchllr",ue->sldch_ulsch_llr[ue->current_thread_id[subframe_rx]],
12*2*(ue->frame_parms.symbols_per_tti),
1,0);
#endif
......@@ -239,7 +239,7 @@ void sldch_decoding(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,int frame_rx,int subfra
for (int i=0; i<(1+(E>>5)); i++) {
for (int j=0; j<32; j++,k++) {
c = (int16_t)((((s>>j)&1)<<1)-1);
ue->sldch_ulsch_llr[k] = c*ue->sldch_ulsch_llr[k];
ue->sldch_ulsch_llr[ue->current_thread_id[subframe_rx]][k] = c*ue->sldch_ulsch_llr[ue->current_thread_id[subframe_rx]][k];
}
s = lte_gold_generic(&x1, &x2, 0);
}
......@@ -249,8 +249,8 @@ void sldch_decoding(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,int frame_rx,int subfra
int Cmux = (Nsymb-1)*2;
for (int i=0,j=0;i<Cmux;i++) {
for (int r=0;r<24;r++) {
ue->sldch_dlsch_llr[((r*Cmux)+i)<<1] = ue->sldch_ulsch_llr[j++];
ue->sldch_dlsch_llr[(((r*Cmux)+i)<<1)+1] = ue->sldch_ulsch_llr[j++];
ue->sldch_dlsch_llr[ue->current_thread_id[subframe_rx]][((r*Cmux)+i)<<1] = ue->sldch_ulsch_llr[ue->current_thread_id[subframe_rx]][j++];
ue->sldch_dlsch_llr[ue->current_thread_id[subframe_rx]][(((r*Cmux)+i)<<1)+1] = ue->sldch_ulsch_llr[ue->current_thread_id[subframe_rx]][j++];
// printf("dlsch_llr[%d] %d(%d) dlsch_llr[%d] %d(%d)\n",
// ((r*Cmux)+i)<<1,ue->sldch_dlsch_llr[((r*Cmux)+i)<<1],j-2,(((r*Cmux)+i)<<1)+1,ue->sldch_dlsch_llr[(((r*Cmux)+i)<<1)+1],j-1);
}
......@@ -269,7 +269,7 @@ void sldch_decoding(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,int frame_rx,int subfra
// for (int i=0;i<E/16;i++) printf("decoding: E[%d] %d\n",i,ue->slsch_dlsch_llr[i]);
int ret = dlsch_decoding(ue,
ue->sldch_dlsch_llr,
ue->sldch_dlsch_llr[ue->current_thread_id[subframe_rx]],
&ue->frame_parms,
ue->dlsch_rx_sldch[npsdch],
ue->dlsch_rx_sldch[npsdch]->harq_processes[0],
......@@ -286,6 +286,7 @@ void sldch_decoding(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,int frame_rx,int subfra
rvidx,ret);
}
exit(-1);
}
void rx_sldch(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, int frame_rx,int subframe_rx) {
......@@ -356,8 +357,10 @@ void rx_sldch(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, int frame_rx,int subframe_rx
if (nprb<(sldch->N_SL_RB>>1)) nprb+=sldch->prb_Start;
else nprb+=(sldch->prb_End-(sldch->N_SL_RB>>1));
// call decoding for candidate npsdch
LOG_I(PHY,"SLDCH (RX): absSF_modP %d Trying npsdch %d, j %d rvidx %d (nprb %d)\n",absSF_modP,npsdch,jrx,rvtab[jrx],nprb);
sldch_decoding(ue,proc,frame_rx,subframe_rx,npsdch,nprb,rvtab[jrx]);
if (npsdch==0) {
LOG_I(PHY,"SLDCH (RX): absSF_modP %d Trying npsdch %d, j %d rvidx %d (nprb %d)\n",absSF_modP,npsdch,jrx,rvtab[jrx],nprb);
sldch_decoding(ue,proc,frame_rx,subframe_rx,npsdch,nprb,rvtab[jrx]);
}
}
}
......
......@@ -794,8 +794,8 @@ void pscch_decoding(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,int frame_rx,int subfra
int16_t **drs_ch_estimates = ue->pusch_slcch->drs_ch_estimates;
int16_t **rxdataF_comp = ue->pusch_slcch->rxdataF_comp;
int16_t **ul_ch_mag = ue->pusch_slcch->ul_ch_mag;
int16_t **rxdata_7_5kHz = ue->sl_rxdata_7_5kHz;
int16_t **rxdataF = ue->sl_rxdataF;
int16_t **rxdata_7_5kHz = ue->sl_rxdata_7_5kHz[ue->current_thread_id[subframe_rx]];
int16_t **rxdataF = ue->sl_rxdataF[ue->current_thread_id[subframe_rx]];
int32_t avgs;
uint8_t log2_maxh=0;
int32_t avgU[2];
......@@ -1133,8 +1133,8 @@ void slsch_decoding(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,int frame_rx,int subfra
int16_t **drs_ch_estimates = ue->pusch_slsch->drs_ch_estimates;
int16_t **rxdataF_comp = ue->pusch_slsch->rxdataF_comp;
int16_t **ul_ch_mag = ue->pusch_slsch->ul_ch_mag;
int16_t **rxdata_7_5kHz = ue->sl_rxdata_7_5kHz;
int16_t **rxdataF = ue->sl_rxdataF;
int16_t **rxdata_7_5kHz = ue->sl_rxdata_7_5kHz[ue->current_thread_id[subframe_rx]];
int16_t **rxdataF = ue->sl_rxdataF[ue->current_thread_id[subframe_rx]];
int32_t avgs;
uint8_t log2_maxh=0;
int32_t avgU[2];
......
......@@ -306,7 +306,7 @@ int rx_slsss(PHY_VARS_UE *ue,int32_t *tot_metric,uint8_t *phase_max,int Nid2)
LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
int32_t metric;
int16_t *d0,*d5;
int16_t **rxdataF = ue->sl_rxdataF;
int16_t **rxdataF = ue->sl_rxdataF[ue->current_thread_id[0]];
if (frame_parms->frame_type == FDD) {
#ifdef DEBUG_SSS
......@@ -329,7 +329,7 @@ int rx_slsss(PHY_VARS_UE *ue,int32_t *tot_metric,uint8_t *phase_max,int Nid2)
ru_tmp.common.rxdata_7_5kHz = (int32_t**)malloc16(ue->frame_parms.nb_antennas_rx*sizeof(int32_t*));
ru_tmp.common.rxdata = (int32_t**)malloc16(ue->frame_parms.nb_antennas_rx*sizeof(int32_t*));
for (int aa=0;aa<ue->frame_parms.nb_antennas_rx;aa++) {
ru_tmp.common.rxdata_7_5kHz[aa] = (int32_t*)ue->sl_rxdata_7_5kHz[aa];
ru_tmp.common.rxdata_7_5kHz[aa] = (int32_t*)ue->sl_rxdata_7_5kHz[ue->current_thread_id[0]][aa];
ru_tmp.common.rxdata[aa] = (int32_t*)&ue->common_vars.rxdata_syncSL[aa][2*ue->rx_offsetSL];
}
ru_tmp.common.rxdataF = (int32_t**)rxdataF;
......
......@@ -1307,7 +1307,7 @@ typedef struct {
LTE_eNB_PUSCH *pusch_slsch;
LTE_eNB_DLSCH_t *dlsch_sldch;
LTE_UE_ULSCH_t *ulsch_sldch;
LTE_eNB_PUSCH *pusch_sldch;
LTE_eNB_PUSCH *pusch_sldch[RX_NB_TH_MAX];
LTE_eNB_PUSCH *pusch_slbch;
LTE_eNB_PUSCH *pusch_slcch;
LTE_UE_DLSCH_t *dlsch_rx_slsch;
......@@ -1316,8 +1316,8 @@ typedef struct {
int16_t **sl_rxdata_7_5kHz;
int16_t *slsch_dlsch_llr;
int16_t *slsch_ulsch_llr;
int16_t *sldch_dlsch_llr;
int16_t *sldch_ulsch_llr;
int16_t *sldch_dlsch_llr[RX_NB_TH_MAX];
int16_t *sldch_ulsch_llr[RX_NB_TH_MAX];
SLSS_t *slss;
SLSS_t slss_rx;
SLSCH_t *slsch;
......
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