Commit 51c55f6f authored by Remi Hardy's avatar Remi Hardy

Merge remote-tracking branch 'origin/gnb-threadpool' into integration_2021_wk10

parents 1142acf0 62a7165c
...@@ -234,6 +234,7 @@ L1s = ( ...@@ -234,6 +234,7 @@ L1s = (
{ {
num_cc = 1; num_cc = 1;
tr_n_preference = "local_mac"; tr_n_preference = "local_mac";
pusch_proc_threads = 8;
} }
); );
......
...@@ -88,7 +88,8 @@ int write_file_matlab(const char *fname, ...@@ -88,7 +88,8 @@ int write_file_matlab(const char *fname,
void *data, void *data,
int length, int length,
int dec, int dec,
unsigned int format) unsigned int format,
int multiVec)
{ {
FILE *fp=NULL; FILE *fp=NULL;
int i; int i;
...@@ -100,8 +101,7 @@ int write_file_matlab(const char *fname, ...@@ -100,8 +101,7 @@ int write_file_matlab(const char *fname,
//printf("Writing %d elements of type %d to %s\n",length,format,fname); //printf("Writing %d elements of type %d to %s\n",length,format,fname);
if (format == 10 || format ==11 || format == 12 || format == 13 || format == 14 || multiVec) {
if (format == 10 || format ==11 || format == 12 || format == 13 || format == 14) {
fp = fopen(fname,"a+"); fp = fopen(fname,"a+");
} else if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14) { } else if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14) {
fp = fopen(fname,"w+"); fp = fopen(fname,"w+");
...@@ -137,8 +137,7 @@ int write_file_matlab(const char *fname, ...@@ -137,8 +137,7 @@ int write_file_matlab(const char *fname,
return(0); return(0);
} }
if ((format != 10 && format !=11 && format != 12 && format != 13 && format != 14) || multiVec)
if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14)
fprintf(fp,"%s = [",vname); fprintf(fp,"%s = [",vname);
switch (format) { switch (format) {
...@@ -247,7 +246,7 @@ int write_file_matlab(const char *fname, ...@@ -247,7 +246,7 @@ int write_file_matlab(const char *fname,
AssertFatal(false, "unknown dump format: %d\n", format); AssertFatal(false, "unknown dump format: %d\n", format);
} }
if (format != 10 && format !=11 && format !=12 && format != 13 && format != 15) { if ((format != 10 && format !=11 && format !=12 && format != 13 && format != 15) || multiVec) {
fprintf(fp,"];\n"); fprintf(fp,"];\n");
fclose(fp); fclose(fp);
return(0); return(0);
......
...@@ -335,6 +335,7 @@ typedef struct { ...@@ -335,6 +335,7 @@ typedef struct {
@param length length of data vector to output @param length length of data vector to output
@param dec decimation level @param dec decimation level
@param format data format (0 = real 16-bit, 1 = complex 16-bit,2 real 32-bit, 3 complex 32-bit,4 = real 8-bit, 5 = complex 8-bit) @param format data format (0 = real 16-bit, 1 = complex 16-bit,2 real 32-bit, 3 complex 32-bit,4 = real 8-bit, 5 = complex 8-bit)
@param multiVec create new file or append to existing (useful for writing multiple vectors to same file. Just call the function multiple times with same file name and with this parameter set to 1)
*/ */
#define MATLAB_RAW (1<<31) #define MATLAB_RAW (1<<31)
#define MATLAB_SHORT 0 #define MATLAB_SHORT 0
...@@ -354,7 +355,7 @@ typedef struct { ...@@ -354,7 +355,7 @@ typedef struct {
#define MATLAB_CSHORT_BRACKET2 14 #define MATLAB_CSHORT_BRACKET2 14
#define MATLAB_CSHORT_BRACKET3 15 #define MATLAB_CSHORT_BRACKET3 15
int32_t write_file_matlab(const char *fname, const char *vname, void *data, int length, int dec, unsigned int format); int32_t write_file_matlab(const char *fname, const char *vname, void *data, int length, int dec, unsigned int format, int multiVec);
/*----------------macro definitions for reading log configuration from the config module */ /*----------------macro definitions for reading log configuration from the config module */
#define CONFIG_STRING_LOG_PREFIX "log_config" #define CONFIG_STRING_LOG_PREFIX "log_config"
...@@ -414,7 +415,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int ...@@ -414,7 +415,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
/* bitmask dependent macros, to generate debug file such as matlab file or message dump */ /* bitmask dependent macros, to generate debug file such as matlab file or message dump */
# define LOG_DUMPFLAG(D) (g_log->dump_mask & D) # define LOG_DUMPFLAG(D) (g_log->dump_mask & D)
# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)/* */ # define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format, 0);} while(0)/* */
/* define variable only used in LOG macro's */ /* define variable only used in LOG macro's */
# define LOG_VAR(A,B) A B # define LOG_VAR(A,B) A B
# else /* T_TRACER: remove all debugging and tracing messages, except errors */ # else /* T_TRACER: remove all debugging and tracing messages, except errors */
...@@ -431,7 +432,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int ...@@ -431,7 +432,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
# define LOG_DUMPFLAG(D) (g_log->debug_mask & D) # define LOG_DUMPFLAG(D) (g_log->debug_mask & D)
# define LOG_DUMPMSG(c, f, b, s, x...) do { if(g_log->dump_mask & f) log_dump(c, b, s, LOG_DUMP_CHAR, x) ;} while (0) /* */ # define LOG_DUMPMSG(c, f, b, s, x...) do { if(g_log->dump_mask & f) log_dump(c, b, s, LOG_DUMP_CHAR, x) ;} while (0) /* */
# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0) # define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format, 0);} while(0)
# define LOG_VAR(A,B) A B # define LOG_VAR(A,B) A B
# endif /* T_TRACER */ # endif /* T_TRACER */
/* avoid warnings for variables only used in LOG macro's but set outside debug section */ /* avoid warnings for variables only used in LOG macro's but set outside debug section */
...@@ -439,9 +440,10 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int ...@@ -439,9 +440,10 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
#define LOG_USEDINLOG_VAR(A,B) GCC_NOTUSED A B #define LOG_USEDINLOG_VAR(A,B) GCC_NOTUSED A B
/* unfiltered macros, useful for simulators or messages at init time, before log is configured */ /* unfiltered macros, useful for simulators or messages at init time, before log is configured */
#define LOG_UM(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0) #define LOG_UM(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format, 0);} while(0)
#define LOG_UI(c, x...) do {logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ; } while(0) #define LOG_UI(c, x...) do {logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ; } while(0)
#define LOG_UDUMPMSG(c, b, s, f, x...) do { log_dump(c, b, s, f, x) ;} while (0) /* */ #define LOG_UDUMPMSG(c, b, s, f, x...) do { log_dump(c, b, s, f, x) ;} while (0) /* */
# define LOG_MM(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format, 1);} while(0)
/* @}*/ /* @}*/
......
This diff is collapsed.
This diff is collapsed.
...@@ -244,6 +244,13 @@ extern char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr); ...@@ -244,6 +244,13 @@ extern char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr);
extern void set_softmodem_sighandler(void); extern void set_softmodem_sighandler(void);
extern uint64_t downlink_frequency[MAX_NUM_CCs][4]; extern uint64_t downlink_frequency[MAX_NUM_CCs][4];
extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
extern uint16_t sl_ahead;
extern uint16_t sf_ahead;
extern volatile int oai_exit;
void tx_func(void *param);
void rx_func(void *param);
void ru_tx_func(void *param);
extern uint8_t nfapi_mode; extern uint8_t nfapi_mode;
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -105,6 +105,8 @@ typedef struct { ...@@ -105,6 +105,8 @@ typedef struct {
uint8_t O_ACK; uint8_t O_ACK;
/// Index of current HARQ round for this ULSCH /// Index of current HARQ round for this ULSCH
uint8_t round; uint8_t round;
/// Last Ndi for this harq process
uint8_t ndi;
/// pointer to pdu from MAC interface (TS 36.212 V15.4.0, Sec 5.1 p. 8) /// pointer to pdu from MAC interface (TS 36.212 V15.4.0, Sec 5.1 p. 8)
unsigned char *a; unsigned char *a;
/// Pointer to the payload + CRC /// Pointer to the payload + CRC
......
...@@ -202,7 +202,6 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL, ...@@ -202,7 +202,6 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL,
for (i=0; i<number_of_harq_pids; i++) { for (i=0; i<number_of_harq_pids; i++) {
ulsch->harq_processes[i]->round=0; ulsch->harq_processes[i]->round=0;
} }
return(ulsch); return(ulsch);
} }
} }
...@@ -257,7 +256,6 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, ...@@ -257,7 +256,6 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
Ilbrm = 0; Ilbrm = 0;
Tbslbrm = 950984; //max tbs Tbslbrm = 950984; //max tbs
Coderate = 0.0; Coderate = 0.0;
harq_process->round = nr_rv_round_map_ue[harq_process->pusch_pdu.pusch_data.rv_index];
/////////// ///////////
///////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////
...@@ -267,8 +265,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, ...@@ -267,8 +265,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
LOG_D(PHY,"ulsch coding nb_rb %d, Nl = %d\n", nb_rb, harq_process->pusch_pdu.nrOfLayers); LOG_D(PHY,"ulsch coding nb_rb %d, Nl = %d\n", nb_rb, harq_process->pusch_pdu.nrOfLayers);
LOG_D(PHY,"ulsch coding A %d G %d mod_order %d\n", A,G, mod_order); LOG_D(PHY,"ulsch coding A %d G %d mod_order %d\n", A,G, mod_order);
// if (harq_process->Ndi == 1) { // this is a new packet if (harq_process->ndi != harq_process->pusch_pdu.pusch_data.new_data_indicator) { // this is a new packet
if (harq_process->round == 0) { // this is a new packet
#ifdef DEBUG_ULSCH_CODING #ifdef DEBUG_ULSCH_CODING
printf("encoding thinks this is a new packet \n"); printf("encoding thinks this is a new packet \n");
#endif #endif
...@@ -415,7 +412,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, ...@@ -415,7 +412,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
/////////// ///////////
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
harq_process->ndi = harq_process->pusch_pdu.pusch_data.new_data_indicator;
} }
F = harq_process->F; F = harq_process->F;
Kr = harq_process->K; Kr = harq_process->K;
......
...@@ -282,30 +282,6 @@ static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const in ...@@ -282,30 +282,6 @@ static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const in
graph->iteration++; graph->iteration++;
} }
static void genericLogPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const scopeSample_t **data, const int len) {
float *values, *time;
oai_xygraph_getbuff(graph, &time, &values, len, 0);
for (int ant=0; ant<nb_ant; ant++) {
if (data[ant] != NULL) {
float *values, *time;
oai_xygraph_getbuff(graph, &time, &values, len, ant);
for (int i=0; i<len; i+=8) {
float *vals=values+i;
const scopeSample_t *in=&(data[ant][i]);
// TRY AUTOMATIC simd BY GCC
for (int k=0; k<8; k++ ) {
vals[k] = 10*log10(1.0+SquaredNorm(in[k]));
}
}
oai_xygraph(graph,time,values, len, ant, 10);
}
}
}
static void genericPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const scopeSample_t **data, const int len) { static void genericPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const scopeSample_t **data, const int len) {
float *values, *time; float *values, *time;
oai_xygraph_getbuff(graph, &time, &values, len, 0); oai_xygraph_getbuff(graph, &time, &values, len, 0);
......
...@@ -741,4 +741,10 @@ typedef struct RRU_config_s { ...@@ -741,4 +741,10 @@ typedef struct RRU_config_s {
MBSFN_config_t MBSFN_config[8]; MBSFN_config_t MBSFN_config[8];
} RRU_config_t; } RRU_config_t;
typedef struct processingData_RU {
int frame_tx;
int slot_tx;
openair0_timestamp timestamp_tx;
RU_t *ru;
} processingData_RU_t;
#endif //__PHY_DEFS_RU__H__ #endif //__PHY_DEFS_RU__H__
...@@ -830,6 +830,9 @@ typedef struct PHY_VARS_gNB_s { ...@@ -830,6 +830,9 @@ typedef struct PHY_VARS_gNB_s {
time_stats_t ulsch_freq_offset_estimation_stats; time_stats_t ulsch_freq_offset_estimation_stats;
*/ */
notifiedFIFO_t *respDecode; notifiedFIFO_t *respDecode;
notifiedFIFO_t *resp_L1;
notifiedFIFO_t *resp_L1_tx;
notifiedFIFO_t *resp_RU_tx;
tpool_t *threadPool; tpool_t *threadPool;
int nbDecode; int nbDecode;
uint8_t pusch_proc_threads; uint8_t pusch_proc_threads;
...@@ -871,4 +874,13 @@ union ldpcReqUnion { ...@@ -871,4 +874,13 @@ union ldpcReqUnion {
uint64_t p; uint64_t p;
}; };
typedef struct processingData_L1 {
int frame_rx;
int frame_tx;
int slot_rx;
int slot_tx;
openair0_timestamp timestamp_tx;
PHY_VARS_gNB *gNB;
} processingData_L1_t;
#endif #endif
...@@ -79,8 +79,8 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; ...@@ -79,8 +79,8 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
double cpuf; double cpuf;
int sf_ahead=4 ; uint16_t sf_ahead=4 ;
int sl_ahead=0; uint16_t sl_ahead=0;
//uint8_t nfapi_mode = 0; //uint8_t nfapi_mode = 0;
uint64_t downlink_frequency[MAX_NUM_CCs][4]; uint64_t downlink_frequency[MAX_NUM_CCs][4];
...@@ -248,7 +248,10 @@ int main(int argc, char **argv) ...@@ -248,7 +248,10 @@ int main(int argc, char **argv)
int i,aa;//,l; int i,aa;//,l;
double sigma2, sigma2_dB=10, SNR, snr0=-2.0, snr1=2.0; double sigma2, sigma2_dB=10, SNR, snr0=-2.0, snr1=2.0;
uint8_t snr1set=0; uint8_t snr1set=0;
float roundStats[50]; double roundStats[500] = {0};
double blerStats[500] = {0};
double berStats[500] = {0};
double snrStats[500] = {0};
float effRate; float effRate;
//float psnr; //float psnr;
float eff_tp_check = 0.7; float eff_tp_check = 0.7;
...@@ -1114,7 +1117,9 @@ int main(int argc, char **argv) ...@@ -1114,7 +1117,9 @@ int main(int argc, char **argv)
if (UE_harq_process->harq_ack.ack==1) effRate += ((float)TBS)/round; if (UE_harq_process->harq_ack.ack==1) effRate += ((float)TBS)/round;
} // noise trials } // noise trials
blerStats[snrRun] = (float) n_errors / (float) n_trials;
roundStats[snrRun]/=((float)n_trials); roundStats[snrRun]/=((float)n_trials);
berStats[snrRun] = (double)errors_scrambling/available_bits/n_trials;
effRate /= n_trials; effRate /= n_trials;
printf("*****************************************\n"); printf("*****************************************\n");
printf("SNR %f, (false positive %f)\n", SNR, printf("SNR %f, (false positive %f)\n", SNR,
...@@ -1122,7 +1127,7 @@ int main(int argc, char **argv) ...@@ -1122,7 +1127,7 @@ int main(int argc, char **argv)
printf("*****************************************\n"); printf("*****************************************\n");
printf("\n"); printf("\n");
dump_pdsch_stats(gNB); dump_pdsch_stats(gNB);
printf("SNR %f : n_errors (negative CRC) = %d/%d, Avg round %.2f, Channel BER %e, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %u bits/slot\n", SNR, n_errors, n_trials,roundStats[snrRun],(double)errors_scrambling/available_bits/n_trials,effRate,effRate/TBS*100,TBS); printf("SNR %f : n_errors (negative CRC) = %d/%d, Avg round %.2f, Channel BER %e, BLER %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %u bits/slot\n", SNR, n_errors, n_trials,roundStats[snrRun],berStats[snrRun],blerStats[snrRun],effRate,effRate/TBS*100,TBS);
printf("\n"); printf("\n");
if (print_perf==1) { if (print_perf==1) {
...@@ -1187,15 +1192,19 @@ int main(int argc, char **argv) ...@@ -1187,15 +1192,19 @@ int main(int argc, char **argv)
break; break;
} }
//if ((float)n_errors/(float)n_trials <= target_error_rate) {
if (effRate > (eff_tp_check*TBS)) { if (effRate > (eff_tp_check*TBS)) {
printf("PDSCH test OK\n"); printf("PDSCH test OK\n");
break; break;
} }
snrStats[snrRun] = SNR;
snrRun++; snrRun++;
} // NSR } // NSR
LOG_M("dlsimStats.m","SNR",snrStats,snrRun,1,7);
LOG_MM("dlsimStats.m","BLER",blerStats,snrRun,1,7);
LOG_MM("dlsimStats.m","BER",berStats,snrRun,1,7);
LOG_MM("dlsimStats.m","rounds",roundStats,snrRun,1,7);
/*if (n_trials>1) { /*if (n_trials>1) {
printf("HARQ stats:\nSNR\tRounds\n"); printf("HARQ stats:\nSNR\tRounds\n");
psnr = snr0; psnr = snr0;
......
...@@ -64,7 +64,7 @@ double cpuf; ...@@ -64,7 +64,7 @@ double cpuf;
extern uint16_t prach_root_sequence_map0_3[838]; extern uint16_t prach_root_sequence_map0_3[838];
openair0_config_t openair0_cfg[MAX_CARDS]; openair0_config_t openair0_cfg[MAX_CARDS];
//uint8_t nfapi_mode=0; //uint8_t nfapi_mode=0;
int sl_ahead = 0; uint16_t sl_ahead = 0;
//void dump_nr_prach_config(NR_DL_FRAME_PARMS *frame_parms,uint8_t subframe); //void dump_nr_prach_config(NR_DL_FRAME_PARMS *frame_parms,uint8_t subframe);
......
...@@ -75,9 +75,9 @@ PHY_VARS_NR_UE *UE; ...@@ -75,9 +75,9 @@ PHY_VARS_NR_UE *UE;
RAN_CONTEXT_t RC; RAN_CONTEXT_t RC;
int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
int sf_ahead=4 ; uint16_t sf_ahead=4 ;
int slot_ahead=6 ; int slot_ahead=6 ;
int sl_ahead=0; uint16_t sl_ahead=0;
double cpuf; double cpuf;
//uint8_t nfapi_mode = 0; //uint8_t nfapi_mode = 0;
uint64_t downlink_frequency[MAX_NUM_CCs][4]; uint64_t downlink_frequency[MAX_NUM_CCs][4];
......
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