Fix incorrect merge
This commit is contained in:
@@ -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
|
|||||||
{
|
{
|
||||||
|
|
||||||
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
|
|||||||
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));
|
for (i=0; i<NR_MAX_ULSCH_HARQ_PROCESSES; i++) {
|
||||||
|
|
||||||
ulsch->max_ldpc_iterations = max_ldpc_iterations;
|
ulsch->harq_processes[i] = (NR_UL_gNB_HARQ_t *)malloc16_clear(sizeof(NR_UL_gNB_HARQ_t));
|
||||||
ulsch->Mlimit = 4;
|
ulsch->harq_processes[i]->b = (uint8_t*)malloc16_clear(ulsch_bytes);
|
||||||
|
if (abstraction_flag == 0) {
|
||||||
for (i=0; i<NR_MAX_ULSCH_HARQ_PROCESSES; i++) {
|
for (r=0; r<a_segments; r++) {
|
||||||
|
ulsch->harq_processes[i]->c[r] = (uint8_t*)malloc16_clear(8448*sizeof(uint8_t));
|
||||||
ulsch->harq_processes[i] = (NR_UL_gNB_HARQ_t *)malloc16(sizeof(NR_UL_gNB_HARQ_t));
|
ulsch->harq_processes[i]->d[r] = (int16_t*)malloc16_clear((68*384)*sizeof(int16_t));
|
||||||
|
ulsch->harq_processes[i]->w[r] = (int16_t*)malloc16_clear((3*(6144+64))*sizeof(int16_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)
|
|
||||||
memset(ulsch->harq_processes[i]->b,0,ulsch_bytes);
|
|
||||||
else
|
|
||||||
exit_flag=3;
|
|
||||||
|
|
||||||
if (abstraction_flag == 0) {
|
|
||||||
for (r=0; r<a_segments; r++) {
|
|
||||||
|
|
||||||
ulsch->harq_processes[i]->c[r] = (uint8_t*)malloc16(8448*sizeof(uint8_t));
|
|
||||||
|
|
||||||
if (ulsch->harq_processes[i]->c[r])
|
|
||||||
memset(ulsch->harq_processes[i]->c[r],0,8448*sizeof(uint8_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) {
|
|||||||
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);
|
||||||
|
nr_deinterleaving_ldpc(E,
|
||||||
|
Qm,
|
||||||
|
harq_process->w[r], // [hna] w is e
|
||||||
|
dlsch_llr+r_offset);
|
||||||
|
//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_deinterleave);
|
start_meas(&rdata->ts_rate_unmatch);
|
||||||
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_IN);
|
/* 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",
|
||||||
nr_deinterleaving_ldpc(E,
|
harq_pid,r, G,E,harq_process->F,
|
||||||
Qm,
|
Kr*3,
|
||||||
harq_process->w[r], // [hna] w is e
|
harq_process->TBS,
|
||||||
dlsch_llr+r_offset);
|
Qm,
|
||||||
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_OUT);
|
harq_process->nb_rb,
|
||||||
stop_meas(&rdata->ts_deinterleave);
|
harq_process->Nl,
|
||||||
|
harq_process->rvidx,
|
||||||
|
harq_process->round); */
|
||||||
|
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_RATE_MATCHING, VCD_FUNCTION_IN);
|
||||||
|
|
||||||
start_meas(&rdata->ts_rate_unmatch);
|
if (nr_rate_matching_ldpc_rx(Ilbrm,
|
||||||
/* 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",
|
Tbslbrm,
|
||||||
harq_pid,r, G,E,harq_process->F,
|
p_decoderParms->BG,
|
||||||
Kr*3,
|
p_decoderParms->Z,
|
||||||
harq_process->TBS,
|
harq_process->d[r],
|
||||||
Qm,
|
harq_process->w[r],
|
||||||
harq_process->nb_rb,
|
harq_process->C,
|
||||||
harq_process->Nl,
|
harq_process->rvidx,
|
||||||
harq_process->rvidx,
|
(harq_process->first_rx==1)?1:0,
|
||||||
harq_process->round); */
|
E,
|
||||||
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_RATE_MATCHING, VCD_FUNCTION_IN);
|
harq_process->F,
|
||||||
|
Kr-harq_process->F-2*(p_decoderParms->Z))==-1) {
|
||||||
if (nr_rate_matching_ldpc_rx(Ilbrm,
|
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_RATE_MATCHING, VCD_FUNCTION_OUT);
|
||||||
Tbslbrm,
|
|
||||||
p_decoderParms->BG,
|
|
||||||
p_decoderParms->Z,
|
|
||||||
harq_process->d[r],
|
|
||||||
harq_process->w[r],
|
|
||||||
harq_process->C,
|
|
||||||
harq_process->rvidx,
|
|
||||||
(harq_process->first_rx==1)?1:0,
|
|
||||||
E,
|
|
||||||
harq_process->F,
|
|
||||||
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)) {
|
if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) {
|
||||||
LOG_D(PHY,"decoder input(segment %u) :",r);
|
LOG_D(PHY,"decoder input(segment %u) :",r);
|
||||||
|
|
||||||
for (int i=0; i<E; i++)
|
for (int i=0; i<E; i++)
|
||||||
LOG_D(PHY,"%d : %d\n",i,harq_process->d[r][i]);
|
LOG_D(PHY,"%d : %d\n",i,harq_process->d[r][i]);
|
||||||
|
|
||||||
LOG_D(PHY,"\n");
|
LOG_D(PHY,"\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(harq_process->c[r],0,Kr_bytes);
|
||||||
|
|
||||||
|
if (harq_process->C == 1) {
|
||||||
|
if (A > NR_MAX_PDSCH_TBS)
|
||||||
|
crc_type = CRC24_A;
|
||||||
|
else
|
||||||
|
crc_type = CRC16;
|
||||||
|
|
||||||
|
length_dec = harq_process->B;
|
||||||
|
} else {
|
||||||
|
crc_type = CRC24_B;
|
||||||
|
length_dec = (harq_process->B+24*harq_process->C)/harq_process->C;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
start_meas(&rdata->ts_ldpc_decode);
|
||||||
|
//set first 2*Z_c bits to zeros
|
||||||
|
memset(&z[0],0,2*harq_process->Z*sizeof(int16_t));
|
||||||
|
//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]);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(harq_process->c[r],0,Kr_bytes);
|
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_LDPC, VCD_FUNCTION_IN);
|
||||||
|
p_decoderParms->block_length=length_dec;
|
||||||
|
nrLDPC_initcall(p_decoderParms, (int8_t*)&pl[0], llrProcBuf);
|
||||||
|
no_iteration_ldpc = nrLDPC_decoder(p_decoderParms,
|
||||||
|
(int8_t *)&pl[0],
|
||||||
|
llrProcBuf,
|
||||||
|
p_procTime);
|
||||||
|
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_LDPC, VCD_FUNCTION_OUT);
|
||||||
|
|
||||||
if (harq_process->C == 1) {
|
// Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int
|
||||||
if (A > NR_MAX_PDSCH_TBS)
|
if (check_crc((uint8_t *)llrProcBuf,length_dec,harq_process->F,crc_type)) {
|
||||||
crc_type = CRC24_A;
|
LOG_D(PHY,"Segment %u CRC OK\n\033[0m",r);
|
||||||
else
|
|
||||||
crc_type = CRC16;
|
|
||||||
|
|
||||||
length_dec = harq_process->B;
|
if (r==0) {
|
||||||
|
for (int i=0; i<10; i++) LOG_D(PHY,"byte %d : %x\n",i,((uint8_t *)llrProcBuf)[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Temporary hack
|
||||||
|
no_iteration_ldpc = dlsch->max_ldpc_iterations;
|
||||||
|
rdata->decodeIterations = no_iteration_ldpc;
|
||||||
} else {
|
} else {
|
||||||
crc_type = CRC24_B;
|
LOG_D(PHY,"CRC NOT OK\n\033[0m");
|
||||||
length_dec = (harq_process->B+24*harq_process->C)/harq_process->C;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
nb_total_decod++;
|
||||||
start_meas(&rdata->ts_ldpc_decode);
|
|
||||||
//set first 2*Z_c bits to zeros
|
|
||||||
memset(&z[0],0,2*harq_process->Z*sizeof(int16_t));
|
|
||||||
//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
|
if (no_iteration_ldpc > dlsch->max_ldpc_iterations) {
|
||||||
for (i=0, j=0; j < ((kc*harq_process->Z)>>4)+1; i+=2, j++) {
|
nb_error_decod++;
|
||||||
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;
|
|
||||||
nrLDPC_initcall(p_decoderParms, (int8_t*)&pl[0], llrProcBuf);
|
|
||||||
no_iteration_ldpc = nrLDPC_decoder(p_decoderParms,
|
|
||||||
(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]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Temporary hack
|
|
||||||
no_iteration_ldpc = dlsch->max_ldpc_iterations;
|
|
||||||
rdata->decodeIterations = no_iteration_ldpc;
|
|
||||||
} else {
|
|
||||||
LOG_D(PHY,"CRC NOT OK\n\033[0m");
|
|
||||||
}
|
|
||||||
|
|
||||||
nb_total_decod++;
|
|
||||||
|
|
||||||
if (no_iteration_ldpc > dlsch->max_ldpc_iterations) {
|
|
||||||
nb_error_decod++;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int m=0; m < Kr>>3; m ++) {
|
|
||||||
harq_process->c[r][m]= (uint8_t) llrProcBuf[m];
|
|
||||||
}
|
|
||||||
|
|
||||||
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,
|
||||||
|
|||||||
Reference in New Issue
Block a user