Commit bd2a27f6 authored by Florian Kaltenberger's avatar Florian Kaltenberger Committed by Hongzhi Wang

some more error checks + data collection

parent d91226f0
...@@ -1161,17 +1161,27 @@ pmd_lcore_ldpc_dec(void *arg) ...@@ -1161,17 +1161,27 @@ pmd_lcore_ldpc_dec(void *arg)
deq += rte_bbdev_dequeue_ldpc_dec_ops(tp->dev_id, deq += rte_bbdev_dequeue_ldpc_dec_ops(tp->dev_id,
queue_id, &ops_deq[deq], enq - deq); queue_id, &ops_deq[deq], enq - deq);
//printf("enq %d, deq %d\n",enq,deq);
} }
/* dequeue the remaining */ /* dequeue the remaining */
int trials=0;
while (deq < enq) { while (deq < enq) {
deq += rte_bbdev_dequeue_ldpc_dec_ops(tp->dev_id, deq += rte_bbdev_dequeue_ldpc_dec_ops(tp->dev_id,
queue_id, &ops_deq[deq], enq - deq); queue_id, &ops_deq[deq], enq - deq);
usleep(10);
trials++;
if (trials>=100) {
printf("aborting decoding after 100 dequeue tries\n");
break;
}
} }
// total_time += rte_rdtsc_precise() - start_time; // total_time += rte_rdtsc_precise() - start_time;
} }
if (deq==enq) {
tp->iter_count = 0; tp->iter_count = 0;
/* get the max of iter_count for all dequeued ops */ /* get the max of iter_count for all dequeued ops */
for (i = 0; i < num_ops; ++i) { for (i = 0; i < num_ops; ++i) {
...@@ -1182,6 +1192,10 @@ pmd_lcore_ldpc_dec(void *arg) ...@@ -1182,6 +1192,10 @@ pmd_lcore_ldpc_dec(void *arg)
ret = retrieve_ldpc_dec_op(ops_deq, num_ops, ref_op, ret = retrieve_ldpc_dec_op(ops_deq, num_ops, ref_op,
tp->op_params->vector_mask, p_out); tp->op_params->vector_mask, p_out);
TEST_ASSERT_SUCCESS(ret, "Validation failed!"); TEST_ASSERT_SUCCESS(ret, "Validation failed!");
}
else {
ret = TEST_FAILED;
}
rte_bbdev_dec_op_free_bulk(ops_enq, num_ops); rte_bbdev_dec_op_free_bulk(ops_enq, num_ops);
...@@ -1193,7 +1207,7 @@ pmd_lcore_ldpc_dec(void *arg) ...@@ -1193,7 +1207,7 @@ pmd_lcore_ldpc_dec(void *arg)
1000000.0) / ((double)total_time / 1000000.0) / ((double)total_time /
(double)rte_get_tsc_hz()); (double)rte_get_tsc_hz());
*/ */
return TEST_SUCCESS; return ret;
} }
...@@ -1513,14 +1527,14 @@ int32_t nrLDPC_decod_offload(t_nrLDPC_dec_params* p_decParams, uint8_t C, uint8_ ...@@ -1513,14 +1527,14 @@ int32_t nrLDPC_decod_offload(t_nrLDPC_dec_params* p_decParams, uint8_t C, uint8_
info.drv.min_alignment, info.drv.min_alignment,
socket_id); socket_id);
if (f_ret != TEST_SUCCESS) { if (f_ret != TEST_SUCCESS) {
printf("Couldn't init queue buffers"); printf("Couldn't init queue buffers\n");
return(-1); return(-1);
} }
} }
ret = start_pmd_dec(ad, op_params, p_offloadParams, p_out); ret = start_pmd_dec(ad, op_params, p_offloadParams, p_out);
if (ret<0) { if (ret<0) {
printf("Couldn't start pmd dec"); printf("Couldn't start pmd dec\n");
return(-1); return(-1);
} }
break; break;
......
...@@ -109,7 +109,9 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, ...@@ -109,7 +109,9 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
init_pucch2_luts(); init_pucch2_luts();
load_nrLDPClib(NULL); load_nrLDPClib(NULL);
load_nrLDPClib_offload();
if (gNB->ldpc_offload_flag)
load_nrLDPClib_offload();
// PBCH DMRS gold sequences generation // PBCH DMRS gold sequences generation
nr_init_pbch_dmrs(gNB); nr_init_pbch_dmrs(gNB);
......
...@@ -609,24 +609,31 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -609,24 +609,31 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
Qm, Qm,
(int8_t*)&pl_ol128[0], (int8_t*)&pl_ol128[0],
llrProcBuf, 1); llrProcBuf, 1);
for (int m=0; m < Kr>>3; m ++) { if (ret<0) {
harq_process->c[r][m]= (uint8_t) llrProcBuf[m]; no_iteration_ldpc = ulsch->max_ldpc_iterations + 1;
} }
else {
if (check_crc((uint8_t*)llrProcBuf,length_dec,harq_process->F,crc_type)) {
for (int m=0; m < Kr>>3; m ++) {
harq_process->c[r][m]= (uint8_t) llrProcBuf[m];
}
if (check_crc((uint8_t*)llrProcBuf,length_dec,harq_process->F,crc_type)) {
#ifdef PRINT_CRC_CHECK #ifdef PRINT_CRC_CHECK
LOG_I(PHY, "Segment %d CRC OK\n",r); LOG_I(PHY, "Segment %d CRC OK\n",r);
#endif #endif
no_iteration_ldpc = 2; no_iteration_ldpc = 2;
} else { } else {
#ifdef PRINT_CRC_CHECK #ifdef PRINT_CRC_CHECK
LOG_I(PHY, "CRC NOK\n"); LOG_I(PHY, "CRC NOK\n");
#endif #endif
no_iteration_ldpc = ulsch->max_ldpc_iterations + 1; no_iteration_ldpc = ulsch->max_ldpc_iterations + 1;
}
} }
r_offset += E; r_offset += E;
/*for (int k=0;k<8;k++) /*for (int k=0;k<8;k++)
{ {
printf("output decoder [%d] = 0x%02x \n", k, harq_process->c[r][k]); printf("output decoder [%d] = 0x%02x \n", k, harq_process->c[r][k]);
...@@ -646,6 +653,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -646,6 +653,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
LOG_I(PHY,"uplink segment error %d/%d\n",r,harq_process->C); LOG_I(PHY,"uplink segment error %d/%d\n",r,harq_process->C);
LOG_D(PHY, "ULSCH %d in error\n",ULSCH_id); LOG_D(PHY, "ULSCH %d in error\n",ULSCH_id);
harq_process->processedSegments=harq_process->C; harq_process->processedSegments=harq_process->C;
r=harq_process->C;
} }
} }
if (harq_process->processedSegments==harq_process->C){ if (harq_process->processedSegments==harq_process->C){
......
...@@ -312,6 +312,7 @@ int main(int argc, char **argv) ...@@ -312,6 +312,7 @@ int main(int argc, char **argv)
uint8_t snrRun; uint8_t snrRun;
int prb_inter = 0; int prb_inter = 0;
int ldpc_offload_flag = 0; int ldpc_offload_flag = 0;
uint8_t max_rounds = 4;
int enable_ptrs = 0; int enable_ptrs = 0;
int modify_dmrs = 0; int modify_dmrs = 0;
...@@ -345,7 +346,7 @@ int main(int argc, char **argv) ...@@ -345,7 +346,7 @@ int main(int argc, char **argv)
/* initialize the sin-cos table */ /* initialize the sin-cos table */
InitSinLUT(); InitSinLUT();
while ((c = getopt(argc, argv, "a:b:c:d:ef:g:h:ikl:m:n:o:p:r:s:u:w:y:z:F:G:H:M:N:PR:S:T:U:L:Z")) != -1) { while ((c = getopt(argc, argv, "a:b:c:d:ef:g:h:ikl:m:n:o:p:q:r:s:u:w:y:z:F:G:H:M:N:PR:S:T:U:L:Z")) != -1) {
printf("handling optarg %c\n",c); printf("handling optarg %c\n",c);
switch (c) { switch (c) {
...@@ -465,6 +466,10 @@ int main(int argc, char **argv) ...@@ -465,6 +466,10 @@ int main(int argc, char **argv)
case 'p': case 'p':
extended_prefix_flag = 1; extended_prefix_flag = 1;
break; break;
case 'q':
max_rounds = atoi(optarg);
break;
case 'r': case 'r':
nb_rb = atoi(optarg); nb_rb = atoi(optarg);
...@@ -756,7 +761,11 @@ int main(int argc, char **argv) ...@@ -756,7 +761,11 @@ int main(int argc, char **argv)
nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config; nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config;
cfg->carrier_config.num_tx_ant.value = n_tx; cfg->carrier_config.num_tx_ant.value = n_tx;
cfg->carrier_config.num_rx_ant.value = n_rx; cfg->carrier_config.num_rx_ant.value = n_rx;
// nr_phy_config_request_sim(gNB,N_RB_DL,N_RB_DL,mu,0,0x01); // nr_phy_config_request_sim(gNB,N_RB_DL,N_RB_DL,mu,0,0x01);
gNB->ldpc_offload_flag = ldpc_offload_flag;
phy_init_nr_gNB(gNB,0,1); phy_init_nr_gNB(gNB,0,1);
N_RB_DL = gNB->frame_parms.N_RB_DL; N_RB_DL = gNB->frame_parms.N_RB_DL;
...@@ -810,7 +819,6 @@ int main(int argc, char **argv) ...@@ -810,7 +819,6 @@ int main(int argc, char **argv)
unsigned char harq_pid = 0; unsigned char harq_pid = 0;
gNB->ldpc_offload_flag = ldpc_offload_flag;
NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id][0]; NR_gNB_ULSCH_t *ulsch_gNB = gNB->ulsch[UE_id][0];
//nfapi_nr_ul_config_ulsch_pdu *rel15_ul = &ulsch_gNB->harq_processes[harq_pid]->ulsch_pdu; //nfapi_nr_ul_config_ulsch_pdu *rel15_ul = &ulsch_gNB->harq_processes[harq_pid]->ulsch_pdu;
nfapi_nr_ul_tti_request_t *UL_tti_req = malloc(sizeof(*UL_tti_req)); nfapi_nr_ul_tti_request_t *UL_tti_req = malloc(sizeof(*UL_tti_req));
...@@ -845,7 +853,6 @@ int main(int argc, char **argv) ...@@ -845,7 +853,6 @@ int main(int argc, char **argv)
uint16_t n_rb1 = 75; uint16_t n_rb1 = 75;
uint16_t pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA; // | PUSCH_PDU_BITMAP_PUSCH_PTRS; uint16_t pdu_bit_map = PUSCH_PDU_BITMAP_PUSCH_DATA; // | PUSCH_PDU_BITMAP_PUSCH_PTRS;
uint8_t max_rounds = 4;
uint8_t crc_status = 0; uint8_t crc_status = 0;
unsigned char mod_order = nr_get_Qm_ul(Imcs, mcs_table); unsigned char mod_order = nr_get_Qm_ul(Imcs, mcs_table);
...@@ -1014,12 +1021,14 @@ int main(int argc, char **argv) ...@@ -1014,12 +1021,14 @@ int main(int argc, char **argv)
double blerStats[4][100]; double blerStats[4][100];
double berStats[4][100]; double berStats[4][100];
double snrStats[100]; double snrStats[100];
double ldpcDecStats[100];
memset(errors_scrambling, 0, sizeof(uint32_t)*4*100); memset(errors_scrambling, 0, sizeof(uint32_t)*4*100);
memset(n_errors, 0, sizeof(int)*4*100); memset(n_errors, 0, sizeof(int)*4*100);
memset(round_trials, 0, sizeof(int)*4*100); memset(round_trials, 0, sizeof(int)*4*100);
memset(blerStats, 0, sizeof(double)*4*100); memset(blerStats, 0, sizeof(double)*4*100);
memset(berStats, 0, sizeof(double)*4*100); memset(berStats, 0, sizeof(double)*4*100);
memset(snrStats, 0, sizeof(double)*100); memset(snrStats, 0, sizeof(double)*100);
memset(ldpcDecStats, 0, sizeof(double)*100);
for (SNR = snr0; SNR < snr1; SNR += snr_step) { for (SNR = snr0; SNR < snr1; SNR += snr_step) {
varArray_t *table_rx=initVarArray(1000,sizeof(double)); varArray_t *table_rx=initVarArray(1000,sizeof(double));
int error_flag = 0; int error_flag = 0;
...@@ -1421,16 +1430,16 @@ int main(int argc, char **argv) ...@@ -1421,16 +1430,16 @@ int main(int argc, char **argv)
errors_decoding++; errors_decoding++;
} }
} }
if (n_trials == 1) { /*if (n_trials == 1) {
for (int r=0;r<ulsch_ue[0]->harq_processes[harq_pid]->C;r++) for (int r=0;r<ulsch_ue[0]->harq_processes[harq_pid]->C;r++)
for (int i=0;i<ulsch_ue[0]->harq_processes[harq_pid]->K>>3;i++) { for (int i=0;i<ulsch_ue[0]->harq_processes[harq_pid]->K>>3;i++) {
if ((ulsch_ue[0]->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]) != 0) printf("************"); if ((ulsch_ue[0]->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]) != 0)
/*printf("r %d: in[%d] %x, out[%d] %x (%x)\n",r, printf("r %d: in[%d] %x, out[%d] %x (%x)\n",r,
i,ulsch_ue[0]->harq_processes[harq_pid]->c[r][i], i,ulsch_ue[0]->harq_processes[harq_pid]->c[r][i],
i,ulsch_gNB->harq_processes[harq_pid]->c[r][i], i,ulsch_gNB->harq_processes[harq_pid]->c[r][i],
ulsch_ue[0]->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]);*/ ulsch_ue[0]->harq_processes[harq_pid]->c[r][i]^ulsch_gNB->harq_processes[harq_pid]->c[r][i]);
} }
} }*/
if (errors_decoding > 0 && error_flag == 0) { if (errors_decoding > 0 && error_flag == 0) {
n_false_positive++; n_false_positive++;
if (n_trials==1) if (n_trials==1)
...@@ -1496,6 +1505,8 @@ int main(int argc, char **argv) ...@@ -1496,6 +1505,8 @@ int main(int argc, char **argv)
printf("\n"); printf("\n");
} }
ldpcDecStats[snrRun] = gNB->ulsch_decoding_stats.trials?inMicroS(gNB->ulsch_decoding_stats.diff/gNB->ulsch_decoding_stats.trials):0;
if(n_trials==1) if(n_trials==1)
break; break;
...@@ -1540,9 +1551,11 @@ int main(int argc, char **argv) ...@@ -1540,9 +1551,11 @@ int main(int argc, char **argv)
LOG_MM("ulsimStats.m","BER_round3",berStats[3],snrRun,1,7); LOG_MM("ulsimStats.m","BER_round3",berStats[3],snrRun,1,7);
LOG_MM("ulsimStats.m","EffRate",effRate,snrRun,1,7); LOG_MM("ulsimStats.m","EffRate",effRate,snrRun,1,7);
LOG_MM("ulsimStats.m","EffTP",effTP,snrRun,1,7); LOG_MM("ulsimStats.m","EffTP",effTP,snrRun,1,7);
LOG_MM("ulsimStats.m","LDPC_dec_time",ldpcDecStats,snrRun,1,7);
free(test_input_bit); free(test_input_bit);
free(estimated_output_bit); free(estimated_output_bit);
free_nrLDPClib_offload(); if (gNB->ldpc_offload_flag)
free_nrLDPClib_offload();
if (output_fd) if (output_fd)
fclose(output_fd); fclose(output_fd);
......
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