Commit 9b4a7526 authored by Sakthivel Velumani's avatar Sakthivel Velumani

Fix incorrect merge

parent 1c49cadd
...@@ -718,9 +718,9 @@ int main(int argc, char *argv[]) ...@@ -718,9 +718,9 @@ int main(int argc, char *argv[])
(double)time_decoder->diff/time_decoder->trials/1000.0/get_cpu_freq_GHz(), (double)time_decoder->diff/time_decoder->trials/1000.0/get_cpu_freq_GHz(),
sqrt((double)time_decoder->diff_square/time_decoder->trials/pow(1000,2)/pow(get_cpu_freq_GHz(),2)-pow((double)time_decoder->diff/time_decoder->trials/1000.0/get_cpu_freq_GHz(),2)), sqrt((double)time_decoder->diff_square/time_decoder->trials/pow(1000,2)/pow(get_cpu_freq_GHz(),2)-pow((double)time_decoder->diff/time_decoder->trials/1000.0/get_cpu_freq_GHz(),2)),
(double)time_decoder->max/1000.0/get_cpu_freq_GHz(), (double)time_decoder->max/1000.0/get_cpu_freq_GHz(),
dec_iter.n_iter_mean[i], dec_iter.n_iter_mean[i],
dec_iter.n_iter_std[i], dec_iter.n_iter_std[i],
dec_iter.n_iter_max[i] dec_iter.n_iter_max[i]
); );
i=i+1; i=i+1;
......
...@@ -105,7 +105,7 @@ NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations,uint16_t N_RB_UL, uint ...@@ -105,7 +105,7 @@ NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations,uint16_t N_RB_UL, uint
{ {
NR_gNB_ULSCH_t *ulsch; NR_gNB_ULSCH_t *ulsch;
uint8_t exit_flag = 0,i,r; uint8_t i,r;
uint16_t a_segments = MAX_NUM_NR_ULSCH_SEGMENTS; //number of segments to be allocated uint16_t a_segments = MAX_NUM_NR_ULSCH_SEGMENTS; //number of segments to be allocated
if (N_RB_UL != 273) { if (N_RB_UL != 273) {
...@@ -116,63 +116,22 @@ NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations,uint16_t N_RB_UL, uint ...@@ -116,63 +116,22 @@ NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations,uint16_t N_RB_UL, uint
uint16_t ulsch_bytes = a_segments*1056; // allocated bytes per segment uint16_t ulsch_bytes = a_segments*1056; // allocated bytes per segment
ulsch = (NR_gNB_ULSCH_t *)malloc16(sizeof(NR_gNB_ULSCH_t)); ulsch = (NR_gNB_ULSCH_t *)malloc16(sizeof(NR_gNB_ULSCH_t));
if (ulsch) { ulsch->max_ldpc_iterations = max_ldpc_iterations;
ulsch->Mlimit = 4;
memset(ulsch,0,sizeof(NR_gNB_ULSCH_t));
ulsch->max_ldpc_iterations = max_ldpc_iterations;
ulsch->Mlimit = 4;
for (i=0; i<NR_MAX_ULSCH_HARQ_PROCESSES; i++) {
ulsch->harq_processes[i] = (NR_UL_gNB_HARQ_t *)malloc16(sizeof(NR_UL_gNB_HARQ_t));
if (ulsch->harq_processes[i]) {
memset(ulsch->harq_processes[i],0,sizeof(NR_UL_gNB_HARQ_t));
ulsch->harq_processes[i]->b = (uint8_t*)malloc16(ulsch_bytes);
if (ulsch->harq_processes[i]->b) for (i=0; i<NR_MAX_ULSCH_HARQ_PROCESSES; i++) {
memset(ulsch->harq_processes[i]->b,0,ulsch_bytes);
else
exit_flag=3;
if (abstraction_flag == 0) { ulsch->harq_processes[i] = (NR_UL_gNB_HARQ_t *)malloc16_clear(sizeof(NR_UL_gNB_HARQ_t));
for (r=0; r<a_segments; r++) { ulsch->harq_processes[i]->b = (uint8_t*)malloc16_clear(ulsch_bytes);
if (abstraction_flag == 0) {
ulsch->harq_processes[i]->c[r] = (uint8_t*)malloc16(8448*sizeof(uint8_t)); for (r=0; r<a_segments; r++) {
ulsch->harq_processes[i]->c[r] = (uint8_t*)malloc16_clear(8448*sizeof(uint8_t));
if (ulsch->harq_processes[i]->c[r]) ulsch->harq_processes[i]->d[r] = (int16_t*)malloc16_clear((68*384)*sizeof(int16_t));
memset(ulsch->harq_processes[i]->c[r],0,8448*sizeof(uint8_t)); ulsch->harq_processes[i]->w[r] = (int16_t*)malloc16_clear((3*(6144+64))*sizeof(int16_t));
else
exit_flag=2;
ulsch->harq_processes[i]->d[r] = (int16_t*)malloc16((68*384)*sizeof(int16_t));
if (ulsch->harq_processes[i]->d[r])
memset(ulsch->harq_processes[i]->d[r],0,(68*384)*sizeof(int16_t));
else
exit_flag=2;
ulsch->harq_processes[i]->w[r] = (int16_t*)malloc16((3*(6144+64))*sizeof(int16_t));
if (ulsch->harq_processes[i]->w[r])
memset(ulsch->harq_processes[i]->w[r],0,(3*(6144+64))*sizeof(int16_t));
else
exit_flag=2;
}
}
} else {
exit_flag=1;
} }
} }
if (exit_flag==0)
return(ulsch);
} }
printf("new_gNB_ulsch with size %zu: exit_flag = %hhu\n",sizeof(NR_UL_gNB_HARQ_t), exit_flag);
free_gNB_ulsch(&ulsch,N_RB_UL);
return(NULL); return(NULL);
} }
......
...@@ -312,126 +312,124 @@ void nr_processDLSegment(void* arg) { ...@@ -312,126 +312,124 @@ void nr_processDLSegment(void* arg) {
t_nrLDPC_time_stats procTime = {0}; t_nrLDPC_time_stats procTime = {0};
t_nrLDPC_time_stats* p_procTime = &procTime ; t_nrLDPC_time_stats* p_procTime = &procTime ;
t_nrLDPC_procBuf **p_nrLDPC_procBuf = harq_process->p_nrLDPC_procBuf; start_meas(&rdata->ts_deinterleave);
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_IN);
start_meas(&rdata->ts_deinterleave); nr_deinterleaving_ldpc(E,
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_IN); Qm,
nr_deinterleaving_ldpc(E, harq_process->w[r], // [hna] w is e
Qm, dlsch_llr+r_offset);
harq_process->w[r], // [hna] w is e //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_OUT);
dlsch_llr+r_offset); stop_meas(&rdata->ts_deinterleave);
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_OUT);
stop_meas(&rdata->ts_deinterleave); start_meas(&rdata->ts_rate_unmatch);
/* LOG_D(PHY,"HARQ_PID %d Rate Matching Segment %d (coded bits %d,E %d, F %d,unpunctured/repeated bits %d, TBS %d, mod_order %d, nb_rb %d, Nl %d, rv %d, round %d)...\n",
start_meas(&rdata->ts_rate_unmatch); harq_pid,r, G,E,harq_process->F,
/* LOG_D(PHY,"HARQ_PID %d Rate Matching Segment %d (coded bits %d,E %d, F %d,unpunctured/repeated bits %d, TBS %d, mod_order %d, nb_rb %d, Nl %d, rv %d, round %d)...\n", Kr*3,
harq_pid,r, G,E,harq_process->F, harq_process->TBS,
Kr*3, Qm,
harq_process->TBS, harq_process->nb_rb,
Qm, harq_process->Nl,
harq_process->nb_rb, harq_process->rvidx,
harq_process->Nl, harq_process->round); */
harq_process->rvidx, //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_RATE_MATCHING, VCD_FUNCTION_IN);
harq_process->round); */
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_RATE_MATCHING, VCD_FUNCTION_IN); if (nr_rate_matching_ldpc_rx(Ilbrm,
Tbslbrm,
if (nr_rate_matching_ldpc_rx(Ilbrm, p_decoderParms->BG,
Tbslbrm, p_decoderParms->Z,
p_decoderParms->BG, harq_process->d[r],
p_decoderParms->Z, harq_process->w[r],
harq_process->d[r], harq_process->C,
harq_process->w[r], harq_process->rvidx,
harq_process->C, (harq_process->first_rx==1)?1:0,
harq_process->rvidx, E,
(harq_process->first_rx==1)?1:0, harq_process->F,
E, Kr-harq_process->F-2*(p_decoderParms->Z))==-1) {
harq_process->F, //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_RATE_MATCHING, VCD_FUNCTION_OUT);
Kr-harq_process->F-2*(p_decoderParms->Z))==-1) {
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_RATE_MATCHING, VCD_FUNCTION_OUT);
stop_meas(&rdata->ts_rate_unmatch);
LOG_E(PHY,"dlsch_decoding.c: Problem in rate_matching\n");
rdata->decodeIterations = dlsch->max_ldpc_iterations + 1;
return;
}
stop_meas(&rdata->ts_rate_unmatch); stop_meas(&rdata->ts_rate_unmatch);
LOG_E(PHY,"dlsch_decoding.c: Problem in rate_matching\n");
rdata->decodeIterations = dlsch->max_ldpc_iterations + 1;
return;
}
stop_meas(&rdata->ts_rate_unmatch);
r_offset += E; r_offset += E;
if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) {
LOG_D(PHY,"decoder input(segment %u) :",r);
for (int i=0; i<E; i++) if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) {
LOG_D(PHY,"%d : %d\n",i,harq_process->d[r][i]); LOG_D(PHY,"decoder input(segment %u) :",r);
LOG_D(PHY,"\n"); for (int i=0; i<E; i++)
} LOG_D(PHY,"%d : %d\n",i,harq_process->d[r][i]);
memset(harq_process->c[r],0,Kr_bytes); LOG_D(PHY,"\n");
}
if (harq_process->C == 1) { memset(harq_process->c[r],0,Kr_bytes);
if (A > NR_MAX_PDSCH_TBS)
crc_type = CRC24_A;
else
crc_type = CRC16;
length_dec = harq_process->B; if (harq_process->C == 1) {
} else { if (A > NR_MAX_PDSCH_TBS)
crc_type = CRC24_B; crc_type = CRC24_A;
length_dec = (harq_process->B+24*harq_process->C)/harq_process->C; else
} crc_type = CRC16;
{ length_dec = harq_process->B;
start_meas(&rdata->ts_ldpc_decode); } else {
//set first 2*Z_c bits to zeros crc_type = CRC24_B;
memset(&z[0],0,2*harq_process->Z*sizeof(int16_t)); length_dec = (harq_process->B+24*harq_process->C)/harq_process->C;
//set Filler bits }
memset((&z[0]+K_bits_F),127,harq_process->F*sizeof(int16_t));
//Move coded bits before filler bits
memcpy((&z[0]+2*harq_process->Z),harq_process->d[r],(K_bits_F-2*harq_process->Z)*sizeof(int16_t));
//skip filler bits
memcpy((&z[0]+Kr),harq_process->d[r]+(Kr-2*harq_process->Z),(kc*harq_process->Z-Kr)*sizeof(int16_t));
//Saturate coded bits before decoding into 8 bits values
for (i=0, j=0; j < ((kc*harq_process->Z)>>4)+1; i+=2, j++) {
pl[j] = _mm_packs_epi16(pv[i],pv[i+1]);
}
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_LDPC, VCD_FUNCTION_IN); {
p_decoderParms->block_length=length_dec; start_meas(&rdata->ts_ldpc_decode);
nrLDPC_initcall(p_decoderParms, (int8_t*)&pl[0], llrProcBuf); //set first 2*Z_c bits to zeros
no_iteration_ldpc = nrLDPC_decoder(p_decoderParms, memset(&z[0],0,2*harq_process->Z*sizeof(int16_t));
(int8_t *)&pl[0], //set Filler bits
llrProcBuf, memset((&z[0]+K_bits_F),127,harq_process->F*sizeof(int16_t));
p_procTime); //Move coded bits before filler bits
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_LDPC, VCD_FUNCTION_OUT); memcpy((&z[0]+2*harq_process->Z),harq_process->d[r],(K_bits_F-2*harq_process->Z)*sizeof(int16_t));
//skip filler bits
// Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int memcpy((&z[0]+Kr),harq_process->d[r]+(Kr-2*harq_process->Z),(kc*harq_process->Z-Kr)*sizeof(int16_t));
if (check_crc((uint8_t *)llrProcBuf,length_dec,harq_process->F,crc_type)) {
LOG_D(PHY,"Segment %u CRC OK\n\033[0m",r); //Saturate coded bits before decoding into 8 bits values
for (i=0, j=0; j < ((kc*harq_process->Z)>>4)+1; i+=2, j++) {
if (r==0) { pl[j] = _mm_packs_epi16(pv[i],pv[i+1]);
for (int i=0; i<10; i++) LOG_D(PHY,"byte %d : %x\n",i,((uint8_t *)llrProcBuf)[i]); }
}
//Temporary hack //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_LDPC, VCD_FUNCTION_IN);
no_iteration_ldpc = dlsch->max_ldpc_iterations; p_decoderParms->block_length=length_dec;
rdata->decodeIterations = no_iteration_ldpc; nrLDPC_initcall(p_decoderParms, (int8_t*)&pl[0], llrProcBuf);
} else { no_iteration_ldpc = nrLDPC_decoder(p_decoderParms,
LOG_D(PHY,"CRC NOT OK\n\033[0m"); (int8_t *)&pl[0],
llrProcBuf,
p_procTime);
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_LDPC, VCD_FUNCTION_OUT);
// Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int
if (check_crc((uint8_t *)llrProcBuf,length_dec,harq_process->F,crc_type)) {
LOG_D(PHY,"Segment %u CRC OK\n\033[0m",r);
if (r==0) {
for (int i=0; i<10; i++) LOG_D(PHY,"byte %d : %x\n",i,((uint8_t *)llrProcBuf)[i]);
} }
nb_total_decod++; //Temporary hack
no_iteration_ldpc = dlsch->max_ldpc_iterations;
rdata->decodeIterations = no_iteration_ldpc;
} else {
LOG_D(PHY,"CRC NOT OK\n\033[0m");
}
if (no_iteration_ldpc > dlsch->max_ldpc_iterations) { nb_total_decod++;
nb_error_decod++;
}
for (int m=0; m < Kr>>3; m ++) { if (no_iteration_ldpc > dlsch->max_ldpc_iterations) {
harq_process->c[r][m]= (uint8_t) llrProcBuf[m]; nb_error_decod++;
} }
stop_meas(&rdata->ts_ldpc_decode); for (int m=0; m < Kr>>3; m ++) {
harq_process->c[r][m]= (uint8_t) llrProcBuf[m];
} }
stop_meas(&rdata->ts_ldpc_decode);
}
} }
uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
......
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