Commit 618bfd66 authored by Florian Kaltenberger's avatar Florian Kaltenberger

adding first version of parallel segments encoder

parent 26d9855a
...@@ -574,5 +574,5 @@ void phy_viterbi_dot11(int8_t *,uint8_t *,uint16_t); ...@@ -574,5 +574,5 @@ void phy_viterbi_dot11(int8_t *,uint8_t *,uint16_t);
//short *ldpc_decoder(short *msgChannel,short block_length,short No_iteration,double rate); //short *ldpc_decoder(short *msgChannel,short block_length,short No_iteration,double rate);
//short *ldpc_encoder(char *test_input,char* channel_input,short block_length,double rate); //short *ldpc_encoder(char *test_input,char* channel_input,short block_length,double rate);
int ldpc_encoder(unsigned char *test_input,unsigned char* channel_input,short block_length,double rate); int ldpc_encoder(unsigned char *test_input,unsigned char* channel_input,short block_length,double rate);
int ldpc_encoder_multi_segment(unsigned char **test_input,unsigned char **channel_input,short block_length,double rate,uint8_t n_segments);
#endif #endif
This diff is collapsed.
...@@ -582,6 +582,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB, ...@@ -582,6 +582,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
unsigned int Kr=0,Kr_bytes,r,r_offset=0; unsigned int Kr=0,Kr_bytes,r,r_offset=0;
unsigned short m=dlsch->harq_processes[harq_pid]->mcs; unsigned short m=dlsch->harq_processes[harq_pid]->mcs;
uint8_t beamforming_mode=0; uint8_t beamforming_mode=0;
uint8_t *d_tmp[MAX_NUM_DLSCH_SEGMENTS];
double rate = 0.33; double rate = 0.33;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN);
...@@ -647,11 +648,13 @@ int dlsch_encoding(PHY_VARS_eNB *eNB, ...@@ -647,11 +648,13 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
#endif #endif
printf("Encoder: B %d F %d \n",dlsch->harq_processes[harq_pid]->B, dlsch->harq_processes[harq_pid]->F); printf("Encoder: B %d F %d \n",dlsch->harq_processes[harq_pid]->B, dlsch->harq_processes[harq_pid]->F);
#ifdef TD_DECODING
for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) { for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
//if (r<dlsch->harq_processes[harq_pid]->Cminus) if (r<dlsch->harq_processes[harq_pid]->Cminus)
// Kr = dlsch->harq_processes[harq_pid]->Kminus; Kr = dlsch->harq_processes[harq_pid]->Kminus;
//else else
Kr = dlsch->harq_processes[harq_pid]->Kplus; Kr = dlsch->harq_processes[harq_pid]->Kplus;
Kr_bytes = Kr>>3; Kr_bytes = Kr>>3;
...@@ -687,19 +690,6 @@ int dlsch_encoding(PHY_VARS_eNB *eNB, ...@@ -687,19 +690,6 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
printf("Encoding ... iind %d f1 %d, f2 %d\n",iind,f1f2mat_old[iind*2],f1f2mat_old[(iind*2)+1]); printf("Encoding ... iind %d f1 %d, f2 %d\n",iind,f1f2mat_old[iind*2],f1f2mat_old[(iind*2)+1]);
#endif #endif
start_meas(te_stats); start_meas(te_stats);
/*printf("start turbo encoder kr %d kr>>3 %d\n", Kr, Kr>>3);
for (int tbc_counter = 0; tbc_counter< Kr; tbc_counter++){
printf("turbo tbc number %d input %d\n",tbc_counter, dlsch->harq_processes[harq_pid]->c[r][tbc_counter]);
}*/
printf("start encoder kr %d kr>>3 %d rate %.2f\n", Kr, Kr>>3, rate);
for (int tbs_counter = 0; tbs_counter< 8; tbs_counter++){
printf("%d\n", dlsch->harq_processes[harq_pid]->c[r][tbs_counter]);
}
printf("end encoder \n");
#ifdef TD_DECODING
threegpplte_turbo_encoder(dlsch->harq_processes[harq_pid]->c[r], threegpplte_turbo_encoder(dlsch->harq_processes[harq_pid]->c[r],
Kr>>3, Kr>>3,
&dlsch->harq_processes[harq_pid]->d[r][96], &dlsch->harq_processes[harq_pid]->d[r][96],
...@@ -707,38 +697,46 @@ int dlsch_encoding(PHY_VARS_eNB *eNB, ...@@ -707,38 +697,46 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
f1f2mat_old[iind*2], // f1 (see 36121-820, page 14) f1f2mat_old[iind*2], // f1 (see 36121-820, page 14)
f1f2mat_old[(iind*2)+1] // f2 (see 36121-820, page 14) f1f2mat_old[(iind*2)+1] // f2 (see 36121-820, page 14)
); );
stop_meas(te_stats);
}
#else #else
printf("start ldpc encoder\n"); Kr = dlsch->harq_processes[harq_pid]->Kplus;
printf("input %d %d %d %d %d \n", dlsch->harq_processes[harq_pid]->c[r][0], dlsch->harq_processes[harq_pid]->c[r][1], dlsch->harq_processes[harq_pid]->c[r][2],dlsch->harq_processes[harq_pid]->c[r][3], dlsch->harq_processes[harq_pid]->c[r][4]);
//ldpc_encoder((char*)dlsch->harq_processes[harq_pid]->c[r],(char*)&dlsch->harq_processes[harq_pid]->d[r][96],dlsch->harq_processes[harq_pid]->B,rate);
ldpc_encoder((unsigned char*)dlsch->harq_processes[harq_pid]->c[r],&dlsch->harq_processes[harq_pid]->d[r][96],Kr,rate); Kr_bytes = Kr>>3;
for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
d_tmp[r] = &dlsch->harq_processes[harq_pid]->d[r][96];
#ifdef DEBUG_DLSCH_CODING
printf("start ldpc encoder segment %d/%d\n",r,dlsch->harq_processes[harq_pid]->C);
printf("input %d %d %d %d %d \n", dlsch->harq_processes[harq_pid]->c[r][0], dlsch->harq_processes[harq_pid]->c[r][1], dlsch->harq_processes[harq_pid]->c[r][2],dlsch->harq_processes[harq_pid]->c[r][3], dlsch->harq_processes[harq_pid]->c[r][4]);
#endif #endif
printf("end ldpc encoder -- output\n"); //ldpc_encoder((unsigned char*)dlsch->harq_processes[harq_pid]->c[r],&dlsch->harq_processes[harq_pid]->d[r][96],Kr,rate);
}
start_meas(te_stats);
ldpc_encoder_multi_segment(dlsch->harq_processes[harq_pid]->c,d_tmp,Kr,rate,dlsch->harq_processes[harq_pid]->C);
stop_meas(te_stats);
#endif
/*printf("end ldpc encoder -- output\n");
/*printf("output %d %d %d %d %d \n", dlsch->harq_processes[harq_pid]->d[r][96], dlsch->harq_processes[harq_pid]->d[r][96+1], dlsch->harq_processes[harq_pid]->d[r][96+2],dlsch->harq_processes[harq_pid]->d[r][96+3], dlsch->harq_processes[harq_pid]->d[r][96+4]); printf("output %d %d %d %d %d \n", dlsch->harq_processes[harq_pid]->d[r][96], dlsch->harq_processes[harq_pid]->d[r][96+1], dlsch->harq_processes[harq_pid]->d[r][96+2],dlsch->harq_processes[harq_pid]->d[r][96+3], dlsch->harq_processes[harq_pid]->d[r][96+4]);
for (int cnt =0 ; cnt < 66*(*pz); cnt ++){ for (int cnt =0 ; cnt < 66*(*pz); cnt ++){
printf("%d \n", dlsch->harq_processes[harq_pid]->d[r][96+cnt]); printf("%d \n", dlsch->harq_processes[harq_pid]->d[r][96+cnt]);
} }
printf("\n");*/ printf("\n");*/
stop_meas(te_stats);
#ifdef DEBUG_DLSCH_CODING
if (r==0)
write_output("enc_output0.m","enc0",&dlsch->harq_processes[harq_pid]->d[r][96],(3*8*Kr_bytes)+12,1,4);
#ifdef DEBUG_DLSCH_CODING
write_output("enc_output0.m","enc0",&dlsch->harq_processes[harq_pid]->d[0][96],(3*8*Kr_bytes)+12,1,4);
#endif #endif
start_meas(i_stats); start_meas(i_stats);
for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
dlsch->harq_processes[harq_pid]->RTC[r] = dlsch->harq_processes[harq_pid]->RTC[r] =
sub_block_interleaving_turbo(4+(Kr_bytes*8), sub_block_interleaving_turbo(4+(Kr_bytes*8),
&dlsch->harq_processes[harq_pid]->d[r][96], &dlsch->harq_processes[harq_pid]->d[r][96],
dlsch->harq_processes[harq_pid]->w[r]); dlsch->harq_processes[harq_pid]->w[r]);
stop_meas(i_stats);
} }
stop_meas(i_stats);
} }
......
...@@ -212,11 +212,6 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, ...@@ -212,11 +212,6 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
__m128i *pv = (__m128i*)&z; __m128i *pv = (__m128i*)&z;
__m128i *pl = (__m128i*)&l; __m128i *pl = (__m128i*)&l;
#ifdef DEBUG_DLSCH_DECODING
uint16_t i;
#endif
//#ifdef __AVX2__ //#ifdef __AVX2__
#if 0 #if 0
int Kr_last,skipped_last=0; int Kr_last,skipped_last=0;
...@@ -616,7 +611,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, ...@@ -616,7 +611,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
&pl[0], &pl[0],
llrProcBuf, llrProcBuf,
p_procTime); p_procTime);
ret = no_iteration_ldpc; //ret = no_iteration_ldpc;
nb_total_decod++; nb_total_decod++;
...@@ -652,14 +647,16 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, ...@@ -652,14 +647,16 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
printf(" \n");*/ printf(" \n");*/
#endif #endif
//printf("output decoder %d %d %d %d %d \n", harq_process->c[r][0], harq_process->c[r][1], harq_process->c[r][2],harq_process->c[r][3], harq_process->c[r][4]); #ifdef DEBUG_DLSCH_DECODING
printf("output decoder %d %d %d %d %d \n", harq_process->c[r][0], harq_process->c[r][1], harq_process->c[r][2],harq_process->c[r][3], harq_process->c[r][4]);
printf("no_iterations_ldpc %d\n",no_iteration_ldpc);
#endif
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
stop_meas(dlsch_turbo_decoding_stats); stop_meas(dlsch_turbo_decoding_stats);
#endif #endif
} }
#else #else //1
if ((harq_process->C == 1) || if ((harq_process->C == 1) ||
((r==harq_process->C-1) && (skipped_last==0))) { // last segment with odd number of segments ((r==harq_process->C-1) && (skipped_last==0))) { // last segment with odd number of segments
...@@ -805,7 +802,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, ...@@ -805,7 +802,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
} }
} }
} }
#endif #endif //1
/*printf("Segmentation: C %d r %d, dlsch_rate_unmatching_stats %5.3f dlsch_deinterleaving_stats %5.3f dlsch_turbo_decoding_stats %5.3f \n", /*printf("Segmentation: C %d r %d, dlsch_rate_unmatching_stats %5.3f dlsch_deinterleaving_stats %5.3f dlsch_turbo_decoding_stats %5.3f \n",
harq_process->C, harq_process->C,
......
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