Commit c04699c4 authored by Sakthivel Velumani's avatar Sakthivel Velumani

dlsim encoding speed improved

parent 3ec56603
......@@ -2981,6 +2981,7 @@ target_link_libraries(nr_pucchsim
add_executable(nr_dlsim
${OPENAIR1_DIR}/SIMULATION/NR_PHY/dlsim.c
${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c
......
......@@ -531,7 +531,6 @@ void init_nr_transport(PHY_VARS_gNB *gNB) {
for (j=0; j<2; j++) {
gNB->dlsch[i][j] = new_gNB_dlsch(fp,1,16,NSOFT,0,grid_size);
gNB->dlsch[i][j]->threadPool = gNB->threadPool;
AssertFatal(gNB->dlsch[i][j]!=NULL,"Can't initialize dlsch %d \n", i);
}
}
......
......@@ -109,7 +109,8 @@ void nr_pdsch_codeword_scrambling_optim(uint8_t *in,
}
uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t *dlsch,
uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
NR_gNB_DLSCH_t *dlsch,
uint32_t ***pdsch_dmrs,
int32_t** txdataF,
int16_t amp,
......@@ -155,14 +156,14 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t *dlsch,
/// CRC, coding, interleaving and rate matching
AssertFatal(harq->pdu!=NULL,"harq->pdu is null\n");
start_meas(dlsch_encoding_stats);
nr_dlsch_encoding(harq->pdu, frame, slot, dlsch, frame_parms,tinput,tprep,tparity,toutput,
nr_dlsch_encoding(gNB, harq->pdu, frame, slot, dlsch, frame_parms,tinput,tprep,tparity,toutput,
dlsch_rate_matching_stats,
dlsch_interleaving_stats,
dlsch_segmentation_stats);
stop_meas(dlsch_encoding_stats);
while (dlsch->nbEncode > 0) {
notifiedFIFO_elt_t *req=pullTpool(&dlsch->respEncode, dlsch->threadPool);
dlsch->nbEncode--;
while (gNB->nbEncode > 0) {
notifiedFIFO_elt_t *req=pullTpool(gNB->respEncode, gNB->threadPool);
gNB->nbEncode--;
delNotifiedFIFO_elt(req);
}
#ifdef DEBUG_DLSCH
......
......@@ -69,7 +69,8 @@ void nr_fill_dlsch(PHY_VARS_gNB *gNB,
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
unsigned char *sdu);
uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t *dlsch,
uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
NR_gNB_DLSCH_t *dlsch,
uint32_t ***pdsch_dmrs,
int32_t** txdataF,
int16_t amp,
......@@ -98,7 +99,7 @@ void clean_gNB_ulsch(NR_gNB_ULSCH_t *ulsch);
int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type);
int nr_dlsch_encoding(unsigned char *a,int frame,
int nr_dlsch_encoding(PHY_VARS_gNB *gNB, unsigned char *a,int frame,
uint8_t slot,
NR_gNB_DLSCH_t *dlsch,
NR_DL_FRAME_PARMS* frame_parms,
......
......@@ -330,7 +330,6 @@ int nr_processDLSegment(void* args) {
int j = impp.macro_num;
int E;
int r;
int Nl = 4;
nrLDPC_encoder(dlsch_harq->c,dlsch_harq->d,Z,Kb,Kr,BG,&impp);
......@@ -360,10 +359,6 @@ int nr_processDLSegment(void* args) {
Kr-F-2*(Z),
mod_order);
// for tbslbrm calculation according to 5.4.2.1 of 38.212
if (nrOfLayers < Nl)
Nl = nrOfLayers;
nr_rate_matching_ldpc(Ilbrm,
Tbslbrm,
BG,
......@@ -393,14 +388,15 @@ int nr_processDLSegment(void* args) {
write_output("enc_output.m","enc",dlsch_harq->f,G,1,4);
#endif
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
r_offset += E;
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
}
int nr_dlsch_encoding(unsigned char *a,
int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
unsigned char *a,
int frame,
uint8_t slot,
NR_gNB_DLSCH_t *dlsch,
......@@ -516,15 +512,20 @@ int nr_dlsch_encoding(unsigned char *a,
F = dlsch->harq_processes[harq_pid]->F;
Kr = dlsch->harq_processes[harq_pid]->K;
if (rel15->nrOfLayers < Nl)
Nl = rel15->nrOfLayers;
Tbslbrm = nr_compute_tbslbrm(rel15->mcsTable[0],nb_rb,Nl,dlsch->harq_processes[harq_pid]->C);
#ifdef DEBUG_DLSCH_CODING
uint16_t Kr_bytes;
Kr_bytes = Kr>>3;
#endif
dlsch->nbEncode = 0;
gNB->nbEncode = 0;
//printf("segment Z %d k %d Kr %d BG %d C %d\n", *Zc,dlsch->harq_processes[harq_pid]->K,Kr,BG,dlsch->harq_processes[harq_pid]->C);
for(int j=0;j<(dlsch->harq_processes[harq_pid]->C/8+1);j++) {
notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(ldpcDecode_t), 0, &dlsch->respEncode, nr_processDLSegment);
notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(ldpcEncode_t), 0, gNB->respEncode, nr_processDLSegment);
ldpcEncode_t *rdata = (ldpcEncode_t *) NotifiedFifoData(req);
rdata->impp.n_segments=dlsch->harq_processes[harq_pid]->C;
......@@ -544,17 +545,16 @@ int nr_dlsch_encoding(unsigned char *a,
rdata->mod_order = mod_order;
rdata->nrOfLayers = rel15->nrOfLayers;
rdata->Kb = Kb;
rdata->G = G;
for (int cj=0; cj<j*8; cj++) {
r_offset += nr_get_E(G, dlsch->harq_processes[harq_pid]->C, mod_order, rel15->nrOfLayers, r);
}
rdata->r_offset = r_offset;
pushTpool(dlsch->threadPool,req);
dlsch->nbEncode++;
LOG_D(PHY,"Added a block to encode, in pipe: %d\n",dlsch->nbEncode);
pushTpool(gNB->threadPool,req);
gNB->nbEncode++;
LOG_D(PHY,"Added a block to encode, in pipe: %d\n",gNB->nbEncode);
}
return;
} else {
F = dlsch->harq_processes[harq_pid]->F;
......@@ -625,6 +625,7 @@ int nr_dlsch_encoding(unsigned char *a,
r_offset += E;
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
}
return 0;
......
......@@ -167,12 +167,6 @@ typedef struct {
int16_t sqrt_rho_a;
/// amplitude of PDSCH (compared to RS) in symbols containing pilots
int16_t sqrt_rho_b;
/// for maintaining multi threads for encoding
tpool_t *threadPool;
/// number of encoding threads
int nbEncode;
/// fifo to store the thread result
notifiedFIFO_t respEncode;
} NR_gNB_DLSCH_t;
typedef struct {
......@@ -810,8 +804,10 @@ typedef struct PHY_VARS_gNB_s {
time_stats_t ulsch_freq_offset_estimation_stats;
*/
notifiedFIFO_t *respDecode;
notifiedFIFO_t *respEncode;
tpool_t *threadPool;
int nbDecode;
int nbEncode;
} PHY_VARS_gNB;
......
......@@ -194,7 +194,8 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
for (int i=0; i<gNB->num_pdsch_rnti[slot]; i++) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GENERATE_DLSCH,1);
LOG_D(PHY, "PDSCH generation started (%d) in frame %d.%d\n", gNB->num_pdsch_rnti[slot],frame,slot);
nr_generate_pdsch(gNB->dlsch[i][0],
nr_generate_pdsch(gNB,
gNB->dlsch[i][0],
gNB->nr_gold_pdsch_dmrs[slot],
gNB->common_vars.txdataF,
AMP, frame, slot, fp, 0,
......
......@@ -502,7 +502,7 @@ int main(int argc, char **argv)
//printf("crc32: [0]->0x%08x\n",crc24c(test_input, 32));
// generate signal
if (input_fd == NULL) {
nr_dlsch_encoding(test_input, frame, slot, dlsch, frame_parms,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
nr_dlsch_encoding(gNB, test_input, frame, slot, dlsch, frame_parms,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
}
for (SNR = snr0; SNR < snr1; SNR += snr_step) {
......
......@@ -467,6 +467,11 @@ int main(int argc, char **argv)
gNB_RRC_INST rrc;
memset((void*)&rrc,0,sizeof(rrc));
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
gNB->respEncode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
char tp_param[] = "-1,-1,-1";
initTpool(tp_param, gNB->threadPool, true);
initNotifiedFIFO(gNB->respEncode);
/*
// read in SCGroupConfig
AssertFatal(scg_fd != NULL,"no reconfig.raw file\n");
......
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