Commit ce7ec91e authored by Sakthivel Velumani's avatar Sakthivel Velumani

Merge branch 'ulsch_decode_mthread' into load_gnb

parents 16110ae0 db501192
...@@ -2792,6 +2792,7 @@ add_executable(nr-softmodem ...@@ -2792,6 +2792,7 @@ add_executable(nr-softmodem
${s1ap_h} ${s1ap_h}
# ${OPENAIR_BIN_DIR}/messages_xml.h # ${OPENAIR_BIN_DIR}/messages_xml.h
${OPENAIR_DIR}/executables/nr-gnb.c ${OPENAIR_DIR}/executables/nr-gnb.c
${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
${OPENAIR_DIR}/executables/nr-ru.c ${OPENAIR_DIR}/executables/nr-ru.c
${OPENAIR_DIR}/executables/nr-softmodem.c ${OPENAIR_DIR}/executables/nr-softmodem.c
${OPENAIR_DIR}/executables/softmodem-common.c ${OPENAIR_DIR}/executables/softmodem-common.c
...@@ -3047,6 +3048,7 @@ target_link_libraries(nr_prachsim ...@@ -3047,6 +3048,7 @@ target_link_libraries(nr_prachsim
add_executable(nr_ulschsim add_executable(nr_ulschsim
${OPENAIR1_DIR}/SIMULATION/NR_PHY/ulschsim.c ${OPENAIR1_DIR}/SIMULATION/NR_PHY/ulschsim.c
${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c ${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c ${OPENAIR_DIR}/common/utils/nr/nr_common.c
...@@ -3061,6 +3063,7 @@ target_link_libraries(nr_ulschsim ...@@ -3061,6 +3063,7 @@ target_link_libraries(nr_ulschsim
add_executable(nr_ulsim add_executable(nr_ulsim
${OPENAIR1_DIR}/SIMULATION/NR_PHY/ulsim.c ${OPENAIR1_DIR}/SIMULATION/NR_PHY/ulsim.c
${OPENAIR_DIR}/common/utils/threadPool/thread-pool.c
${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/utils.c
${OPENAIR_DIR}/common/utils/system.c ${OPENAIR_DIR}/common/utils/system.c
${OPENAIR_DIR}/common/utils/nr/nr_common.c ${OPENAIR_DIR}/common/utils/nr/nr_common.c
......
...@@ -793,6 +793,12 @@ void init_gNB_proc(int inst) { ...@@ -793,6 +793,12 @@ void init_gNB_proc(int inst) {
pthread_mutex_init(&sync_phy_proc.mutex_phy_proc_tx, NULL); pthread_mutex_init(&sync_phy_proc.mutex_phy_proc_tx, NULL);
pthread_cond_init(&sync_phy_proc.cond_phy_proc_tx, NULL); pthread_cond_init(&sync_phy_proc.cond_phy_proc_tx, NULL);
sync_phy_proc.phy_proc_CC_id = 0; sync_phy_proc.phy_proc_CC_id = 0;
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
char ul_pool[] = "-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1";
initTpool(ul_pool, gNB->threadPool, false);
initNotifiedFIFO(gNB->respDecode);
} }
......
...@@ -480,8 +480,7 @@ uint32_t nr_compute_tbs(uint16_t Qm, ...@@ -480,8 +480,7 @@ uint32_t nr_compute_tbs(uint16_t Qm,
uint32_t nr_compute_tbslbrm(uint16_t table, uint32_t nr_compute_tbslbrm(uint16_t table,
uint16_t nb_rb, uint16_t nb_rb,
uint8_t Nl, uint8_t Nl);
uint8_t C);
void nr_interleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e,uint8_t *f); void nr_interleaving_ldpc(uint32_t E, uint8_t Qm, uint8_t *e,uint8_t *f);
......
...@@ -425,7 +425,7 @@ int nr_rate_matching_ldpc(uint8_t Ilbrm, ...@@ -425,7 +425,7 @@ int nr_rate_matching_ldpc(uint8_t Ilbrm,
} }
} }
else { else {
if (E + F <= Ncb-ind) { //E+F doesn't contain all coded bits if (E <= Ncb-ind) { //E+F doesn't contain all coded bits
memcpy((void*)(e),(void*)(w+ind),E); memcpy((void*)(e),(void*)(w+ind),E);
k=E; k=E;
} }
......
...@@ -527,7 +527,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -527,7 +527,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
if (rel15->nrOfLayers < Nl) if (rel15->nrOfLayers < Nl)
Nl = rel15->nrOfLayers; Nl = rel15->nrOfLayers;
Tbslbrm = nr_compute_tbslbrm(rel15->mcsTable[0],nb_rb,Nl,dlsch->harq_processes[harq_pid]->C); Tbslbrm = nr_compute_tbslbrm(rel15->mcsTable[0],nb_rb,Nl);
start_meas(dlsch_rate_matching_stats); start_meas(dlsch_rate_matching_stats);
nr_rate_matching_ldpc(Ilbrm, nr_rate_matching_ldpc(Ilbrm,
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
*/ */
#include "PHY/defs_gNB.h" #include "PHY/defs_gNB.h"
#include "common/utils/threadPool/thread-pool.h"
void free_gNB_ulsch(NR_gNB_ULSCH_t **ulsch,uint8_t N_RB_UL); void free_gNB_ulsch(NR_gNB_ULSCH_t **ulsch,uint8_t N_RB_UL);
......
...@@ -478,9 +478,9 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -478,9 +478,9 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_RATE_MATCHING, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_RATE_MATCHING, VCD_FUNCTION_IN);
if ((harq_process->Nl)<4) if ((harq_process->Nl)<4)
Tbslbrm = nr_compute_tbslbrm(harq_process->mcs_table,nb_rb,harq_process->Nl,harq_process->C); Tbslbrm = nr_compute_tbslbrm(harq_process->mcs_table,nb_rb,harq_process->Nl);
else else
Tbslbrm = nr_compute_tbslbrm(harq_process->mcs_table,nb_rb,4,harq_process->C); Tbslbrm = nr_compute_tbslbrm(harq_process->mcs_table,nb_rb,4);
if (nr_rate_matching_ldpc_rx(Ilbrm, if (nr_rate_matching_ldpc_rx(Ilbrm,
...@@ -1069,7 +1069,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -1069,7 +1069,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
if (harq_process->Nl < Nl) if (harq_process->Nl < Nl)
Nl = harq_process->Nl; Nl = harq_process->Nl;
Tbslbrm = nr_compute_tbslbrm(harq_process->mcs_table,nb_rb,harq_process->Nl,harq_process->C); Tbslbrm = nr_compute_tbslbrm(harq_process->mcs_table,nb_rb,harq_process->Nl);
if (nr_rate_matching_ldpc_rx(Ilbrm, if (nr_rate_matching_ldpc_rx(Ilbrm,
Tbslbrm, Tbslbrm,
...@@ -1610,9 +1610,9 @@ void nr_dlsch_decoding_process(void *arg) ...@@ -1610,9 +1610,9 @@ void nr_dlsch_decoding_process(void *arg)
#endif #endif
if (Nl<4) if (Nl<4)
Tbslbrm = nr_compute_tbslbrm(harq_process->mcs_table,nb_rb,Nl,harq_process->C); Tbslbrm = nr_compute_tbslbrm(harq_process->mcs_table,nb_rb,Nl);
else else
Tbslbrm = nr_compute_tbslbrm(harq_process->mcs_table,nb_rb,4,harq_process->C); Tbslbrm = nr_compute_tbslbrm(harq_process->mcs_table,nb_rb,4);
if (nr_rate_matching_ldpc_rx(Ilbrm, if (nr_rate_matching_ldpc_rx(Ilbrm,
Tbslbrm, Tbslbrm,
......
...@@ -438,7 +438,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, ...@@ -438,7 +438,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
E = nr_get_E(G, harq_process->C, mod_order, harq_process->pusch_pdu.nrOfLayers, r); E = nr_get_E(G, harq_process->C, mod_order, harq_process->pusch_pdu.nrOfLayers, r);
Tbslbrm = nr_compute_tbslbrm(0,nb_rb,harq_process->pusch_pdu.nrOfLayers,harq_process->C); Tbslbrm = nr_compute_tbslbrm(0,nb_rb,harq_process->pusch_pdu.nrOfLayers);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RATE_MATCHING_LDPC, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RATE_MATCHING_LDPC, VCD_FUNCTION_IN);
nr_rate_matching_ldpc(Ilbrm, nr_rate_matching_ldpc(Ilbrm,
......
...@@ -263,6 +263,8 @@ typedef struct { ...@@ -263,6 +263,8 @@ typedef struct {
int16_t e[MAX_NUM_NR_DLSCH_SEGMENTS][3*8448]; int16_t e[MAX_NUM_NR_DLSCH_SEGMENTS][3*8448];
/// Number of bits in each code block after rate matching for LDPC code (38.212 V15.4.0 section 5.4.2.1) /// Number of bits in each code block after rate matching for LDPC code (38.212 V15.4.0 section 5.4.2.1)
uint32_t E; uint32_t E;
/// Number of segments processed so far
uint32_t processedSegments;
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
...@@ -475,7 +477,6 @@ typedef struct { ...@@ -475,7 +477,6 @@ typedef struct {
uint8_t cl_done; uint8_t cl_done;
} NR_gNB_PUSCH; } NR_gNB_PUSCH;
/// Context data structure for RX/TX portion of slot processing /// Context data structure for RX/TX portion of slot processing
typedef struct { typedef struct {
/// Component Carrier index /// Component Carrier index
...@@ -822,7 +823,45 @@ typedef struct PHY_VARS_gNB_s { ...@@ -822,7 +823,45 @@ typedef struct PHY_VARS_gNB_s {
time_stats_t rx_dft_stats; time_stats_t rx_dft_stats;
time_stats_t ulsch_freq_offset_estimation_stats; time_stats_t ulsch_freq_offset_estimation_stats;
*/ */
notifiedFIFO_t *respDecode;
tpool_t *threadPool;
int nbDecode;
} PHY_VARS_gNB; } PHY_VARS_gNB;
typedef struct LDPCDecode_s {
PHY_VARS_gNB *gNB;
NR_UL_gNB_HARQ_t *ulsch_harq;
t_nrLDPC_dec_params decoderParms;
NR_gNB_ULSCH_t *ulsch;
short* ulsch_llr;
int ulsch_id;
int harq_pid;
int rv_index;
int A;
int E;
int Kc;
int Qm;
int Kr_bytes;
int nbSegments;
int segment_r;
int r_offset;
int offset;
int Tbslbrm;
int decodeIterations;
} ldpcDecode_t;
struct ldpcReqId {
uint16_t rnti;
uint16_t frame;
uint8_t subframe;
uint8_t codeblock;
uint16_t spare;
} __attribute__((packed));
union ldpcReqUnion {
struct ldpcReqId s;
uint64_t p;
};
#endif #endif
...@@ -213,6 +213,69 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, ...@@ -213,6 +213,69 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
*/ */
void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) {
ldpcDecode_t *rdata = (ldpcDecode_t*) NotifiedFifoData(req);
NR_UL_gNB_HARQ_t *ulsch_harq = rdata->ulsch_harq;
NR_gNB_ULSCH_t *ulsch = rdata->ulsch;
int r = rdata->segment_r;
bool decodeSuccess = (rdata->decodeIterations <= rdata->decoderParms.numMaxIter);
ulsch_harq->processedSegments++;
LOG_D(PHY, "processing result of segment: %d, processed %d/%d\n",
rdata->segment_r, ulsch_harq->processedSegments, rdata->nbSegments);
gNB->nbDecode--;
LOG_D(PHY,"remain to decoded in subframe: %d\n", gNB->nbDecode);
if (decodeSuccess) {
memcpy(ulsch_harq->b+rdata->offset,
ulsch_harq->c[r],
rdata->Kr_bytes- - (ulsch_harq->F>>3) -((ulsch_harq->C>1)?3:0));
} else {
if ( rdata->nbSegments != ulsch_harq->processedSegments ) {
int nb=abortTpool(gNB->threadPool, req->key);
nb+=abortNotifiedFIFO(gNB->respDecode, req->key);
gNB->nbDecode-=nb;
LOG_D(PHY,"uplink segment error %d/%d, aborted %d segments\n",rdata->segment_r,rdata->nbSegments, nb);
LOG_D(PHY, "ULSCH %d in error\n",rdata->ulsch_id);
AssertFatal(ulsch_harq->processedSegments+nb == rdata->nbSegments,"processed: %d, aborted: %d, total %d\n",
ulsch_harq->processedSegments, nb, rdata->nbSegments);
ulsch_harq->processedSegments=rdata->nbSegments;
}
}
// if all segments are done
if (rdata->nbSegments == ulsch_harq->processedSegments) {
if (decodeSuccess) {
LOG_D(PHY,"[gNB %d] ULSCH: Setting ACK for nr_tti_rx %d TBS %d\n",
gNB->Mod_id,ulsch_harq->slot,ulsch_harq->TBS);
ulsch_harq->status = SCH_IDLE;
ulsch_harq->round = 0;
ulsch->harq_mask &= ~(1 << rdata->harq_pid);
LOG_D(PHY, "ULSCH received ok \n");
nr_fill_indication(gNB,ulsch_harq->frame, ulsch_harq->slot, rdata->ulsch_id, rdata->harq_pid, 0);
} else {
LOG_D(PHY,"[gNB %d] ULSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d) r %d\n",
gNB->Mod_id, ulsch_harq->frame, ulsch_harq->slot,
rdata->harq_pid,ulsch_harq->status, ulsch_harq->round,ulsch_harq->TBS,r);
if (ulsch_harq->round >= ulsch->Mlimit) {
ulsch_harq->status = SCH_IDLE;
ulsch_harq->round = 0;
ulsch_harq->handled = 0;
ulsch->harq_mask &= ~(1 << rdata->harq_pid);
}
ulsch_harq->handled = 1;
LOG_D(PHY, "ULSCH %d in error\n",rdata->ulsch_id);
nr_fill_indication(gNB,ulsch_harq->frame, ulsch_harq->slot, rdata->ulsch_id, rdata->harq_pid, 1);
}
ulsch->last_iteration_cnt = rdata->decodeIterations;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_ULSCH_DECODING,0);
}
}
void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH_id, uint8_t harq_pid) void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH_id, uint8_t harq_pid)
{ {
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
...@@ -270,25 +333,22 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH ...@@ -270,25 +333,22 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
//---------------------------------------------------------- //----------------------------------------------------------
start_meas(&gNB->ulsch_decoding_stats); start_meas(&gNB->ulsch_decoding_stats);
ret = nr_ulsch_decoding(gNB, nr_ulsch_decoding(gNB,
ULSCH_id, ULSCH_id,
gNB->pusch_vars[ULSCH_id]->llr, gNB->pusch_vars[ULSCH_id]->llr,
frame_parms, frame_parms,
pusch_pdu, pusch_pdu,
frame_rx, frame_rx,
slot_rx, slot_rx,
harq_pid, harq_pid,
G); G);
stop_meas(&gNB->ulsch_decoding_stats);
while (gNB->nbDecode > 0) {
if (ret > gNB->ulsch[ULSCH_id][0]->max_ldpc_iterations){ notifiedFIFO_elt_t *req=pullTpool(gNB->respDecode, gNB->threadPool);
LOG_D(PHY, "ULSCH %d in error\n",ULSCH_id); nr_postDecode(gNB, req);
nr_fill_indication(gNB,frame_rx, slot_rx, ULSCH_id, harq_pid, 1); delNotifiedFIFO_elt(req);
}
else if(gNB->ulsch[ULSCH_id][0]->harq_processes[harq_pid]->b!=NULL){
LOG_D(PHY, "ULSCH received ok \n");
nr_fill_indication(gNB,frame_rx, slot_rx, ULSCH_id, harq_pid, 0);
} }
stop_meas(&gNB->ulsch_decoding_stats);
} }
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include "openair1/SIMULATION/RF/rf.h" #include "openair1/SIMULATION/RF/rf.h"
#include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h" #include "openair1/SIMULATION/NR_PHY/nr_unitary_defs.h"
#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c" #include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
#include "common/utils/threadPool/thread-pool.h"
//#define DEBUG_NR_ULSCHSIM //#define DEBUG_NR_ULSCHSIM
...@@ -67,6 +68,43 @@ PHY_VARS_NR_UE *PHY_vars_UE_g[1][1] = { { NULL } }; ...@@ -67,6 +68,43 @@ PHY_VARS_NR_UE *PHY_vars_UE_g[1][1] = { { NULL } };
uint16_t n_rnti = 0x1234; uint16_t n_rnti = 0x1234;
openair0_config_t openair0_cfg[MAX_CARDS]; openair0_config_t openair0_cfg[MAX_CARDS];
int nr_postDecode_sim(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) {
ldpcDecode_t *rdata = (ldpcDecode_t*) NotifiedFifoData(req);
NR_UL_gNB_HARQ_t *ulsch_harq = rdata->ulsch_harq;
NR_gNB_ULSCH_t *ulsch = rdata->ulsch;
int r = rdata->segment_r;
bool decodeSuccess = (rdata->decodeIterations <= rdata->decoderParms.numMaxIter);
ulsch_harq->processedSegments++;
gNB->nbDecode--;
if (decodeSuccess) {
memcpy(ulsch_harq->b+rdata->offset,
ulsch_harq->c[r],
rdata->Kr_bytes- - (ulsch_harq->F>>3) -((ulsch_harq->C>1)?3:0));
} else {
if ( rdata->nbSegments != ulsch_harq->processedSegments ) {
int nb=abortTpool(gNB->threadPool, req->key);
nb+=abortNotifiedFIFO(gNB->respDecode, req->key);
gNB->nbDecode-=nb;
AssertFatal(ulsch_harq->processedSegments+nb == rdata->nbSegments,"processed: %d, aborted: %d, total %d\n",
ulsch_harq->processedSegments, nb, rdata->nbSegments);
ulsch_harq->processedSegments=rdata->nbSegments;
return 1;
}
}
// if all segments are done
if (rdata->nbSegments == ulsch_harq->processedSegments) {
if (decodeSuccess) {
return 0;
} else {
return 1;
}
}
ulsch->last_iteration_cnt = rdata->decodeIterations;
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
char c; char c;
...@@ -338,6 +376,11 @@ int main(int argc, char **argv) ...@@ -338,6 +376,11 @@ int main(int argc, char **argv)
gNB = RC.gNB[0]; gNB = RC.gNB[0];
//gNB_config = &gNB->gNB_config; //gNB_config = &gNB->gNB_config;
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
char tp_param[] = "n";
initTpool(tp_param, gNB->threadPool, true);
initNotifiedFIFO(gNB->respDecode);
frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH) frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
frame_parms->nb_antennas_tx = n_tx; frame_parms->nb_antennas_tx = n_tx;
frame_parms->nb_antennas_rx = n_rx; frame_parms->nb_antennas_rx = n_rx;
...@@ -531,10 +574,15 @@ int main(int argc, char **argv) ...@@ -531,10 +574,15 @@ int main(int argc, char **argv)
rel15_ul->qam_mod_order, rel15_ul->qam_mod_order,
rel15_ul->nrOfLayers); rel15_ul->nrOfLayers);
ret = nr_ulsch_decoding(gNB, UE_id, channel_output_fixed, frame_parms, rel15_ul, nr_ulsch_decoding(gNB, UE_id, channel_output_fixed, frame_parms, rel15_ul,
frame, subframe, harq_pid, G); frame, subframe, harq_pid, G);
while (gNB->nbDecode > 0) {
notifiedFIFO_elt_t *req=pullTpool(gNB->respDecode, gNB->threadPool);
ret = nr_postDecode_sim(gNB, req);
delNotifiedFIFO_elt(req);
}
if (ret > ulsch_gNB->max_ldpc_iterations) if (ret)
n_errors++; n_errors++;
//count errors //count errors
......
...@@ -55,6 +55,8 @@ ...@@ -55,6 +55,8 @@
//#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c" //#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c"
#include "openair2/LAYER2/NR_MAC_UE/mac_proto.h" #include "openair2/LAYER2/NR_MAC_UE/mac_proto.h"
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" #include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
#include "common/utils/threadPool/thread-pool.h"
#define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0)) #define inMicroS(a) (((double)(a))/(cpu_freq_GHz*1000.0))
#include "SIMULATION/LTE_PHY/common_sim.h" #include "SIMULATION/LTE_PHY/common_sim.h"
...@@ -494,6 +496,11 @@ int main(int argc, char **argv) ...@@ -494,6 +496,11 @@ int main(int argc, char **argv)
RC.gNB = (PHY_VARS_gNB **) malloc(sizeof(PHY_VARS_gNB *)); RC.gNB = (PHY_VARS_gNB **) malloc(sizeof(PHY_VARS_gNB *));
RC.gNB[0] = calloc(1,sizeof(PHY_VARS_gNB)); RC.gNB[0] = calloc(1,sizeof(PHY_VARS_gNB));
gNB = RC.gNB[0]; gNB = RC.gNB[0];
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
char tp_param[] = "n";
initTpool(tp_param, gNB->threadPool, true);
initNotifiedFIFO(gNB->respDecode);
//gNB_config = &gNB->gNB_config; //gNB_config = &gNB->gNB_config;
//memset((void *)&gNB->UL_INFO,0,sizeof(gNB->UL_INFO)); //memset((void *)&gNB->UL_INFO,0,sizeof(gNB->UL_INFO));
...@@ -764,6 +771,17 @@ int main(int argc, char **argv) ...@@ -764,6 +771,17 @@ int main(int argc, char **argv)
int n_errors[4] = {0,0,0,0};; int n_errors[4] = {0,0,0,0};;
int round_trials[4]={0,0,0,0}; int round_trials[4]={0,0,0,0};
uint32_t errors_scrambling[4] = {0,0,0,0}; uint32_t errors_scrambling[4] = {0,0,0,0};
reset_meas(&gNB->phy_proc_rx);
reset_meas(&gNB->rx_pusch_stats);
reset_meas(&gNB->ulsch_decoding_stats);
reset_meas(&gNB->ulsch_deinterleaving_stats);
reset_meas(&gNB->ulsch_rate_unmatching_stats);
reset_meas(&gNB->ulsch_ldpc_decoding_stats);
reset_meas(&gNB->ulsch_unscrambling_stats);
reset_meas(&gNB->ulsch_channel_estimation_stats);
reset_meas(&gNB->ulsch_llr_stats);
reset_meas(&gNB->ulsch_channel_compensation_stats);
reset_meas(&gNB->ulsch_rbs_extraction_stats);
clear_pusch_stats(gNB); clear_pusch_stats(gNB);
for (trial = 0; trial < n_trials; trial++) { for (trial = 0; trial < n_trials; trial++) {
...@@ -777,19 +795,6 @@ int main(int argc, char **argv) ...@@ -777,19 +795,6 @@ int main(int argc, char **argv)
ulsch_ue[0]->harq_processes[harq_pid]->round = round; ulsch_ue[0]->harq_processes[harq_pid]->round = round;
gNB->ulsch[0][0]->harq_processes[harq_pid]->round = round; gNB->ulsch[0][0]->harq_processes[harq_pid]->round = round;
rv_index = nr_rv_round_map[round]; rv_index = nr_rv_round_map[round];
reset_meas(&gNB->phy_proc_rx);
reset_meas(&gNB->rx_pusch_stats);
reset_meas(&gNB->ulsch_decoding_stats);
reset_meas(&gNB->ulsch_deinterleaving_stats);
reset_meas(&gNB->ulsch_rate_unmatching_stats);
reset_meas(&gNB->ulsch_ldpc_decoding_stats);
reset_meas(&gNB->ulsch_unscrambling_stats);
reset_meas(&gNB->ulsch_channel_estimation_stats);
reset_meas(&gNB->ulsch_ptrs_processing_stats);
reset_meas(&gNB->ulsch_llr_stats);
reset_meas(&gNB->ulsch_mrc_stats);
reset_meas(&gNB->ulsch_channel_compensation_stats);
reset_meas(&gNB->ulsch_rbs_extraction_stats);
UE_proc.nr_tti_tx = slot; UE_proc.nr_tti_tx = slot;
UE_proc.frame_tx = frame; UE_proc.frame_tx = frame;
...@@ -1123,9 +1128,9 @@ int main(int argc, char **argv) ...@@ -1123,9 +1128,9 @@ int main(int argc, char **argv)
printStatIndent2(&gNB->ulsch_llr_stats,"ULSCH llr computation"); printStatIndent2(&gNB->ulsch_llr_stats,"ULSCH llr computation");
printStatIndent(&gNB->ulsch_unscrambling_stats,"ULSCH unscrambling"); printStatIndent(&gNB->ulsch_unscrambling_stats,"ULSCH unscrambling");
printStatIndent(&gNB->ulsch_decoding_stats,"ULSCH total decoding time"); printStatIndent(&gNB->ulsch_decoding_stats,"ULSCH total decoding time");
printStatIndent2(&gNB->ulsch_deinterleaving_stats,"ULSCH deinterleaving"); //printStatIndent2(&gNB->ulsch_deinterleaving_stats,"ULSCH deinterleaving");
printStatIndent2(&gNB->ulsch_rate_unmatching_stats,"ULSCH rate matching rx"); //printStatIndent2(&gNB->ulsch_rate_unmatching_stats,"ULSCH rate matching rx");
printStatIndent2(&gNB->ulsch_ldpc_decoding_stats,"ULSCH ldpc decoding"); //printStatIndent2(&gNB->ulsch_ldpc_decoding_stats,"ULSCH ldpc decoding");
printf("\n"); printf("\n");
} }
......
...@@ -909,7 +909,7 @@ void schedule_fapi_ul_pdu(int Mod_idP, ...@@ -909,7 +909,7 @@ void schedule_fapi_ul_pdu(int Mod_idP,
if (get_softmodem_params()->phy_test==1) if (get_softmodem_params()->phy_test==1)
pusch_pdu->rb_size = 50; pusch_pdu->rb_size = 50;
else else
pusch_pdu->rb_size = 5; pusch_pdu->rb_size = pusch_pdu->bwp_size;
} }
else else
AssertFatal(1==0,"Only frequency resource allocation type 1 is currently supported\n"); AssertFatal(1==0,"Only frequency resource allocation type 1 is currently supported\n");
......
...@@ -95,8 +95,7 @@ uint32_t nr_compute_tbs(uint16_t Qm, ...@@ -95,8 +95,7 @@ uint32_t nr_compute_tbs(uint16_t Qm,
//tbslbrm calculation according to 5.4.2.1 of 38.212 //tbslbrm calculation according to 5.4.2.1 of 38.212
uint32_t nr_compute_tbslbrm(uint16_t table, uint32_t nr_compute_tbslbrm(uint16_t table,
uint16_t nb_rb, uint16_t nb_rb,
uint8_t Nl, uint8_t Nl)
uint8_t C)
{ {
uint16_t R, nb_re; uint16_t R, nb_re;
...@@ -104,7 +103,7 @@ uint32_t nr_compute_tbslbrm(uint16_t table, ...@@ -104,7 +103,7 @@ uint32_t nr_compute_tbslbrm(uint16_t table,
uint8_t Qm; uint8_t Qm;
int i; int i;
uint32_t nr_tbs=0; uint32_t nr_tbs=0;
uint32_t Ninfo, Np_info; uint32_t Ninfo, Np_info, C;
uint8_t n; uint8_t n;
for (i=0; i<7; i++) { for (i=0; i<7; i++) {
...@@ -136,10 +135,12 @@ uint32_t nr_compute_tbslbrm(uint16_t table, ...@@ -136,10 +135,12 @@ uint32_t nr_compute_tbslbrm(uint16_t table,
Np_info = max(3840, (ROUNDIDIV((Ninfo-24),(1<<n)))<<n); Np_info = max(3840, (ROUNDIDIV((Ninfo-24),(1<<n)))<<n);
if (R <= 256) { if (R <= 256) {
C = CEILIDIV((Np_info+24),3816);
nr_tbs = (C<<3)*CEILIDIV((Np_info+24),(C<<3)) - 24; nr_tbs = (C<<3)*CEILIDIV((Np_info+24),(C<<3)) - 24;
} }
else { else {
if (Np_info > 8424){ if (Np_info > 8424){
C = CEILIDIV((Np_info+24),8424);
nr_tbs = (C<<3)*CEILIDIV((Np_info+24),(C<<3)) - 24; nr_tbs = (C<<3)*CEILIDIV((Np_info+24),(C<<3)) - 24;
} }
else { else {
......
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