Commit 4526442a authored by Florian Kaltenberger's avatar Florian Kaltenberger

bug fixes

parent d03655ce
......@@ -5178,7 +5178,7 @@ int encode_parity_check_part(uint16_t *c,uint16_t *d, short BG,short Zc,short Kb
short *choose_generator_matrix(short BG,short Zc);
extern short no_shift_values_BG1[1012],pointer_shift_values_BG1[1012],no_shift_values_BG2[2109],pointer_shift_values_BG2[2019];
int encode_parity_check_part_orig(unsigned short *c,unsigned short *d, short BG,short Zc,short Kb)
int encode_parity_check_part_orig(unsigned short *c,unsigned short *d, short BG,short Zc,short Kb,short block_length)
{
short *Gen_shift_values=choose_generator_matrix(BG,Zc);
short *no_shift_values, *pointer_shift_values;
......@@ -5186,7 +5186,6 @@ int encode_parity_check_part_orig(unsigned short *c,unsigned short *d, short BG,
short nrows,ncols;
int i1,i2,i3,i4,i5,t,temp_prime;
unsigned short channel_temp,temp;
short block_length=Zc*Kb;
if (BG==1)
{
......@@ -5199,8 +5198,8 @@ int encode_parity_check_part_orig(unsigned short *c,unsigned short *d, short BG,
{
no_shift_values=(short *) no_shift_values_BG2;
pointer_shift_values=(short *) pointer_shift_values_BG2;
nrows=46; //parity check bits
ncols=22; //info bits
nrows=42; //parity check bits
ncols=10; //info bits
}
else {
printf("problem with BG\n");
......@@ -5209,15 +5208,17 @@ int encode_parity_check_part_orig(unsigned short *c,unsigned short *d, short BG,
no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*3)/Zc;
for (i2=0; i2 < 1; i2++)
//printf("no_punctured_columns = %d\n",no_punctured_columns);
for (i2=0; i2 < Zc; i2++)
{
t=Kb*Zc+i2;
//t=Kb*Zc+i2;
//rotate matrix here
for (i5=0; i5 < Kb; i5++)
{
temp = c[i5*Zc];
memmove(&c[i5*Zc], &c[i5*Zc+1], (Zc-1)*sizeof(unsigned char));
memmove(&c[i5*Zc], &c[i5*Zc+1], (Zc-1)*sizeof(unsigned short));
c[i5*Zc+Zc-1] = temp;
}
......@@ -5234,7 +5235,7 @@ int encode_parity_check_part_orig(unsigned short *c,unsigned short *d, short BG,
channel_temp = channel_temp ^ c[ i3*Zc + Gen_shift_values[ pointer_shift_values[temp_prime]+i4 ] ];
}
}
d[t+i1*Zc]=channel_temp;
d[i2+i1*Zc]=channel_temp;
//channel_input[t+i1*Zc]=channel_temp;
}
}
......@@ -5286,7 +5287,7 @@ int ldpc_encoder(unsigned char *test_input,unsigned char *channel_input,short bl
break;
}
}
if ((Kb*Zc)!=block_length) {
if (Zc==0) {
printf("Cannot determine lift size Zc\n");
return(-1);
}
......@@ -5298,6 +5299,7 @@ int ldpc_encoder(unsigned char *test_input,unsigned char *channel_input,short bl
//printf("%d\n",removed_bit);
// unpack input
memset(c,0,sizeof(uint16_t) * ncols * Zc);
memset(d,0,sizeof(uint16_t) * ncols * Zc * 3);
for (i=0; i<block_length; i++)
{
......@@ -5310,8 +5312,8 @@ int ldpc_encoder(unsigned char *test_input,unsigned char *channel_input,short bl
// extend matrix
for (i1=0; i1 < ncols; i1++)
{
memcpy(&c_extension[2*i1*Zc], &c[i1*Zc], Zc*sizeof(unsigned char)); /// change type here
memcpy(&c_extension[(2*i1+1)*Zc], &c[i1*Zc], Zc*sizeof(unsigned char));
memcpy(&c_extension[2*i1*Zc], &c[i1*Zc], Zc*sizeof(unsigned short)); /// change type here
memcpy(&c_extension[(2*i1+1)*Zc], &c[i1*Zc], Zc*sizeof(unsigned short));
}
//parity check part
......@@ -5321,7 +5323,7 @@ int ldpc_encoder(unsigned char *test_input,unsigned char *channel_input,short bl
}
}
else if (BG==2) {
if (encode_parity_check_part_orig(c, d, BG, Zc, Kb)!=0) {
if (encode_parity_check_part_orig(c, d, BG, Zc, Kb, block_length)!=0) {
printf("Problem with encoder\n");
return(-1);
}
......@@ -5395,6 +5397,7 @@ int ldpc_encoder_multi_segment(unsigned char **test_input,unsigned char **channe
return(-1);
}
//printf("ldpc_encoder: Zc=%d, Kb=%d, block_length=%d\n",Zc,Kb,block_length);
// calculate number of punctured bits
no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*3)/Zc;
......@@ -5402,6 +5405,7 @@ int ldpc_encoder_multi_segment(unsigned char **test_input,unsigned char **channe
// unpack input
memset(c,0,sizeof(uint16_t) * block_length);
memset(d,0,sizeof(uint16_t) * block_length*3);
for (i=0; i<block_length; i++)
for (j=0; j<n_segments; j++) {
......@@ -5427,7 +5431,7 @@ int ldpc_encoder_multi_segment(unsigned char **test_input,unsigned char **channe
}
else if (BG==2) {
//parity check part
if (encode_parity_check_part_orig(c, d, BG, Zc, Kb)!=0) {
if (encode_parity_check_part_orig(c, d, BG, Zc, Kb,block_length)!=0) {
printf("problem with encoder\n");
return(-1);
}
......
......@@ -656,9 +656,6 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
Kr = dlsch->harq_processes[harq_pid]->Kminus;
else
Kr = dlsch->harq_processes[harq_pid]->Kplus;
#else
Kr = dlsch->harq_processes[harq_pid]->Kplus;
#endif
Kr_bytes = Kr>>3;
......@@ -687,14 +684,11 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
printf("mod_order %d\n",mod_order);
#endif
//double rate = 0.33;
#ifdef DEBUG_DLSCH_CODING
printf("Encoding ... iind %d f1 %d, f2 %d\n",iind,f1f2mat_old[iind*2],f1f2mat_old[(iind*2)+1]);
#endif
start_meas(te_stats);
#ifdef TD_DECODING
threegpplte_turbo_encoder(dlsch->harq_processes[harq_pid]->c[r],
Kr>>3,
&dlsch->harq_processes[harq_pid]->d[r][96],
......@@ -737,6 +731,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
printf("\n");*/
#ifdef DEBUG_DLSCH_CODING
write_output("enc_input0.m","enc_in0",&dlsch->harq_processes[harq_pid]->c[0][0],Kr_bytes,1,4);
write_output("enc_output0.m","enc0",&dlsch->harq_processes[harq_pid]->d[0][96],(3*8*Kr_bytes)+12,1,4);
#endif
......
......@@ -360,7 +360,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
}
else{
p_decParams->BG = 2;
p_decParams->R = 15;
p_decParams->R = 13;
kc = 52;
}
......@@ -653,6 +653,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
//#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);
write_output("dec_output.m","dec0",harq_process->c[0],Kr_bytes,1,4);
//#endif
......
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