Commit 810e62e1 authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/ldpc-decoder-memory' into integration_2022_wk14

parents 276c7be5 2c23b28b
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "openair1/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.h" #include "openair1/PHY/CODING/nrLDPC_decoder_LYC/nrLDPC_decoder_LYC.h"
#include "openair1/PHY/defs_nr_common.h" #include "openair1/PHY/defs_nr_common.h"
#include "coding_unitary_defs.h" #include "coding_unitary_defs.h"
#include "common/utils/LOG/log.h"
#define MAX_BLOCK_LENGTH 8448 #define MAX_BLOCK_LENGTH 8448
...@@ -79,16 +80,19 @@ char quantize8bit(double D,double x) ...@@ -79,16 +80,19 @@ char quantize8bit(double D,double x)
} }
typedef struct { typedef struct {
double n_iter_mean; double n_iter_mean[400];
double n_iter_std; double n_iter_std[400];
int n_iter_max; int n_iter_max[400];
double snr[400];
double ber[400];
double bler[400];
} n_iter_stats_t; } n_iter_stats_t;
nrLDPC_encoderfunc_t encoder_orig; nrLDPC_encoderfunc_t encoder_orig;
short lift_size[51]= {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,20,22,24,26,28,30,32,36,40,44,48,52,56,60,64,72,80,88,96,104,112,120,128,144,160,176,192,208,224,240,256,288,320,352,384}; short lift_size[51]= {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,20,22,24,26,28,30,32,36,40,44,48,52,56,60,64,72,80,88,96,104,112,120,128,144,160,176,192,208,224,240,256,288,320,352,384};
int test_ldpc(short No_iteration, int test_ldpc(short max_iterations,
int nom_rate, int nom_rate,
int denom_rate, int denom_rate,
double SNR, double SNR,
...@@ -102,8 +106,8 @@ int test_ldpc(short No_iteration, ...@@ -102,8 +106,8 @@ int test_ldpc(short No_iteration,
unsigned int *crc_misses, unsigned int *crc_misses,
time_stats_t *time_optim, time_stats_t *time_optim,
time_stats_t *time_decoder, time_stats_t *time_decoder,
n_iter_stats_t *dec_iter n_iter_stats_t *dec_iter,
) int nsnr)
{ {
//clock initiate //clock initiate
//time_stats_t time,time_optim,tinput,tprep,tparity,toutput, time_decoder; //time_stats_t time,time_optim,tinput,tprep,tparity,toutput, time_decoder;
...@@ -126,7 +130,6 @@ int test_ldpc(short No_iteration, ...@@ -126,7 +130,6 @@ int test_ldpc(short No_iteration,
//double channel_output[68 * 384]; //double channel_output[68 * 384];
double modulated_input[MAX_NUM_DLSCH_SEGMENTS][68 * 384] = { 0 }; double modulated_input[MAX_NUM_DLSCH_SEGMENTS][68 * 384] = { 0 };
char channel_output_fixed[MAX_NUM_DLSCH_SEGMENTS][68 * 384] = { 0 }; char channel_output_fixed[MAX_NUM_DLSCH_SEGMENTS][68 * 384] = { 0 };
unsigned int i,j,trial=0;
short BG=0,nrows=0;//,ncols; short BG=0,nrows=0;//,ncols;
int no_punctured_columns,removed_bit; int no_punctured_columns,removed_bit;
int i1,Zc,Kb=0; int i1,Zc,Kb=0;
...@@ -137,12 +140,9 @@ int test_ldpc(short No_iteration, ...@@ -137,12 +140,9 @@ int test_ldpc(short No_iteration,
int code_rate_vec[8] = {15, 13, 25, 12, 23, 34, 56, 89}; int code_rate_vec[8] = {15, 13, 25, 12, 23, 34, 56, 89};
//double code_rate_actual_vec[8] = {0.2, 0.33333, 0.4, 0.5, 0.66667, 0.73333, 0.81481, 0.88}; //double code_rate_actual_vec[8] = {0.2, 0.33333, 0.4, 0.5, 0.66667, 0.73333, 0.81481, 0.88};
t_nrLDPC_dec_params decParams; t_nrLDPC_dec_params decParams[MAX_NUM_DLSCH_SEGMENTS]={0};
t_nrLDPC_procBuf nrLDPC_procBuf;
t_nrLDPC_procBuf* p_nrLDPC_procBuf = &nrLDPC_procBuf;
t_nrLDPC_time_stats decoder_profiler = {0}; t_nrLDPC_time_stats decoder_profiler = {0};
t_nrLDPC_time_stats* p_decoder_profiler =&decoder_profiler ;
int32_t n_iter = 0; int32_t n_iter = 0;
...@@ -152,7 +152,7 @@ int test_ldpc(short No_iteration, ...@@ -152,7 +152,7 @@ int test_ldpc(short No_iteration,
*crc_misses=0; *crc_misses=0;
// generate input block // generate input block
for(j=0;j<MAX_NUM_DLSCH_SEGMENTS;j++) { for(int j=0;j<MAX_NUM_DLSCH_SEGMENTS;j++) {
test_input[j]=(unsigned char *)malloc16(sizeof(unsigned char) * block_length/8); test_input[j]=(unsigned char *)malloc16(sizeof(unsigned char) * block_length/8);
memset(test_input[j], 0, sizeof(unsigned char) * block_length / 8); memset(test_input[j], 0, sizeof(unsigned char) * block_length / 8);
channel_input[j] = (unsigned char *)malloc16(sizeof(unsigned char) * 68*384); channel_input[j] = (unsigned char *)malloc16(sizeof(unsigned char) * 68*384);
...@@ -181,11 +181,8 @@ int test_ldpc(short No_iteration, ...@@ -181,11 +181,8 @@ int test_ldpc(short No_iteration,
reset_meas(&decoder_profiler.llr2bit); reset_meas(&decoder_profiler.llr2bit);
//reset_meas(&decoder_profiler.total); //reset_meas(&decoder_profiler.total);
// Allocate LDPC decoder buffers for (int j=0;j<MAX_NUM_DLSCH_SEGMENTS;j++) {
p_nrLDPC_procBuf = nrLDPC_init_mem(); for (int i=0; i<block_length/8; i++) {
for (j=0;j<MAX_NUM_DLSCH_SEGMENTS;j++) {
for (i=0; i<block_length/8; i++) {
test_input[j][i]=(unsigned char) rand(); test_input[j][i]=(unsigned char) rand();
//test_input[j][i]=j%256; //test_input[j][i]=j%256;
//test_input[j][i]=252; //test_input[j][i]=252;
...@@ -272,17 +269,17 @@ int test_ldpc(short No_iteration, ...@@ -272,17 +269,17 @@ int test_ldpc(short No_iteration,
// printf("puncture:%d\n",no_punctured_columns); // printf("puncture:%d\n",no_punctured_columns);
removed_bit=(nrows-no_punctured_columns-2) * Zc+block_length-(int)(block_length/((float)nom_rate/(float)denom_rate)); removed_bit=(nrows-no_punctured_columns-2) * Zc+block_length-(int)(block_length/((float)nom_rate/(float)denom_rate));
encoder_implemparams_t impp=INIT0_LDPCIMPLEMPARAMS; encoder_implemparams_t impp=INIT0_LDPCIMPLEMPARAMS;
impp.gen_code=1; impp.gen_code=1;
if (ntrials==0) if (ntrials==0)
encoder_orig(test_input,channel_input, Zc, BG, block_length, BG, &impp); encoder_orig(test_input,channel_input, Zc, BG, block_length, BG, &impp);
impp.gen_code=0; impp.gen_code=0;
for (trial=0; trial < ntrials; trial++) for (int trial=0; trial < ntrials; trial++)
{ {
segment_bler = 0; segment_bler = 0;
//// encoder //// encoder
start_meas(&time); start_meas(&time);
for(j=0;j<n_segments;j++) { for(int j=0;j<n_segments;j++) {
encoder_orig(&(test_input[j]), &(channel_input[j]),Zc,Kb,block_length,BG,&impp); encoder_orig(&(test_input[j]), &(channel_input[j]),Zc,Kb,block_length,BG,&impp);
} }
stop_meas(&time); stop_meas(&time);
...@@ -294,7 +291,7 @@ int test_ldpc(short No_iteration, ...@@ -294,7 +291,7 @@ int test_ldpc(short No_iteration,
} }
stop_meas(time_optim);*/ stop_meas(time_optim);*/
impp.n_segments=n_segments; impp.n_segments=n_segments;
for(j=0;j<(n_segments/8+1);j++) { for(int j=0;j<(n_segments/8+1);j++) {
start_meas(time_optim); start_meas(time_optim);
impp.macro_num=j; impp.macro_num=j;
nrLDPC_encoder(test_input,channel_input_optim,Zc,Kb,block_length, BG, &impp); nrLDPC_encoder(test_input,channel_input_optim,Zc,Kb,block_length, BG, &impp);
...@@ -302,8 +299,8 @@ int test_ldpc(short No_iteration, ...@@ -302,8 +299,8 @@ int test_ldpc(short No_iteration,
} }
if (ntrials==1) if (ntrials==1)
for (j=0;j<n_segments;j++) for (int j=0;j<n_segments;j++)
for (i = 0; i < block_length+(nrows-no_punctured_columns) * Zc - removed_bit; i++) for (int i = 0; i < block_length+(nrows-no_punctured_columns) * Zc - removed_bit; i++)
if (channel_input[j][i]!=channel_input_optim[j][i]) { if (channel_input[j][i]!=channel_input_optim[j][i]) {
printf("differ in seg %u pos %u (%u,%u)\n", j, i, channel_input[j][i], channel_input_optim[j][i]); printf("differ in seg %u pos %u (%u,%u)\n", j, i, channel_input[j][i], channel_input_optim[j][i]);
return (-1); return (-1);
...@@ -319,92 +316,60 @@ int test_ldpc(short No_iteration, ...@@ -319,92 +316,60 @@ int test_ldpc(short No_iteration,
printf("number of undecoded bits: %d\n", (Kb+nrows-no_punctured_columns-2) * Zc-removed_bit); printf("number of undecoded bits: %d\n", (Kb+nrows-no_punctured_columns-2) * Zc-removed_bit);
} }
//print_meas_now(&time, "", stdout);
// for (i=0;i<6400;i++)
//printf("channel_input[%d]=%d\n",i,channel_input[i]);
//printf("%d ",channel_input[i]);
//if ((BG==2) && (Zc==128||Zc==256))
if (1) { // Transmitting one segment if (1) { // Transmitting one segment
for(j=0;j<n_segments;j++) { for(int j=0;j<n_segments;j++) {
for (i = 2*Zc; i < (Kb+nrows-no_punctured_columns) * Zc-removed_bit; i++) { for (int i = 2*Zc; i < (Kb+nrows-no_punctured_columns) * Zc-removed_bit; i++) {
#ifdef DEBUG_CODER #ifdef DEBUG_CODER
if ((i&0xf)==0) if ((i&0xf)==0)
printf("\ne %u..%u: ",i,i+15); printf("\ne %u..%u: ",i,i+15);
#endif #endif
if (channel_input_optim[j][i-2*Zc]==0) if (channel_input_optim[j][i-2*Zc]==0)
modulated_input[j][i]=1.0;///sqrt(2); //QPSK modulated_input[j][i]=1.0;///sqrt(2); //QPSK
else else
modulated_input[j][i]=-1.0;///sqrt(2); modulated_input[j][i]=-1.0;///sqrt(2);
///channel_output[i] = modulated_input[i] + gaussdouble(0.0,1.0) * 1/sqrt(2*SNR);
//channel_output_fixed[i] = (char) ((channel_output[i]*128)<0?(channel_output[i]*128-0.5):(channel_output[i]*128+0.5)); //fixed point 9-7
//printf("llr[%d]=%d\n",i,channel_output_fixed[i]);
//channel_output_fixed[i] = (char)quantize(sigma/4.0,(2.0*modulated_input[i]) - 1.0 + sigma*gaussdouble(0.0,1.0),qbits);
channel_output_fixed[j][i] = (char)quantize(sigma/4.0/4.0,modulated_input[j][i] + sigma*gaussdouble(0.0,1.0),qbits);
//channel_output_fixed[i] = (char)quantize8bit(sigma/4.0,(2.0*modulated_input[i]) - 1.0 + sigma*gaussdouble(0.0,1.0));
//printf("llr[%d]=%d\n",i,channel_output_fixed[i]);
//printf("channel_output_fixed[%d]: %d\n",i,channel_output_fixed[i]);
///channel_output[i] = modulated_input[i] + gaussdouble(0.0,1.0) * 1/sqrt(2*SNR);
//channel_output_fixed[i] = (char) ((channel_output[i]*128)<0?(channel_output[i]*128-0.5):(channel_output[i]*128+0.5)); //fixed point 9-7
//printf("llr[%d]=%d\n",i,channel_output_fixed[i]);
//channel_output_fixed[i] = (char)quantize(1,channel_output_fixed[i],qbits); //channel_output_fixed[i] = (char)quantize(sigma/4.0,(2.0*modulated_input[i]) - 1.0 + sigma*gaussdouble(0.0,1.0),qbits);
channel_output_fixed[j][i] = (char)quantize(sigma/4.0/4.0,modulated_input[j][i] + sigma*gaussdouble(0.0,1.0),qbits);
//channel_output_fixed[i] = (char)quantize8bit(sigma/4.0,(2.0*modulated_input[i]) - 1.0 + sigma*gaussdouble(0.0,1.0));
//printf("llr[%d]=%d\n",i,channel_output_fixed[i]);
//printf("channel_output_fixed[%d]: %d\n",i,channel_output_fixed[i]);
//Uncoded BER
unsigned char channel_output_uncoded = channel_output_fixed[j][i]<0 ? 1 /* QPSK demod */ : 0;
if (channel_output_uncoded != channel_input_optim[j][i-2*Zc]) //Uncoded BER
*errors_bit_uncoded = (*errors_bit_uncoded) + 1; unsigned char channel_output_uncoded = channel_output_fixed[j][i]<0 ? 1 /* QPSK demod */ : 0;
} if (channel_output_uncoded != channel_input_optim[j][i-2*Zc])
} // End segments *errors_bit_uncoded = (*errors_bit_uncoded) + 1;
//for (i=(Kb+nrows) * Zc-5;i<(Kb+nrows) * Zc;i++) }
//{
// printf("channel_input[%d]=%d\n",i,channel_input[i]);
//printf("%lf %d\n",channel_output[i], channel_output_fixed[i]);
//printf("v[%d]=%lf\n",i,modulated_input[i]);}
#ifdef DEBUG_CODER #ifdef DEBUG_CODER
printf("\n"); printf("\n");
exit(-1); exit(-1);
#endif #endif
decParams.BG=BG; decParams[j].BG=BG;
decParams.Z=Zc; decParams[j].Z=Zc;
decParams.R=code_rate_vec[R_ind];//13; decParams[j].R=code_rate_vec[R_ind];//13;
decParams.numMaxIter=No_iteration; decParams[j].numMaxIter=max_iterations;
decParams.outMode = nrLDPC_outMode_BIT; decParams[j].outMode = nrLDPC_outMode_BIT;
decParams.block_length=block_length; decParams[j].block_length=block_length;
//decParams.outMode =nrLDPC_outMode_LLRINT8; nrLDPC_initcall(&decParams[j], (int8_t*)channel_output_fixed[j], (int8_t*)estimated_output[j]);
nrLDPC_initcall(&decParams, (int8_t*)channel_output_fixed[j], (int8_t*)estimated_output[j]);
for(j=0;j<n_segments;j++) {
start_meas(time_decoder);
n_iter = nrLDPC_decoder(&decParams, (int8_t*)channel_output_fixed[j], (int8_t*)estimated_output[j], p_nrLDPC_procBuf, p_decoder_profiler);
stop_meas(time_decoder);
} }
for(int j=0;j<n_segments;j++) {
//for (i=(Kb+nrows) * Zc-5;i<(Kb+nrows) * Zc;i++) start_meas(time_decoder);
// printf("esimated_output[%d]=%d\n",i,esimated_output[i]); n_iter = nrLDPC_decoder(&decParams[j], (int8_t*)channel_output_fixed[j], (int8_t*)estimated_output[j], &decoder_profiler);
stop_meas(time_decoder);
//count errors //count errors
for(j=0;j<n_segments;j++) { if ( memcmp(estimated_output[j], test_input[j], block_length/8 ) != 0 ) {
for (i=0; i<block_length>>3; i++) segment_bler++;
{
//printf("block_length>>3: %d \n",block_length>>3);
/// printf("i: %d \n",i);
///printf("estimated_output[%d]: %d \n",i,estimated_output[i]);
///printf("test_input[0][%d]: %d \n",i,test_input[0][i]);
if (estimated_output[j][i] != test_input[j][i])
{
//////printf("error pos %d (%d, %d)\n\n",i,estimated_output[i],test_input[0][i]);
segment_bler = segment_bler + 1;
break;
} }
} for (int i=0; i<block_length; i++)
for (i=0; i<block_length; i++)
{ {
unsigned char estoutputbit = (estimated_output[j][i/8]&(1<<(i&7)))>>(i&7); unsigned char estoutputbit = (estimated_output[j][i/8]&(1<<(i&7)))>>(i&7);
unsigned char inputbit = (test_input[j][i/8]&(1<<(i&7)))>>(i&7); // Further correct for multiple segments unsigned char inputbit = (test_input[j][i/8]&(1<<(i&7)))>>(i&7); // Further correct for multiple segments
...@@ -412,40 +377,33 @@ int test_ldpc(short No_iteration, ...@@ -412,40 +377,33 @@ int test_ldpc(short No_iteration,
*errors_bit = (*errors_bit) + 1; *errors_bit = (*errors_bit) + 1;
} }
//if (*errors == 1000) n_iter_mean += n_iter;
//break; n_iter_std += pow(n_iter-1,2);
n_iter_mean = n_iter_mean + n_iter;
n_iter_std = n_iter_std + pow(n_iter-1,2);
if ( n_iter > n_iter_max ) if ( n_iter > n_iter_max )
n_iter_max = n_iter; n_iter_max = n_iter;
} // end segments } // end segments
if (segment_bler != 0) if (segment_bler != 0)
*errors = (*errors) + 1; *errors = (*errors) + 1;
} }
/*else if (trial==0)
printf("decoder is not supported\n");*/
} }
dec_iter->n_iter_mean = n_iter_mean/(double)ntrials/(double)n_segments - 1; dec_iter->n_iter_mean[nsnr] = n_iter_mean/(double)ntrials/(double)n_segments - 1;
dec_iter->n_iter_std = sqrt(n_iter_std/(double)ntrials/(double)n_segments - pow(n_iter_mean/(double)ntrials/(double)n_segments - 1,2)); dec_iter->n_iter_std[nsnr] = sqrt(n_iter_std/(double)ntrials/(double)n_segments - pow(n_iter_mean/(double)ntrials/(double)n_segments - 1,2));
dec_iter->n_iter_max = n_iter_max -1; dec_iter->n_iter_max[nsnr] = n_iter_max -1;
*errors_bit_uncoded = *errors_bit_uncoded / (double)((Kb+nrows-no_punctured_columns-2) * Zc-removed_bit); *errors_bit_uncoded = *errors_bit_uncoded / (double)((Kb+nrows-no_punctured_columns-2) * Zc-removed_bit);
for(j=0;j<MAX_NUM_DLSCH_SEGMENTS;j++) { for(int j=0;j<MAX_NUM_DLSCH_SEGMENTS;j++) {
free(test_input[j]); free(test_input[j]);
free(channel_input[j]); free(channel_input[j]);
free(channel_input_optim[j]); free(channel_input_optim[j]);
} }
nrLDPC_free_mem(p_nrLDPC_procBuf);
print_meas(&time,"ldpc_encoder",NULL,NULL); print_meas(&time,"ldpc_encoder",NULL,NULL);
print_meas(time_optim,"ldpc_encoder_optim",NULL,NULL); print_meas(time_optim,"ldpc_encoder_optim",NULL,NULL);
print_meas(&tinput,"ldpc_encoder_optim(input)",NULL,NULL); print_meas(&tinput,"ldpc_encoder_optim(input)",NULL,NULL);
...@@ -476,7 +434,7 @@ int main(int argc, char *argv[]) ...@@ -476,7 +434,7 @@ int main(int argc, char *argv[])
double errors_bit_uncoded; double errors_bit_uncoded;
short block_length=8448; // decoder supports length: 1201 -> 1280, 2401 -> 2560 short block_length=8448; // decoder supports length: 1201 -> 1280, 2401 -> 2560
char *ldpc_version=NULL; /* version of the ldpc decoder library to use (XXX suffix to use when loading libldpc_XXX.so */ char *ldpc_version=NULL; /* version of the ldpc decoder library to use (XXX suffix to use when loading libldpc_XXX.so */
short No_iteration=5; short max_iterations=5;
int n_segments=1; int n_segments=1;
//double rate=0.333; //double rate=0.333;
...@@ -486,7 +444,7 @@ int main(int argc, char *argv[]) ...@@ -486,7 +444,7 @@ int main(int argc, char *argv[])
unsigned char qbits=8; unsigned char qbits=8;
unsigned int decoded_errors[10000]; // initiate the size of matrix equivalent to size of SNR unsigned int decoded_errors[10000]; // initiate the size of matrix equivalent to size of SNR
int c,i=0, i1 = 0; int c,i=0, i1 = 0;
int loglvl=OAILOG_WARNING;
int n_trials = 1; int n_trials = 1;
double SNR_step = 0.1; double SNR_step = 0.1;
...@@ -494,14 +452,11 @@ int main(int argc, char *argv[]) ...@@ -494,14 +452,11 @@ int main(int argc, char *argv[])
int test_uncoded= 0; int test_uncoded= 0;
time_stats_t time_optim[10], time_decoder[10]; time_stats_t time_optim[10], time_decoder[10];
n_iter_stats_t dec_iter[3]; n_iter_stats_t dec_iter;
short BG=0,Zc,Kb=0; short BG=0,Zc,Kb=0;
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0) {
exit_fun(" Error, configuration module init failed\n"); while ((c = getopt (argc, argv, "q:r:s:S:l:G:n:d:i:t:u:hv:")) != -1)
} // must be done before specific options parsing to prevent errasing them
while ((c = getopt (argc, argv, "q:r:s:S:l:L:G:n:d:i:t:u:hv:")) != -1)
switch (c) switch (c)
{ {
case 'q': case 'q':
...@@ -519,10 +474,6 @@ int main(int argc, char *argv[]) ...@@ -519,10 +474,6 @@ int main(int argc, char *argv[])
case 'l': case 'l':
block_length = atoi(optarg); block_length = atoi(optarg);
break; break;
case 'L':
loglvl = atoi(optarg);
break;
case 'G': case 'G':
ldpc_version="_cuda"; ldpc_version="_cuda";
...@@ -545,7 +496,7 @@ int main(int argc, char *argv[]) ...@@ -545,7 +496,7 @@ int main(int argc, char *argv[])
break; break;
case 'i': case 'i':
No_iteration = atoi(optarg); max_iterations = atoi(optarg);
break; break;
case 'u': case 'u':
...@@ -560,11 +511,10 @@ int main(int argc, char *argv[]) ...@@ -560,11 +511,10 @@ int main(int argc, char *argv[])
printf("BG1 (blocklength > 3840): 1/3, 2/3, 22/25 (8/9) \n"); printf("BG1 (blocklength > 3840): 1/3, 2/3, 22/25 (8/9) \n");
printf("BG2 (blocklength <= 3840): 1/5, 1/3, 2/3 \n\n"); printf("BG2 (blocklength <= 3840): 1/5, 1/3, 2/3 \n\n");
printf("-h This message\n"); printf("-h This message\n");
printf("-L <log level, 0(errors), 1(warning), 2(info) 3(debug) 4 (trace)>\n");
printf("-q Quantization bits, Default: 8\n"); printf("-q Quantization bits, Default: 8\n");
printf("-r Nominator rate, (1, 2, 22), Default: 1\n"); printf("-r Nominator rate, (1, 2, 22), Default: 1\n");
printf("-d Denominator rate, (3, 5, 25), Default: 1\n"); printf("-d Denominator rate, (3, 5, 25), Default: 1\n");
printf("-l Block length (l > 3840 -> BG1, rest BG2 ), Default: 8448\n"); printf("-l Block length (l > 3840 -> BG1, rest BG2 ), Default: 8448\n");
printf("-G give 1 to run cuda for LDPC, Default: 0\n"); printf("-G give 1 to run cuda for LDPC, Default: 0\n");
printf("-n Number of simulation trials, Default: 1\n"); printf("-n Number of simulation trials, Default: 1\n");
//printf("-M MCS2 for TB 2\n"); //printf("-M MCS2 for TB 2\n");
...@@ -583,8 +533,6 @@ int main(int argc, char *argv[]) ...@@ -583,8 +533,6 @@ int main(int argc, char *argv[])
printf("n_trials %d: \n", n_trials); printf("n_trials %d: \n", n_trials);
printf("SNR0 %f: \n", SNR0); printf("SNR0 %f: \n", SNR0);
logInit();
set_glog(loglvl);
if (ldpc_version != NULL) if (ldpc_version != NULL)
load_nrLDPClib(ldpc_version); load_nrLDPClib(ldpc_version);
...@@ -632,7 +580,7 @@ int main(int argc, char *argv[]) ...@@ -632,7 +580,7 @@ int main(int argc, char *argv[])
} }
char fname[200]; char fname[200];
sprintf(fname,"ldpctest_BG_%d_Zc_%d_rate_%d-%d_block_length_%d_maxit_%d.txt",BG,Zc,nom_rate,denom_rate,block_length, No_iteration); sprintf(fname,"ldpctest_BG_%d_Zc_%d_rate_%d-%d_block_length_%d_maxit_%d.txt",BG,Zc,nom_rate,denom_rate,block_length, max_iterations);
FILE *fd=fopen(fname,"w"); FILE *fd=fopen(fname,"w");
AssertFatal(fd!=NULL,"cannot open %s\n",fname); AssertFatal(fd!=NULL,"cannot open %s\n",fname);
...@@ -647,7 +595,7 @@ int main(int argc, char *argv[]) ...@@ -647,7 +595,7 @@ int main(int argc, char *argv[])
else else
SNR_lin = pow(10,SNR/10.0)*nom_rate/denom_rate; SNR_lin = pow(10,SNR/10.0)*nom_rate/denom_rate;
printf("Linear SNR: %f\n", SNR_lin); printf("Linear SNR: %f\n", SNR_lin);
decoded_errors[i]=test_ldpc(No_iteration, decoded_errors[i]=test_ldpc(max_iterations,
nom_rate, nom_rate,
denom_rate, denom_rate,
SNR_lin, // noise standard deviation SNR_lin, // noise standard deviation
...@@ -661,14 +609,18 @@ int main(int argc, char *argv[]) ...@@ -661,14 +609,18 @@ int main(int argc, char *argv[])
&crc_misses, &crc_misses,
time_optim, time_optim,
time_decoder, time_decoder,
dec_iter); &dec_iter,
i);
printf("SNR %f, BLER %f (%u/%d)\n", SNR, (float)decoded_errors[i]/(float)n_trials, decoded_errors[i], n_trials);
printf("SNR %f, BER %f (%u/%d)\n", SNR, (float)errors_bit/(float)n_trials/(float)block_length/(double)n_segments, decoded_errors[i], n_trials); dec_iter.snr[i] = SNR;
dec_iter.ber[i] = (float)errors_bit/(float)n_trials/(float)block_length/(double)n_segments;
dec_iter.bler[i] = (float)decoded_errors[i]/(float)n_trials;
printf("SNR %f, BLER %f (%u/%d)\n", SNR, dec_iter.bler[i], decoded_errors[i], n_trials);
printf("SNR %f, BER %f (%u/%d)\n", SNR, dec_iter.ber[i], decoded_errors[i], n_trials);
printf("SNR %f, Uncoded BER %f (%u/%d)\n",SNR, errors_bit_uncoded/(float)n_trials/(double)n_segments, decoded_errors[i], n_trials); printf("SNR %f, Uncoded BER %f (%u/%d)\n",SNR, errors_bit_uncoded/(float)n_trials/(double)n_segments, decoded_errors[i], n_trials);
printf("SNR %f, Mean iterations: %f\n",SNR, dec_iter->n_iter_mean); printf("SNR %f, Mean iterations: %f\n",SNR, dec_iter.n_iter_mean[i]);
printf("SNR %f, Std iterations: %f\n",SNR, dec_iter->n_iter_std); printf("SNR %f, Std iterations: %f\n",SNR, dec_iter.n_iter_std[i]);
printf("SNR %f, Max iterations: %d\n",SNR, dec_iter->n_iter_max); printf("SNR %f, Max iterations: %d\n",SNR, dec_iter.n_iter_max[i]);
printf("\n"); printf("\n");
printf("Encoding time mean: %15.3f us\n",(double)time_optim->diff/time_optim->trials/1000.0/get_cpu_freq_GHz()); printf("Encoding time mean: %15.3f us\n",(double)time_optim->diff/time_optim->trials/1000.0/get_cpu_freq_GHz());
printf("Encoding time std: %15.3f us\n",sqrt((double)time_optim->diff_square/time_optim->trials/pow(1000,2)/pow(get_cpu_freq_GHz(),2)-pow((double)time_optim->diff/time_optim->trials/1000.0/get_cpu_freq_GHz(),2))); printf("Encoding time std: %15.3f us\n",sqrt((double)time_optim->diff_square/time_optim->trials/pow(1000,2)/pow(get_cpu_freq_GHz(),2)-pow((double)time_optim->diff/time_optim->trials/1000.0/get_cpu_freq_GHz(),2)));
...@@ -689,16 +641,20 @@ int main(int argc, char *argv[]) ...@@ -689,16 +641,20 @@ 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, dec_iter.n_iter_mean[i],
dec_iter->n_iter_std, dec_iter.n_iter_std[i],
dec_iter->n_iter_max dec_iter.n_iter_max[i]
); );
if (decoded_errors[i] == 0) break;
i=i+1; i=i+1;
if (decoded_errors[i-1] == 0) break;
} }
fclose(fd); fclose(fd);
LOG_M("ldpctestStats.m","SNR",&dec_iter.snr[0],i,1,7);
LOG_MM("ldpctestStats.m","BLER",&dec_iter.bler[0],i,1,7);
LOG_MM("ldpctestStats.m","BER",&dec_iter.ber[0],i,1,7);
LOG_MM("ldpctestStats.m","meanIter",&dec_iter.n_iter_mean[0],i,1,7);
loader_reset(); loader_reset();
logTerm(); logTerm();
......
...@@ -37,17 +37,12 @@ ...@@ -37,17 +37,12 @@
\param p_lut Pointer to decoder LUTs \param p_lut Pointer to decoder LUTs
\param Z Lifting size \param Z Lifting size
*/ */
static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_procBuf, uint16_t Z) static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, int8_t* bnProcBuf, int8_t* bnProcBufRes, int8_t* llrProcBuf, int8_t* llrRes, uint16_t Z)
{ {
const uint8_t* lut_numBnInBnGroups = p_lut->numBnInBnGroups; const uint8_t* lut_numBnInBnGroups = p_lut->numBnInBnGroups;
const uint32_t* lut_startAddrBnGroups = p_lut->startAddrBnGroups; const uint32_t* lut_startAddrBnGroups = p_lut->startAddrBnGroups;
const uint16_t* lut_startAddrBnGroupsLlr = p_lut->startAddrBnGroupsLlr; const uint16_t* lut_startAddrBnGroupsLlr = p_lut->startAddrBnGroupsLlr;
int8_t* bnProcBuf = p_procBuf->bnProcBuf;
int8_t* bnProcBufRes = p_procBuf->bnProcBufRes;
int8_t* llrRes = p_procBuf->llrRes;
int8_t* llrProcBuf = p_procBuf->llrProcBuf;
__m128i* p_bnProcBuf; __m128i* p_bnProcBuf;
__m256i* p_bnProcBufRes; __m256i* p_bnProcBufRes;
__m128i* p_llrProcBuf; __m128i* p_llrProcBuf;
...@@ -1681,7 +1676,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc ...@@ -1681,7 +1676,7 @@ static inline void nrLDPC_bnProcPc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_proc
\param p_lut Pointer to decoder LUTs \param p_lut Pointer to decoder LUTs
\param Z Lifting size \param Z Lifting size
*/ */
static inline void nrLDPC_bnProc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_procBuf, uint16_t Z) static inline void nrLDPC_bnProc(t_nrLDPC_lut* p_lut, int8_t* bnProcBuf, int8_t* bnProcBufRes, int8_t* llrRes, uint16_t Z)
{ {
// BN Processing calculating the values to send back to the CNs for next iteration // BN Processing calculating the values to send back to the CNs for next iteration
// bnProcBufRes contains the sum of all edges to each BN at the start of each group // bnProcBufRes contains the sum of all edges to each BN at the start of each group
...@@ -1690,10 +1685,6 @@ static inline void nrLDPC_bnProc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_procBu ...@@ -1690,10 +1685,6 @@ static inline void nrLDPC_bnProc(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_procBu
const uint32_t* lut_startAddrBnGroups = p_lut->startAddrBnGroups; const uint32_t* lut_startAddrBnGroups = p_lut->startAddrBnGroups;
const uint16_t* lut_startAddrBnGroupsLlr = p_lut->startAddrBnGroupsLlr; const uint16_t* lut_startAddrBnGroupsLlr = p_lut->startAddrBnGroupsLlr;
int8_t* bnProcBuf = p_procBuf->bnProcBuf;
int8_t* bnProcBufRes = p_procBuf->bnProcBufRes;
int8_t* llrRes = p_procBuf->llrRes;
__m256i* p_bnProcBuf; __m256i* p_bnProcBuf;
__m256i* p_bnProcBufRes; __m256i* p_bnProcBufRes;
__m256i* p_llrRes; __m256i* p_llrRes;
......
...@@ -37,14 +37,11 @@ ...@@ -37,14 +37,11 @@
\param p_procBuf Pointer to processing buffers \param p_procBuf Pointer to processing buffers
\param Z Lifting size \param Z Lifting size
*/ */
static inline void nrLDPC_cnProc_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_procBuf, uint16_t Z) static inline void nrLDPC_cnProc_BG2(t_nrLDPC_lut* p_lut, int8_t* cnProcBuf, int8_t* cnProcBufRes, uint16_t Z)
{ {
const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups; const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups;
const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups; const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups;
int8_t* cnProcBuf = p_procBuf->cnProcBuf;
int8_t* cnProcBufRes = p_procBuf->cnProcBufRes;
__m256i* p_cnProcBuf; __m256i* p_cnProcBuf;
__m256i* p_cnProcBufRes; __m256i* p_cnProcBufRes;
...@@ -372,14 +369,11 @@ static inline void nrLDPC_cnProc_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_pr ...@@ -372,14 +369,11 @@ static inline void nrLDPC_cnProc_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_pr
\param p_lut Pointer to decoder LUTs \param p_lut Pointer to decoder LUTs
\param Z Lifting size \param Z Lifting size
*/ */
static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_procBuf, uint16_t Z) static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBuf, int8_t* cnProcBufRes, uint16_t Z)
{ {
const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups; const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups;
const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups; const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups;
int8_t* cnProcBuf = p_procBuf->cnProcBuf;
int8_t* cnProcBufRes = p_procBuf->cnProcBufRes;
__m256i* p_cnProcBuf; __m256i* p_cnProcBuf;
__m256i* p_cnProcBufRes; __m256i* p_cnProcBufRes;
...@@ -871,14 +865,11 @@ static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_pr ...@@ -871,14 +865,11 @@ static inline void nrLDPC_cnProc_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_pr
\param Z Lifting size \param Z Lifting size
\return 32-bit parity check indicator \return 32-bit parity check indicator
*/ */
static inline uint32_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_procBuf, uint16_t Z) static inline uint32_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBuf, int8_t* cnProcBufRes, uint16_t Z)
{ {
const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups; const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups;
const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups; const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups;
int8_t* cnProcBuf = p_procBuf->cnProcBuf;
int8_t* cnProcBufRes = p_procBuf->cnProcBufRes;
__m256i* p_cnProcBuf; __m256i* p_cnProcBuf;
__m256i* p_cnProcBufRes; __m256i* p_cnProcBufRes;
...@@ -1506,14 +1497,11 @@ static inline uint32_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf ...@@ -1506,14 +1497,11 @@ static inline uint32_t nrLDPC_cnProcPc_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf
\param Z Lifting size \param Z Lifting size
\return 32-bit parity check indicator \return 32-bit parity check indicator
*/ */
static inline uint32_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_procBuf, uint16_t Z) static inline uint32_t nrLDPC_cnProcPc_BG2(t_nrLDPC_lut* p_lut, int8_t* cnProcBuf, int8_t* cnProcBufRes, uint16_t Z)
{ {
const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups; const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups;
const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups; const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups;
int8_t* cnProcBuf = p_procBuf->cnProcBuf;
int8_t* cnProcBufRes = p_procBuf->cnProcBufRes;
__m256i* p_cnProcBuf; __m256i* p_cnProcBuf;
__m256i* p_cnProcBufRes; __m256i* p_cnProcBufRes;
......
...@@ -45,22 +45,22 @@ ...@@ -45,22 +45,22 @@
#include "nrLDPC_tools/nrLDPC_debug.h" #include "nrLDPC_tools/nrLDPC_debug.h"
#endif #endif
static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDPC_procBuf* p_procBuf, uint32_t numLLR, t_nrLDPC_lut* p_lut, t_nrLDPC_dec_params* p_decParams, t_nrLDPC_time_stats* p_profiler); static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_t numLLR, t_nrLDPC_lut* p_lut, t_nrLDPC_dec_params* p_decParams, t_nrLDPC_time_stats* p_profiler);
int check_crc(uint8_t* decoded_bytes, uint32_t n, uint32_t F, uint8_t crc_type);
void nrLDPC_initcall(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out) { void nrLDPC_initcall(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out) {
} }
int32_t nrLDPC_decod(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out, t_nrLDPC_procBuf* p_procBuf, t_nrLDPC_time_stats* p_profiler) int32_t nrLDPC_decod(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out, t_nrLDPC_time_stats* p_profiler)
{ {
uint32_t numLLR; uint32_t numLLR;
uint32_t numIter = 0; uint32_t numIter = 0;
t_nrLDPC_lut lut; t_nrLDPC_lut lut;
t_nrLDPC_lut* p_lut = &lut; t_nrLDPC_lut* p_lut = &lut;
//printf("p_procBuf->cnProcBuf = %p\n", p_procBuf->cnProcBuf);
// Initialize decoder core(s) with correct LUTs // Initialize decoder core(s) with correct LUTs
numLLR = nrLDPC_init(p_decParams, p_lut); numLLR = nrLDPC_init(p_decParams, p_lut);
// Launch LDPC decoder core for one segment // Launch LDPC decoder core for one segment
numIter = nrLDPC_decoder_core(p_llr, p_out, p_procBuf, numLLR, p_lut, p_decParams, p_profiler); numIter = nrLDPC_decoder_core(p_llr, p_out, numLLR, p_lut, p_decParams, p_profiler);
return numIter; return numIter;
} }
...@@ -74,13 +74,20 @@ int32_t nrLDPC_decod(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_ ...@@ -74,13 +74,20 @@ int32_t nrLDPC_decod(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_
\param p_decParams LDPC decoder parameters \param p_decParams LDPC decoder parameters
\param p_profiler LDPC profiler statistics \param p_profiler LDPC profiler statistics
*/ */
static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDPC_procBuf* p_procBuf, uint32_t numLLR, t_nrLDPC_lut* p_lut, t_nrLDPC_dec_params* p_decParams, t_nrLDPC_time_stats* p_profiler) static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, uint32_t numLLR, t_nrLDPC_lut* p_lut, t_nrLDPC_dec_params* p_decParams, t_nrLDPC_time_stats* p_profiler)
{ {
uint16_t Z = p_decParams->Z; uint16_t Z = p_decParams->Z;
uint8_t BG = p_decParams->BG; uint8_t BG = p_decParams->BG;
uint8_t numMaxIter = p_decParams->numMaxIter; uint8_t numMaxIter = p_decParams->numMaxIter;
e_nrLDPC_outMode outMode = p_decParams->outMode; e_nrLDPC_outMode outMode = p_decParams->outMode;
int8_t cnProcBuf[NR_LDPC_SIZE_CN_PROC_BUF] __attribute__ ((aligned(32))) = {0};
int8_t cnProcBufRes[NR_LDPC_SIZE_CN_PROC_BUF] __attribute__ ((aligned(32))) = {0};
int8_t bnProcBuf[NR_LDPC_SIZE_BN_PROC_BUF] __attribute__ ((aligned(32))) = {0};
int8_t bnProcBufRes[NR_LDPC_SIZE_BN_PROC_BUF] __attribute__ ((aligned(32))) = {0};
int8_t llrRes[NR_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32))) = {0};
int8_t llrProcBuf[NR_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32))) = {0};
int8_t llrOut[NR_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32))) = {0};
// Minimum number of iterations is 1 // Minimum number of iterations is 1
// 0 iterations means hard-decision on input LLRs // 0 iterations means hard-decision on input LLRs
uint32_t i = 1; uint32_t i = 1;
...@@ -95,9 +102,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP ...@@ -95,9 +102,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP
else else
{ {
// Use LLR processing buffer as temporary output buffer // Use LLR processing buffer as temporary output buffer
p_llrOut = p_procBuf->llrProcBuf; p_llrOut = llrOut;
// Clear llrProcBuf
memset(p_llrOut,0, NR_LDPC_MAX_NUM_LLR*sizeof(int8_t));
} }
...@@ -105,14 +110,14 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP ...@@ -105,14 +110,14 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
start_meas(&p_profiler->llr2llrProcBuf); start_meas(&p_profiler->llr2llrProcBuf);
#endif #endif
nrLDPC_llr2llrProcBuf(p_lut, p_llr, p_procBuf, Z, BG); nrLDPC_llr2llrProcBuf(p_lut, p_llr, llrProcBuf, Z, BG);
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->llr2llrProcBuf); stop_meas(&p_profiler->llr2llrProcBuf);
#endif #endif
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_initBuffer2File(nrLDPC_buffers_LLR_PROC); nrLDPC_debug_initBuffer2File(nrLDPC_buffers_LLR_PROC);
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_LLR_PROC, p_procBuf); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_LLR_PROC, llrProcBuf);
#endif #endif
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
...@@ -120,11 +125,11 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP ...@@ -120,11 +125,11 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP
#endif #endif
if (BG == 1) if (BG == 1)
{ {
nrLDPC_llr2CnProcBuf_BG1(p_lut, p_llr, p_procBuf, Z); nrLDPC_llr2CnProcBuf_BG1(p_lut, p_llr, cnProcBuf, Z);
} }
else else
{ {
nrLDPC_llr2CnProcBuf_BG2(p_lut, p_llr, p_procBuf, Z); nrLDPC_llr2CnProcBuf_BG2(p_lut, p_llr, cnProcBuf, Z);
} }
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->llr2CnProcBuf); stop_meas(&p_profiler->llr2CnProcBuf);
...@@ -132,7 +137,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP ...@@ -132,7 +137,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_initBuffer2File(nrLDPC_buffers_CN_PROC); nrLDPC_debug_initBuffer2File(nrLDPC_buffers_CN_PROC);
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC, p_procBuf); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC, cnProcBuf);
#endif #endif
// First iteration // First iteration
...@@ -143,11 +148,11 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP ...@@ -143,11 +148,11 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP
#endif #endif
if (BG == 1) if (BG == 1)
{ {
nrLDPC_cnProc_BG1(p_lut, p_procBuf, Z); nrLDPC_cnProc_BG1(p_lut, cnProcBuf, cnProcBufRes, Z);
} }
else else
{ {
nrLDPC_cnProc_BG2(p_lut, p_procBuf, Z); nrLDPC_cnProc_BG2(p_lut, cnProcBuf, cnProcBufRes, Z);
} }
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->cnProc); stop_meas(&p_profiler->cnProc);
...@@ -155,7 +160,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP ...@@ -155,7 +160,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_initBuffer2File(nrLDPC_buffers_CN_PROC_RES); nrLDPC_debug_initBuffer2File(nrLDPC_buffers_CN_PROC_RES);
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC_RES, p_procBuf); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC_RES, cnProcBufRes);
#endif #endif
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
...@@ -163,11 +168,11 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP ...@@ -163,11 +168,11 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP
#endif #endif
if (BG == 1) if (BG == 1)
{ {
nrLDPC_cn2bnProcBuf_BG1(p_lut, p_procBuf, Z); nrLDPC_cn2bnProcBuf_BG1(p_lut, cnProcBufRes, bnProcBuf, Z);
} }
else else
{ {
nrLDPC_cn2bnProcBuf_BG2(p_lut, p_procBuf, Z); nrLDPC_cn2bnProcBuf_BG2(p_lut, cnProcBufRes, bnProcBuf, Z);
} }
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->cn2bnProcBuf); stop_meas(&p_profiler->cn2bnProcBuf);
...@@ -175,34 +180,34 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP ...@@ -175,34 +180,34 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_initBuffer2File(nrLDPC_buffers_BN_PROC); nrLDPC_debug_initBuffer2File(nrLDPC_buffers_BN_PROC);
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC, p_procBuf); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC, bnProcBuf);
#endif #endif
// BN processing // BN processing
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
start_meas(&p_profiler->bnProcPc); start_meas(&p_profiler->bnProcPc);
#endif #endif
nrLDPC_bnProcPc(p_lut, p_procBuf, Z); nrLDPC_bnProcPc(p_lut, bnProcBuf, bnProcBufRes, llrProcBuf, llrRes, Z);
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->bnProcPc); stop_meas(&p_profiler->bnProcPc);
#endif #endif
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_initBuffer2File(nrLDPC_buffers_LLR_RES); nrLDPC_debug_initBuffer2File(nrLDPC_buffers_LLR_RES);
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_LLR_RES, p_procBuf); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_LLR_RES, llrRes);
#endif #endif
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
start_meas(&p_profiler->bnProc); start_meas(&p_profiler->bnProc);
#endif #endif
nrLDPC_bnProc(p_lut, p_procBuf, Z); nrLDPC_bnProc(p_lut, bnProcBuf, bnProcBufRes, llrRes, Z);
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->bnProc); stop_meas(&p_profiler->bnProc);
#endif #endif
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_initBuffer2File(nrLDPC_buffers_BN_PROC_RES); nrLDPC_debug_initBuffer2File(nrLDPC_buffers_BN_PROC_RES);
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC_RES, p_procBuf); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC_RES, bnProcBufRes);
#endif #endif
// BN results to CN processing buffer // BN results to CN processing buffer
...@@ -211,18 +216,18 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP ...@@ -211,18 +216,18 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP
#endif #endif
if (BG == 1) if (BG == 1)
{ {
nrLDPC_bn2cnProcBuf_BG1(p_lut, p_procBuf, Z); nrLDPC_bn2cnProcBuf_BG1(p_lut, bnProcBufRes, cnProcBuf, Z);
} }
else else
{ {
nrLDPC_bn2cnProcBuf_BG2(p_lut, p_procBuf, Z); nrLDPC_bn2cnProcBuf_BG2(p_lut, bnProcBufRes, cnProcBuf, Z);
} }
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->bn2cnProcBuf); stop_meas(&p_profiler->bn2cnProcBuf);
#endif #endif
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC, p_procBuf); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC, cnProcBuf);
#endif #endif
// Parity Check not necessary here since it will fail // Parity Check not necessary here since it will fail
...@@ -242,18 +247,18 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP ...@@ -242,18 +247,18 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP
#endif #endif
if (BG == 1) if (BG == 1)
{ {
nrLDPC_cnProc_BG1(p_lut, p_procBuf, Z); nrLDPC_cnProc_BG1(p_lut, cnProcBuf, cnProcBufRes, Z);
} }
else else
{ {
nrLDPC_cnProc_BG2(p_lut, p_procBuf, Z); nrLDPC_cnProc_BG2(p_lut, cnProcBuf, cnProcBufRes, Z);
} }
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->cnProc); stop_meas(&p_profiler->cnProc);
#endif #endif
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC_RES, p_procBuf); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC_RES, cnProcBufRes);
#endif #endif
// Send CN results back to BNs // Send CN results back to BNs
...@@ -262,43 +267,43 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP ...@@ -262,43 +267,43 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP
#endif #endif
if (BG == 1) if (BG == 1)
{ {
nrLDPC_cn2bnProcBuf_BG1(p_lut, p_procBuf, Z); nrLDPC_cn2bnProcBuf_BG1(p_lut, cnProcBufRes, bnProcBuf, Z);
} }
else else
{ {
nrLDPC_cn2bnProcBuf_BG2(p_lut, p_procBuf, Z); nrLDPC_cn2bnProcBuf_BG2(p_lut, cnProcBufRes, bnProcBuf, Z);
} }
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->cn2bnProcBuf); stop_meas(&p_profiler->cn2bnProcBuf);
#endif #endif
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC, p_procBuf); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC, bnProcBuf);
#endif #endif
// BN Processing // BN Processing
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
start_meas(&p_profiler->bnProcPc); start_meas(&p_profiler->bnProcPc);
#endif #endif
nrLDPC_bnProcPc(p_lut, p_procBuf, Z); nrLDPC_bnProcPc(p_lut, bnProcBuf, bnProcBufRes, llrProcBuf, llrRes, Z);
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->bnProcPc); stop_meas(&p_profiler->bnProcPc);
#endif #endif
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_LLR_RES, p_procBuf); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_LLR_RES, llrRes);
#endif #endif
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
start_meas(&p_profiler->bnProc); start_meas(&p_profiler->bnProc);
#endif #endif
nrLDPC_bnProc(p_lut, p_procBuf, Z); nrLDPC_bnProc(p_lut, bnProcBuf, bnProcBufRes, llrRes, Z);
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->bnProc); stop_meas(&p_profiler->bnProc);
#endif #endif
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC_RES, p_procBuf); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC_RES, bnProcBufRes);
#endif #endif
// BN results to CN processing buffer // BN results to CN processing buffer
...@@ -307,18 +312,18 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP ...@@ -307,18 +312,18 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP
#endif #endif
if (BG == 1) if (BG == 1)
{ {
nrLDPC_bn2cnProcBuf_BG1(p_lut, p_procBuf, Z); nrLDPC_bn2cnProcBuf_BG1(p_lut, bnProcBufRes, cnProcBuf, Z);
} }
else else
{ {
nrLDPC_bn2cnProcBuf_BG2(p_lut, p_procBuf, Z); nrLDPC_bn2cnProcBuf_BG2(p_lut, bnProcBufRes, cnProcBuf, Z);
} }
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->bn2cnProcBuf); stop_meas(&p_profiler->bn2cnProcBuf);
#endif #endif
#ifdef NR_LDPC_DEBUG_MODE #ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC, p_procBuf); nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC, cnProcBuf);
#endif #endif
// Parity Check // Parity Check
...@@ -328,123 +333,11 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP ...@@ -328,123 +333,11 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP
#endif #endif
if (BG == 1) if (BG == 1)
{ {
pcRes = nrLDPC_cnProcPc_BG1(p_lut, p_procBuf, Z); pcRes = nrLDPC_cnProcPc_BG1(p_lut, cnProcBuf, cnProcBufRes, Z);
} }
else else
{ {
pcRes = nrLDPC_cnProcPc_BG2(p_lut, p_procBuf, Z); pcRes = nrLDPC_cnProcPc_BG2(p_lut, cnProcBuf, cnProcBufRes, Z);
}
#ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->cnProcPc);
#endif
#endif
}
// Last iteration
if ( (i < numMaxIter) && (pcRes != 0) )
{
// Increase iteration counter
i++;
// CN processing
#ifdef NR_LDPC_PROFILER_DETAIL
start_meas(&p_profiler->cnProc);
#endif
if (BG == 1)
{
nrLDPC_cnProc_BG1(p_lut, p_procBuf, Z);
}
else
{
nrLDPC_cnProc_BG2(p_lut, p_procBuf, Z);
}
#ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->cnProc);
#endif
#ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC_RES, p_procBuf);
#endif
// Send CN results back to BNs
#ifdef NR_LDPC_PROFILER_DETAIL
start_meas(&p_profiler->cn2bnProcBuf);
#endif
if (BG == 1)
{
nrLDPC_cn2bnProcBuf_BG1(p_lut, p_procBuf, Z);
}
else
{
nrLDPC_cn2bnProcBuf_BG2(p_lut, p_procBuf, Z);
}
#ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->cn2bnProcBuf);
#endif
#ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC, p_procBuf);
#endif
// BN Processing
#ifdef NR_LDPC_PROFILER_DETAIL
start_meas(&p_profiler->bnProcPc);
#endif
nrLDPC_bnProcPc(p_lut, p_procBuf, Z);
#ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->bnProcPc);
#endif
#ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_LLR_RES, p_procBuf);
#endif
// If parity check not enabled, no need to send the BN proc results
// back to CNs
#ifdef NR_LDPC_ENABLE_PARITY_CHECK
#ifdef NR_LDPC_PROFILER_DETAIL
start_meas(&p_profiler->bnProc);
#endif
nrLDPC_bnProc(p_lut, p_procBuf, Z);
#ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->bnProc);
#endif
#ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_BN_PROC_RES, p_procBuf);
#endif
// BN results to CN processing buffer
#ifdef NR_LDPC_PROFILER_DETAIL
start_meas(&p_profiler->bn2cnProcBuf);
#endif
if (BG == 1)
{
nrLDPC_bn2cnProcBuf_BG1(p_lut, p_procBuf, Z);
}
else
{
nrLDPC_bn2cnProcBuf_BG2(p_lut, p_procBuf, Z);
}
#ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->bn2cnProcBuf);
#endif
#ifdef NR_LDPC_DEBUG_MODE
nrLDPC_debug_writeBuffer2File(nrLDPC_buffers_CN_PROC, p_procBuf);
#endif
// Parity Check
#ifdef NR_LDPC_PROFILER_DETAIL
start_meas(&p_profiler->cnProcPc);
#endif
if (BG == 1)
{
pcRes = nrLDPC_cnProcPc_BG1(p_lut, p_procBuf, Z);
}
else
{
pcRes = nrLDPC_cnProcPc_BG2(p_lut, p_procBuf, Z);
} }
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->cnProcPc); stop_meas(&p_profiler->cnProcPc);
...@@ -466,7 +359,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP ...@@ -466,7 +359,7 @@ static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDP
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
start_meas(&p_profiler->llrRes2llrOut); start_meas(&p_profiler->llrRes2llrOut);
#endif #endif
nrLDPC_llrRes2llrOut(p_lut, p_llrOut, p_procBuf, Z, BG); nrLDPC_llrRes2llrOut(p_lut, p_llrOut, llrRes, Z, BG);
#ifdef NR_LDPC_PROFILER_DETAIL #ifdef NR_LDPC_PROFILER_DETAIL
stop_meas(&p_profiler->llrRes2llrOut); stop_meas(&p_profiler->llrRes2llrOut);
#endif #endif
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*!\file nrLDPC_init_mem.h
* \brief Defines the function to initialize the LDPC decoder and sets correct LUTs.
* \author Sebastian Wagner (TCL Communications) Email: <mailto:sebastian.wagner@tcl.com>
* \date 07-12-2018
* \version 1.0
* \note
* \warning
*/
#ifndef __NR_LDPC_INIT_MEM__H__
#define __NR_LDPC_INIT_MEM__H__
#include <stdlib.h>
#include "nrLDPC_types.h"
/**
\brief Allocates 32 byte aligned memory and initializes to zero
\param size Input size in bytes
\return Pointer to memory
*/
static inline void* malloc32_clear(size_t size)
{
void* ptr = (void*) memalign(32, size+32);
memset(ptr, 0, size);
return ptr;
}
/**
\brief Allocates and initializes the internal decoder processing buffers
\param p_decParams Pointer to decoder parameters
\param p_lut Pointer to decoder LUTs
\return Number of LLR values
*/
static inline t_nrLDPC_procBuf* nrLDPC_init_mem(void)
{
t_nrLDPC_procBuf* p_procBuf = (t_nrLDPC_procBuf*) malloc32_clear(sizeof(t_nrLDPC_procBuf));
if (p_procBuf)
{
p_procBuf->cnProcBuf = (int8_t*) malloc32_clear(NR_LDPC_SIZE_CN_PROC_BUF*sizeof(int8_t));
p_procBuf->cnProcBufRes = (int8_t*) malloc32_clear(NR_LDPC_SIZE_CN_PROC_BUF*sizeof(int8_t));
p_procBuf->bnProcBuf = (int8_t*) malloc32_clear(NR_LDPC_SIZE_BN_PROC_BUF*sizeof(int8_t));
p_procBuf->bnProcBufRes = (int8_t*) malloc32_clear(NR_LDPC_SIZE_BN_PROC_BUF*sizeof(int8_t));
p_procBuf->llrRes = (int8_t*) malloc32_clear(NR_LDPC_MAX_NUM_LLR *sizeof(int8_t));
p_procBuf->llrProcBuf = (int8_t*) malloc32_clear(NR_LDPC_MAX_NUM_LLR *sizeof(int8_t));
}
return(p_procBuf);
}
static inline void nrLDPC_free_mem(t_nrLDPC_procBuf* p_procBuf)
{
free(p_procBuf->cnProcBuf);
free(p_procBuf->cnProcBufRes);
free(p_procBuf->bnProcBuf);
free(p_procBuf->bnProcBufRes);
free(p_procBuf->llrRes);
free(p_procBuf->llrProcBuf);
free(p_procBuf);
}
#endif
...@@ -97,7 +97,7 @@ static inline void *nrLDPC_circ_memcpy(int8_t *str1, const int8_t *str2, uint16_ ...@@ -97,7 +97,7 @@ static inline void *nrLDPC_circ_memcpy(int8_t *str1, const int8_t *str2, uint16_
\param Z Lifting size \param Z Lifting size
\param BG Base graph \param BG Base graph
*/ */
static inline void nrLDPC_llr2llrProcBuf(t_nrLDPC_lut* p_lut, int8_t* llr, t_nrLDPC_procBuf* p_procBuf, uint16_t Z, uint8_t BG) static inline void nrLDPC_llr2llrProcBuf(t_nrLDPC_lut* p_lut, int8_t* llr, int8_t* llrProcBuf, uint16_t Z, uint8_t BG)
{ {
uint32_t i; uint32_t i;
const uint8_t numBn2CnG1 = p_lut->numBnInBnGroups[0]; const uint8_t numBn2CnG1 = p_lut->numBnInBnGroups[0];
...@@ -109,7 +109,6 @@ static inline void nrLDPC_llr2llrProcBuf(t_nrLDPC_lut* p_lut, int8_t* llr, t_nrL ...@@ -109,7 +109,6 @@ static inline void nrLDPC_llr2llrProcBuf(t_nrLDPC_lut* p_lut, int8_t* llr, t_nrL
const uint8_t* lut_llr2llrProcBufBnPos = p_lut->llr2llrProcBufBnPos; const uint8_t* lut_llr2llrProcBufBnPos = p_lut->llr2llrProcBufBnPos;
uint32_t idxBn; uint32_t idxBn;
int8_t* llrProcBuf = p_procBuf->llrProcBuf;
// Copy LLRs connected to 1 CN // Copy LLRs connected to 1 CN
if (numBn2CnG1 > 0) if (numBn2CnG1 > 0)
...@@ -133,7 +132,7 @@ static inline void nrLDPC_llr2llrProcBuf(t_nrLDPC_lut* p_lut, int8_t* llr, t_nrL ...@@ -133,7 +132,7 @@ static inline void nrLDPC_llr2llrProcBuf(t_nrLDPC_lut* p_lut, int8_t* llr, t_nrL
\param p_procBuf Pointer to the processing buffers \param p_procBuf Pointer to the processing buffers
\param Z Lifting size \param Z Lifting size
*/ */
static inline void nrLDPC_llr2CnProcBuf_BG1(t_nrLDPC_lut* p_lut, int8_t* llr, t_nrLDPC_procBuf* p_procBuf, uint16_t Z) static inline void nrLDPC_llr2CnProcBuf_BG1(t_nrLDPC_lut* p_lut, int8_t* llr, int8_t* cnProcBuf, uint16_t Z)
{ {
const uint16_t (*lut_circShift_CNG3) [lut_numCnInCnGroups_BG1_R13[0]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[0]]) p_lut->circShift[0]; const uint16_t (*lut_circShift_CNG3) [lut_numCnInCnGroups_BG1_R13[0]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[0]]) p_lut->circShift[0];
const uint16_t (*lut_circShift_CNG4) [lut_numCnInCnGroups_BG1_R13[1]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[1]]) p_lut->circShift[1]; const uint16_t (*lut_circShift_CNG4) [lut_numCnInCnGroups_BG1_R13[1]] = (const uint16_t(*)[lut_numCnInCnGroups_BG1_R13[1]]) p_lut->circShift[1];
...@@ -158,7 +157,6 @@ static inline void nrLDPC_llr2CnProcBuf_BG1(t_nrLDPC_lut* p_lut, int8_t* llr, t_ ...@@ -158,7 +157,6 @@ static inline void nrLDPC_llr2CnProcBuf_BG1(t_nrLDPC_lut* p_lut, int8_t* llr, t_
const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups; const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups;
const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups; const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups;
int8_t* cnProcBuf = p_procBuf->cnProcBuf;
uint32_t i; uint32_t i;
uint32_t j; uint32_t j;
...@@ -342,7 +340,7 @@ static inline void nrLDPC_llr2CnProcBuf_BG1(t_nrLDPC_lut* p_lut, int8_t* llr, t_ ...@@ -342,7 +340,7 @@ static inline void nrLDPC_llr2CnProcBuf_BG1(t_nrLDPC_lut* p_lut, int8_t* llr, t_
\param p_procBuf Pointer to the processing buffers \param p_procBuf Pointer to the processing buffers
\param Z Lifting size \param Z Lifting size
*/ */
static inline void nrLDPC_llr2CnProcBuf_BG2(t_nrLDPC_lut* p_lut, int8_t* llr, t_nrLDPC_procBuf* p_procBuf, uint16_t Z) static inline void nrLDPC_llr2CnProcBuf_BG2(t_nrLDPC_lut* p_lut, int8_t* llr, int8_t* cnProcBuf, uint16_t Z)
{ {
const uint16_t (*lut_circShift_CNG3) [lut_numCnInCnGroups_BG2_R15[0]] = (const uint16_t(*)[lut_numCnInCnGroups_BG2_R15[0]]) p_lut->circShift[0]; const uint16_t (*lut_circShift_CNG3) [lut_numCnInCnGroups_BG2_R15[0]] = (const uint16_t(*)[lut_numCnInCnGroups_BG2_R15[0]]) p_lut->circShift[0];
const uint16_t (*lut_circShift_CNG4) [lut_numCnInCnGroups_BG2_R15[1]] = (const uint16_t(*)[lut_numCnInCnGroups_BG2_R15[1]]) p_lut->circShift[1]; const uint16_t (*lut_circShift_CNG4) [lut_numCnInCnGroups_BG2_R15[1]] = (const uint16_t(*)[lut_numCnInCnGroups_BG2_R15[1]]) p_lut->circShift[1];
...@@ -361,7 +359,6 @@ static inline void nrLDPC_llr2CnProcBuf_BG2(t_nrLDPC_lut* p_lut, int8_t* llr, t_ ...@@ -361,7 +359,6 @@ static inline void nrLDPC_llr2CnProcBuf_BG2(t_nrLDPC_lut* p_lut, int8_t* llr, t_
const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups; const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups;
const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups; const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups;
int8_t* cnProcBuf = p_procBuf->cnProcBuf;
uint32_t i; uint32_t i;
uint32_t j; uint32_t j;
...@@ -478,7 +475,7 @@ static inline void nrLDPC_llr2CnProcBuf_BG2(t_nrLDPC_lut* p_lut, int8_t* llr, t_ ...@@ -478,7 +475,7 @@ static inline void nrLDPC_llr2CnProcBuf_BG2(t_nrLDPC_lut* p_lut, int8_t* llr, t_
\param p_procBuf Pointer to the processing buffers \param p_procBuf Pointer to the processing buffers
\param Z Lifting size \param Z Lifting size
*/ */
static inline void nrLDPC_cn2bnProcBuf_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_procBuf, uint16_t Z) static inline void nrLDPC_cn2bnProcBuf_BG2(t_nrLDPC_lut* p_lut, int8_t* cnProcBufRes, int8_t* bnProcBuf, uint16_t Z)
{ {
const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups; const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups;
const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups; const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups;
...@@ -504,9 +501,6 @@ static inline void nrLDPC_cn2bnProcBuf_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf ...@@ -504,9 +501,6 @@ static inline void nrLDPC_cn2bnProcBuf_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf
const uint8_t (*lut_bnPosBnProcBuf_CNG8) [lut_numCnInCnGroups[4]] = (const uint8_t(*)[lut_numCnInCnGroups[4]]) p_lut->bnPosBnProcBuf[4]; const uint8_t (*lut_bnPosBnProcBuf_CNG8) [lut_numCnInCnGroups[4]] = (const uint8_t(*)[lut_numCnInCnGroups[4]]) p_lut->bnPosBnProcBuf[4];
const uint8_t (*lut_bnPosBnProcBuf_CNG10) [lut_numCnInCnGroups[5]] = (const uint8_t(*)[lut_numCnInCnGroups[5]]) p_lut->bnPosBnProcBuf[5]; const uint8_t (*lut_bnPosBnProcBuf_CNG10) [lut_numCnInCnGroups[5]] = (const uint8_t(*)[lut_numCnInCnGroups[5]]) p_lut->bnPosBnProcBuf[5];
int8_t* cnProcBufRes = p_procBuf->cnProcBufRes;
int8_t* bnProcBuf = p_procBuf->bnProcBuf;
int8_t* p_cnProcBufRes; int8_t* p_cnProcBufRes;
uint32_t bitOffsetInGroup; uint32_t bitOffsetInGroup;
uint32_t i; uint32_t i;
...@@ -621,7 +615,7 @@ static inline void nrLDPC_cn2bnProcBuf_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf ...@@ -621,7 +615,7 @@ static inline void nrLDPC_cn2bnProcBuf_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf
\param p_procBuf Pointer to the processing buffers \param p_procBuf Pointer to the processing buffers
\param Z Lifting size \param Z Lifting size
*/ */
static inline void nrLDPC_cn2bnProcBuf_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_procBuf, uint16_t Z) static inline void nrLDPC_cn2bnProcBuf_BG1(t_nrLDPC_lut* p_lut, int8_t* cnProcBufRes, int8_t* bnProcBuf, uint16_t Z)
{ {
const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups; const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups;
const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups; const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups;
...@@ -655,9 +649,6 @@ static inline void nrLDPC_cn2bnProcBuf_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf ...@@ -655,9 +649,6 @@ static inline void nrLDPC_cn2bnProcBuf_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf
const uint8_t (*lut_bnPosBnProcBuf_CNG10)[lut_numCnInCnGroups[7]] = (const uint8_t(*)[lut_numCnInCnGroups[7]]) p_lut->bnPosBnProcBuf[7]; const uint8_t (*lut_bnPosBnProcBuf_CNG10)[lut_numCnInCnGroups[7]] = (const uint8_t(*)[lut_numCnInCnGroups[7]]) p_lut->bnPosBnProcBuf[7];
const uint8_t (*lut_bnPosBnProcBuf_CNG19)[lut_numCnInCnGroups[8]] = (const uint8_t(*)[lut_numCnInCnGroups[8]]) p_lut->bnPosBnProcBuf[8]; const uint8_t (*lut_bnPosBnProcBuf_CNG19)[lut_numCnInCnGroups[8]] = (const uint8_t(*)[lut_numCnInCnGroups[8]]) p_lut->bnPosBnProcBuf[8];
int8_t* cnProcBufRes = p_procBuf->cnProcBufRes;
int8_t* bnProcBuf = p_procBuf->bnProcBuf;
int8_t* p_cnProcBufRes; int8_t* p_cnProcBufRes;
uint32_t bitOffsetInGroup; uint32_t bitOffsetInGroup;
uint32_t i; uint32_t i;
...@@ -819,7 +810,7 @@ static inline void nrLDPC_cn2bnProcBuf_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf ...@@ -819,7 +810,7 @@ static inline void nrLDPC_cn2bnProcBuf_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf
\param p_procBuf Pointer to the processing buffers \param p_procBuf Pointer to the processing buffers
\param Z Lifting size \param Z Lifting size
*/ */
static inline void nrLDPC_bn2cnProcBuf_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_procBuf, uint16_t Z) static inline void nrLDPC_bn2cnProcBuf_BG2(t_nrLDPC_lut* p_lut, int8_t* bnProcBufRes, int8_t* cnProcBuf, uint16_t Z)
{ {
const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups; const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups;
const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups; const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups;
...@@ -845,9 +836,6 @@ static inline void nrLDPC_bn2cnProcBuf_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf ...@@ -845,9 +836,6 @@ static inline void nrLDPC_bn2cnProcBuf_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf
const uint8_t (*lut_bnPosBnProcBuf_CNG8) [lut_numCnInCnGroups[4]] = (const uint8_t(*)[lut_numCnInCnGroups[4]]) p_lut->bnPosBnProcBuf[4]; const uint8_t (*lut_bnPosBnProcBuf_CNG8) [lut_numCnInCnGroups[4]] = (const uint8_t(*)[lut_numCnInCnGroups[4]]) p_lut->bnPosBnProcBuf[4];
const uint8_t (*lut_bnPosBnProcBuf_CNG10) [lut_numCnInCnGroups[5]] = (const uint8_t(*)[lut_numCnInCnGroups[5]]) p_lut->bnPosBnProcBuf[5]; const uint8_t (*lut_bnPosBnProcBuf_CNG10) [lut_numCnInCnGroups[5]] = (const uint8_t(*)[lut_numCnInCnGroups[5]]) p_lut->bnPosBnProcBuf[5];
int8_t* cnProcBuf = p_procBuf->cnProcBuf;
int8_t* bnProcBufRes = p_procBuf->bnProcBufRes;
int8_t* p_cnProcBuf; int8_t* p_cnProcBuf;
uint32_t bitOffsetInGroup; uint32_t bitOffsetInGroup;
uint32_t i; uint32_t i;
...@@ -961,7 +949,7 @@ static inline void nrLDPC_bn2cnProcBuf_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf ...@@ -961,7 +949,7 @@ static inline void nrLDPC_bn2cnProcBuf_BG2(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf
\param p_procBuf Pointer to the processing buffers \param p_procBuf Pointer to the processing buffers
\param Z Lifting size \param Z Lifting size
*/ */
static inline void nrLDPC_bn2cnProcBuf_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf* p_procBuf, uint16_t Z) static inline void nrLDPC_bn2cnProcBuf_BG1(t_nrLDPC_lut* p_lut, int8_t* bnProcBufRes, int8_t* cnProcBuf, uint16_t Z)
{ {
const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups; const uint8_t* lut_numCnInCnGroups = p_lut->numCnInCnGroups;
const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups; const uint32_t* lut_startAddrCnGroups = p_lut->startAddrCnGroups;
...@@ -995,9 +983,6 @@ static inline void nrLDPC_bn2cnProcBuf_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf ...@@ -995,9 +983,6 @@ static inline void nrLDPC_bn2cnProcBuf_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf
const uint8_t (*lut_bnPosBnProcBuf_CNG10)[lut_numCnInCnGroups[7]] = (const uint8_t(*)[lut_numCnInCnGroups[7]]) p_lut->bnPosBnProcBuf[7]; const uint8_t (*lut_bnPosBnProcBuf_CNG10)[lut_numCnInCnGroups[7]] = (const uint8_t(*)[lut_numCnInCnGroups[7]]) p_lut->bnPosBnProcBuf[7];
const uint8_t (*lut_bnPosBnProcBuf_CNG19)[lut_numCnInCnGroups[8]] = (const uint8_t(*)[lut_numCnInCnGroups[8]]) p_lut->bnPosBnProcBuf[8]; const uint8_t (*lut_bnPosBnProcBuf_CNG19)[lut_numCnInCnGroups[8]] = (const uint8_t(*)[lut_numCnInCnGroups[8]]) p_lut->bnPosBnProcBuf[8];
int8_t* cnProcBuf = p_procBuf->cnProcBuf;
int8_t* bnProcBufRes = p_procBuf->bnProcBufRes;
int8_t* p_cnProcBuf; int8_t* p_cnProcBuf;
uint32_t bitOffsetInGroup; uint32_t bitOffsetInGroup;
uint32_t i; uint32_t i;
...@@ -1157,7 +1142,7 @@ static inline void nrLDPC_bn2cnProcBuf_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf ...@@ -1157,7 +1142,7 @@ static inline void nrLDPC_bn2cnProcBuf_BG1(t_nrLDPC_lut* p_lut, t_nrLDPC_procBuf
\param Z Lifting size \param Z Lifting size
\param BG Base graph \param BG Base graph
*/ */
static inline void nrLDPC_llrRes2llrOut(t_nrLDPC_lut* p_lut, int8_t* llrOut, t_nrLDPC_procBuf* p_procBuf, uint16_t Z, uint8_t BG) static inline void nrLDPC_llrRes2llrOut(t_nrLDPC_lut* p_lut, int8_t* llrOut, int8_t* llrRes, uint16_t Z, uint8_t BG)
{ {
uint32_t i; uint32_t i;
const uint8_t numBn2CnG1 = p_lut->numBnInBnGroups[0]; const uint8_t numBn2CnG1 = p_lut->numBnInBnGroups[0];
...@@ -1168,7 +1153,6 @@ static inline void nrLDPC_llrRes2llrOut(t_nrLDPC_lut* p_lut, int8_t* llrOut, t_n ...@@ -1168,7 +1153,6 @@ static inline void nrLDPC_llrRes2llrOut(t_nrLDPC_lut* p_lut, int8_t* llrOut, t_n
const uint16_t* lut_llr2llrProcBufAddr = p_lut->llr2llrProcBufAddr; const uint16_t* lut_llr2llrProcBufAddr = p_lut->llr2llrProcBufAddr;
const uint8_t* lut_llr2llrProcBufBnPos = p_lut->llr2llrProcBufBnPos; const uint8_t* lut_llr2llrProcBufBnPos = p_lut->llr2llrProcBufBnPos;
int8_t* llrRes = p_procBuf->llrRes;
int8_t* p_llrOut = &llrOut[0]; int8_t* p_llrOut = &llrOut[0];
uint32_t idxBn; uint32_t idxBn;
......
...@@ -87,38 +87,38 @@ static inline void nrLDPC_initFile(const char* fileName) ...@@ -87,38 +87,38 @@ static inline void nrLDPC_initFile(const char* fileName)
\brief Writes data of predefined buffers to file \brief Writes data of predefined buffers to file
\param buffer Enum of buffer name to write \param buffer Enum of buffer name to write
*/ */
static inline void nrLDPC_debug_writeBuffer2File(e_nrLDPC_buffers buffer, t_nrLDPC_procBuf* p_procBuf) static inline void nrLDPC_debug_writeBuffer2File(e_nrLDPC_buffers buffer, int8_t* p_buffer)
{ {
switch (buffer) switch (buffer)
{ {
case nrLDPC_buffers_LLR_PROC: case nrLDPC_buffers_LLR_PROC:
{ {
nrLDPC_writeFile("llrProcBuf.txt", p_procBuf->llrProcBuf, NR_LDPC_MAX_NUM_LLR); nrLDPC_writeFile("llrProcBuf.txt", p_buffer, NR_LDPC_MAX_NUM_LLR);
break; break;
} }
case nrLDPC_buffers_CN_PROC: case nrLDPC_buffers_CN_PROC:
{ {
nrLDPC_writeFile("cnProcBuf.txt", p_procBuf->cnProcBuf, NR_LDPC_SIZE_CN_PROC_BUF); nrLDPC_writeFile("cnProcBuf.txt", p_buffer, NR_LDPC_SIZE_CN_PROC_BUF);
break; break;
} }
case nrLDPC_buffers_CN_PROC_RES: case nrLDPC_buffers_CN_PROC_RES:
{ {
nrLDPC_writeFile("cnProcBufRes.txt", p_procBuf->cnProcBufRes, NR_LDPC_SIZE_CN_PROC_BUF); nrLDPC_writeFile("cnProcBufRes.txt", p_buffer, NR_LDPC_SIZE_CN_PROC_BUF);
break; break;
} }
case nrLDPC_buffers_BN_PROC: case nrLDPC_buffers_BN_PROC:
{ {
nrLDPC_writeFile("bnProcBuf.txt", p_procBuf->bnProcBuf, NR_LDPC_SIZE_BN_PROC_BUF); nrLDPC_writeFile("bnProcBuf.txt", p_buffer, NR_LDPC_SIZE_BN_PROC_BUF);
break; break;
} }
case nrLDPC_buffers_BN_PROC_RES: case nrLDPC_buffers_BN_PROC_RES:
{ {
nrLDPC_writeFile("bnProcBufRes.txt", p_procBuf->bnProcBufRes, NR_LDPC_SIZE_BN_PROC_BUF); nrLDPC_writeFile("bnProcBufRes.txt", p_buffer, NR_LDPC_SIZE_BN_PROC_BUF);
break; break;
} }
case nrLDPC_buffers_LLR_RES: case nrLDPC_buffers_LLR_RES:
{ {
nrLDPC_writeFile("llrRes.txt", p_procBuf->llrRes, NR_LDPC_MAX_NUM_LLR); nrLDPC_writeFile("llrRes.txt", p_buffer, NR_LDPC_MAX_NUM_LLR);
break; break;
} }
} }
......
...@@ -71,5 +71,5 @@ typedef int(*nrLDPC_encoderfunc_t)(unsigned char **,unsigned char **,int,int,sho ...@@ -71,5 +71,5 @@ typedef int(*nrLDPC_encoderfunc_t)(unsigned char **,unsigned char **,int,int,sho
\param p_llrOut Output vector \param p_llrOut Output vector
\param p_profiler LDPC profiler statistics \param p_profiler LDPC profiler statistics
*/ */
typedef int32_t(*nrLDPC_decoderfunc_t)(t_nrLDPC_dec_params *, int8_t *, int8_t *, t_nrLDPC_procBuf *, t_nrLDPC_time_stats * ); typedef int32_t(*nrLDPC_decoderfunc_t)(t_nrLDPC_dec_params* , int8_t*, int8_t* , t_nrLDPC_time_stats* );
#endif #endif
...@@ -34,5 +34,4 @@ extern nrLDPC_initcallfunc_t nrLDPC_initcall; ...@@ -34,5 +34,4 @@ extern nrLDPC_initcallfunc_t nrLDPC_initcall;
extern nrLDPC_decoderfunc_t nrLDPC_decoder; extern nrLDPC_decoderfunc_t nrLDPC_decoder;
extern nrLDPC_encoderfunc_t nrLDPC_encoder; extern nrLDPC_encoderfunc_t nrLDPC_encoder;
// inline functions: // inline functions:
#include "openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_init_mem.h"
#endif #endif
...@@ -76,8 +76,6 @@ void free_gNB_ulsch(NR_gNB_ULSCH_t **ulschptr, uint16_t N_RB_UL) ...@@ -76,8 +76,6 @@ void free_gNB_ulsch(NR_gNB_ULSCH_t **ulschptr, uint16_t N_RB_UL)
free_and_zero(ulsch->harq_processes[i]->c[r]); free_and_zero(ulsch->harq_processes[i]->c[r]);
free_and_zero(ulsch->harq_processes[i]->d[r]); free_and_zero(ulsch->harq_processes[i]->d[r]);
free_and_zero(ulsch->harq_processes[i]->w[r]); free_and_zero(ulsch->harq_processes[i]->w[r]);
nrLDPC_free_mem(ulsch->harq_processes[i]->p_nrLDPC_procBuf[r]);
ulsch->harq_processes[i]->p_nrLDPC_procBuf[r] = NULL;
} }
free_and_zero(ulsch->harq_processes[i]); free_and_zero(ulsch->harq_processes[i]);
ulsch->harq_processes[i] = NULL; ulsch->harq_processes[i] = NULL;
...@@ -101,22 +99,21 @@ NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL) ...@@ -101,22 +99,21 @@ NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL)
uint32_t ulsch_bytes = a_segments*1056; // allocated bytes per segment uint32_t ulsch_bytes = a_segments*1056; // allocated bytes per segment
ulsch = (NR_gNB_ULSCH_t *)malloc16_clear(sizeof(NR_gNB_ULSCH_t)); ulsch = (NR_gNB_ULSCH_t *)malloc16_clear(sizeof(NR_gNB_ULSCH_t));
ulsch->max_ldpc_iterations = max_ldpc_iterations; ulsch->max_ldpc_iterations = max_ldpc_iterations;
ulsch->Mlimit = 4; ulsch->Mlimit = 4;
for (i=0; i<NR_MAX_ULSCH_HARQ_PROCESSES; i++) { for (i=0; i<NR_MAX_ULSCH_HARQ_PROCESSES; i++) {
ulsch->harq_processes[i] = (NR_UL_gNB_HARQ_t *)malloc16_clear(sizeof(NR_UL_gNB_HARQ_t)); ulsch->harq_processes[i] = (NR_UL_gNB_HARQ_t *)malloc16_clear(sizeof(NR_UL_gNB_HARQ_t));
ulsch->harq_processes[i]->b = (uint8_t*)malloc16_clear(ulsch_bytes); ulsch->harq_processes[i]->b = (uint8_t*)malloc16_clear(ulsch_bytes);
for (r=0; r<a_segments; r++) { for (r=0; r<a_segments; r++) {
ulsch->harq_processes[i]->p_nrLDPC_procBuf[r] = nrLDPC_init_mem();
ulsch->harq_processes[i]->c[r] = (uint8_t*)malloc16_clear(8448*sizeof(uint8_t)); ulsch->harq_processes[i]->c[r] = (uint8_t*)malloc16_clear(8448*sizeof(uint8_t));
ulsch->harq_processes[i]->d[r] = (int16_t*)malloc16_clear((68*384)*sizeof(int16_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)); ulsch->harq_processes[i]->w[r] = (int16_t*)malloc16_clear((3*(6144+64))*sizeof(int16_t));
} }
} }
return(ulsch); return(ulsch);
} }
...@@ -360,7 +357,6 @@ void nr_processULSegment(void* arg) { ...@@ -360,7 +357,6 @@ void nr_processULSegment(void* arg) {
no_iteration_ldpc = nrLDPC_decoder(p_decoderParms, no_iteration_ldpc = nrLDPC_decoder(p_decoderParms,
(int8_t*)&pl[0], (int8_t*)&pl[0],
llrProcBuf, llrProcBuf,
ulsch_harq->p_nrLDPC_procBuf[r],
p_procTime); p_procTime);
if (check_crc((uint8_t*)llrProcBuf,length_dec,ulsch_harq->F,crc_type)) { if (check_crc((uint8_t*)llrProcBuf,length_dec,ulsch_harq->F,crc_type)) {
......
...@@ -36,7 +36,8 @@ ...@@ -36,7 +36,8 @@
void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms, void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
PHY_VARS_NR_UE *ue, PHY_VARS_NR_UE *ue,
module_id_t gNB_id, module_id_t gNB_id,
const int estimateSz, struct complex16 dl_ch_estimates_time[][estimateSz], const int estimateSz,
struct complex16 dl_ch_estimates_time[][estimateSz],
uint8_t frame, uint8_t frame,
uint8_t subframe, uint8_t subframe,
unsigned char clear, unsigned char clear,
......
...@@ -197,9 +197,9 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue, ...@@ -197,9 +197,9 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
int estimateSz, int estimateSz,
struct complex16 dl_ch_estimates [][estimateSz], struct complex16 dl_ch_estimates [][estimateSz],
struct complex16 dl_ch_estimates_time [][estimateSz], struct complex16 dl_ch_estimates_time [][ue->frame_parms.ofdm_symbol_size],
UE_nr_rxtx_proc_t *proc, UE_nr_rxtx_proc_t *proc,
uint8_t gNB_id, uint8_t gNB_id,
unsigned char Ns, unsigned char Ns,
...@@ -320,7 +320,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -320,7 +320,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)]; rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)];
dl_ch = (int16_t *)&dl_ch_estimates[aarx][ch_offset]; dl_ch = (int16_t *)&dl_ch_estimates[aarx][ch_offset];
memset(dl_ch,0,sizeof(*dl_ch)*(ue->frame_parms.ofdm_symbol_size)); memset(dl_ch,0,sizeof(struct complex16)*(ue->frame_parms.ofdm_symbol_size));
#ifdef DEBUG_CH #ifdef DEBUG_CH
printf("pbch ch est pilot addr %p RB_DL %d\n",&pilot[0], ue->frame_parms.N_RB_DL); printf("pbch ch est pilot addr %p RB_DL %d\n",&pilot[0], ue->frame_parms.N_RB_DL);
...@@ -387,10 +387,10 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -387,10 +387,10 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
// in 2nd symbol, skip middle REs (48 with DMRS, 144 for SSS, and another 48 with DMRS) // in 2nd symbol, skip middle REs (48 with DMRS, 144 for SSS, and another 48 with DMRS)
if (dmrss == 1 && pilot_cnt == 12) { if (dmrss == 1 && pilot_cnt == 12) {
pilot_cnt=48; pilot_cnt=48;
re_offset = (re_offset+144) % ue->frame_parms.ofdm_symbol_size; re_offset = (re_offset+144) % ue->frame_parms.ofdm_symbol_size;
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)]; rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+k+re_offset)];
dl_ch += 288; dl_ch += 288;
} }
ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15); ch[0] = (int16_t)(((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])>>15);
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
...@@ -452,10 +452,12 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue, ...@@ -452,10 +452,12 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
(int16_t*) &dl_ch_estimates[aarx][ch_offset], (int16_t*) &dl_ch_estimates[aarx][ch_offset],
(int16_t*) dl_ch_estimates_time[aarx], (int16_t*) dl_ch_estimates_time[aarx],
1); 1);
} }
} }
if (dmrss == 2) if (dmrss == 2)
UEscopeCopy(ue, pbchDlChEstimateTime, (void*)dl_ch_estimates_time, sizeof(struct complex16), ue->frame_parms.nb_antennas_rx, idftsizeidx); UEscopeCopy(ue, pbchDlChEstimateTime, (void*)dl_ch_estimates_time, sizeof(struct complex16), ue->frame_parms.nb_antennas_rx, idftsizeidx);
return(0); return(0);
} }
......
...@@ -104,11 +104,9 @@ void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlschptr, uint16_t N_RB_DL) { ...@@ -104,11 +104,9 @@ void free_nr_ue_dlsch(NR_UE_DLSCH_t **dlschptr, uint16_t N_RB_DL) {
dlsch->harq_processes[i]->c[r] = NULL; dlsch->harq_processes[i]->c[r] = NULL;
free16(dlsch->harq_processes[i]->d[r],5*8448); free16(dlsch->harq_processes[i]->d[r],5*8448);
dlsch->harq_processes[i]->d[r] = NULL; dlsch->harq_processes[i]->d[r] = NULL;
nrLDPC_free_mem(dlsch->harq_processes[i]->p_nrLDPC_procBuf[r]);
} }
free16(dlsch->harq_processes[i]->c,a_segments); free16(dlsch->harq_processes[i]->c,a_segments);
free16(dlsch->harq_processes[i]->d,a_segments); free16(dlsch->harq_processes[i]->d,a_segments);
free16(dlsch->harq_processes[i]->p_nrLDPC_procBuf,a_segments);
free16(dlsch->harq_processes[i],sizeof(NR_DL_UE_HARQ_t)); free16(dlsch->harq_processes[i],sizeof(NR_DL_UE_HARQ_t));
dlsch->harq_processes[i] = NULL; dlsch->harq_processes[i] = NULL;
...@@ -161,9 +159,7 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint ...@@ -161,9 +159,7 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint
dlsch->harq_processes[i]->c = (uint8_t **)malloc16(a_segments*sizeof(uint8_t *)); dlsch->harq_processes[i]->c = (uint8_t **)malloc16(a_segments*sizeof(uint8_t *));
dlsch->harq_processes[i]->d = (int16_t **)malloc16(a_segments*sizeof(int16_t *)); dlsch->harq_processes[i]->d = (int16_t **)malloc16(a_segments*sizeof(int16_t *));
dlsch->harq_processes[i]->p_nrLDPC_procBuf = (t_nrLDPC_procBuf **)malloc16(a_segments*sizeof(t_nrLDPC_procBuf *));
for (int r=0; r<a_segments; r++) { for (int r=0; r<a_segments; r++) {
dlsch->harq_processes[i]->p_nrLDPC_procBuf[r] = nrLDPC_init_mem();
dlsch->harq_processes[i]->c[r] = (uint8_t *)malloc16(1056); dlsch->harq_processes[i]->c[r] = (uint8_t *)malloc16(1056);
dlsch->harq_processes[i]->d[r] = (int16_t *)malloc16(5*8448*sizeof(int16_t)); dlsch->harq_processes[i]->d[r] = (int16_t *)malloc16(5*8448*sizeof(int16_t));
if (dlsch->harq_processes[i]->c[r]) if (dlsch->harq_processes[i]->c[r])
...@@ -301,132 +297,128 @@ void nr_processDLSegment(void* arg) { ...@@ -301,132 +297,128 @@ 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; int16_t w[5*8448];
memset(w,0,(5*8448)*sizeof(short));
int16_t w[5*8448]; start_meas(&rdata->ts_deinterleave);
memset(w,0,(5*8448)*sizeof(short));
//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,
Qm,
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_IN); w, // [hna] w is e
nr_deinterleaving_ldpc(E, dlsch_llr+r_offset);
Qm, //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_OUT);
w, // [hna] w is e stop_meas(&rdata->ts_deinterleave);
dlsch_llr+r_offset);
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_OUT); start_meas(&rdata->ts_rate_unmatch);
stop_meas(&rdata->ts_deinterleave); /* 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",
harq_pid,r, G,E,harq_process->F,
start_meas(&rdata->ts_rate_unmatch); Kr*3,
/* 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", harq_process->TBS,
harq_pid,r, G,E,harq_process->F, Qm,
Kr*3, harq_process->nb_rb,
harq_process->TBS, harq_process->Nl,
Qm, harq_process->rvidx,
harq_process->nb_rb, harq_process->round); */
harq_process->Nl, //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_RATE_MATCHING, VCD_FUNCTION_IN);
harq_process->rvidx,
harq_process->round); */ if (nr_rate_matching_ldpc_rx(Ilbrm,
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_RATE_MATCHING, VCD_FUNCTION_IN); Tbslbrm,
p_decoderParms->BG,
if (nr_rate_matching_ldpc_rx(Ilbrm, p_decoderParms->Z,
Tbslbrm, harq_process->d[r],
p_decoderParms->BG, w,
p_decoderParms->Z, harq_process->C,
harq_process->d[r], harq_process->rvidx,
w, (harq_process->first_rx==1)?1:0,
harq_process->C, E,
harq_process->rvidx, harq_process->F,
(harq_process->first_rx==1)?1:0, Kr-harq_process->F-2*(p_decoderParms->Z))==-1) {
E, //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_RATE_MATCHING, VCD_FUNCTION_OUT);
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)) {
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_nrLDPC_procBuf[r], //Move coded bits before filler bits
p_procTime); memcpy((&z[0]+2*harq_process->Z),harq_process->d[r],(K_bits_F-2*harq_process->Z)*sizeof(int16_t));
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_LDPC, VCD_FUNCTION_OUT); //skip filler bits
memcpy((&z[0]+Kr),harq_process->d[r]+(Kr-2*harq_process->Z),(kc*harq_process->Z-Kr)*sizeof(int16_t));
// 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)) { //Saturate coded bits before decoding into 8 bits values
LOG_D(PHY,"Segment %u CRC OK\n",r); 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]);
if (r==0) { }
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"); (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,
......
...@@ -146,23 +146,26 @@ int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_ini ...@@ -146,23 +146,26 @@ int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_ini
start_meas(&ue->dlsch_channel_estimation_stats); start_meas(&ue->dlsch_channel_estimation_stats);
// computing channel estimation for selected best ssb // computing channel estimation for selected best ssb
const int estimateSz=7*2*frame_parms->ofdm_symbol_size; const int estimateSz = frame_parms->symbols_per_slot * frame_parms->ofdm_symbol_size;
__attribute__ ((aligned(32))) struct complex16 dl_ch_estimates[frame_parms->nb_antennas_rx][estimateSz]; __attribute__ ((aligned(32))) struct complex16 dl_ch_estimates[frame_parms->nb_antennas_rx][estimateSz];
__attribute__ ((aligned(32))) struct complex16 dl_ch_estimates_time[frame_parms->nb_antennas_rx][estimateSz]; __attribute__ ((aligned(32))) struct complex16 dl_ch_estimates_time[frame_parms->nb_antennas_rx][frame_parms->ofdm_symbol_size];
for(int i=pbch_initial_symbol; i<pbch_initial_symbol+3;i++) for(int i=pbch_initial_symbol; i<pbch_initial_symbol+3;i++)
nr_pbch_channel_estimation(ue,estimateSz, dl_ch_estimates, dl_ch_estimates_time, nr_pbch_channel_estimation(ue,estimateSz, dl_ch_estimates, dl_ch_estimates_time,
proc,0,0,i,i-pbch_initial_symbol,temp_ptr->i_ssb,temp_ptr->n_hf); proc,0,0,i,i-pbch_initial_symbol,temp_ptr->i_ssb,temp_ptr->n_hf);
stop_meas(&ue->dlsch_channel_estimation_stats); stop_meas(&ue->dlsch_channel_estimation_stats);
fapiPbch_t result; fapiPbch_t result;
ret = nr_rx_pbch(ue, ret = nr_rx_pbch(ue,
proc, proc,
estimateSz, dl_ch_estimates, estimateSz,
ue->pbch_vars[0], dl_ch_estimates,
ue->pbch_vars[0],
frame_parms, frame_parms,
0, 0,
temp_ptr->i_ssb, temp_ptr->i_ssb,
SISO, SISO,
&result); &result);
temp_ptr=temp_ptr->next_ssb; temp_ptr=temp_ptr->next_ssb;
} }
......
...@@ -196,8 +196,6 @@ typedef struct { ...@@ -196,8 +196,6 @@ typedef struct {
uint8_t rvidx; uint8_t rvidx;
/// MIMO mode for this DLSCH /// MIMO mode for this DLSCH
MIMO_nrmode_t mimo_mode; MIMO_nrmode_t mimo_mode;
/// LDPC processing buffers
t_nrLDPC_procBuf **p_nrLDPC_procBuf;
/// Number of code segments /// Number of code segments
uint32_t C; uint32_t C;
/// Number of bits in code segments /// Number of bits in code segments
......
...@@ -280,8 +280,6 @@ typedef struct { ...@@ -280,8 +280,6 @@ typedef struct {
uint32_t C; uint32_t C;
/// Pointers to code blocks after LDPC coding (38.212 V15.4.0 section 5.3.2) /// Pointers to code blocks after LDPC coding (38.212 V15.4.0 section 5.3.2)
int16_t *d[MAX_NUM_NR_ULSCH_SEGMENTS]; int16_t *d[MAX_NUM_NR_ULSCH_SEGMENTS];
/// LDPC processing buffer
t_nrLDPC_procBuf* p_nrLDPC_procBuf[MAX_NUM_NR_ULSCH_SEGMENTS];
/// LDPC lifting size (38.212 V15.4.0 table 5.3.2-1) /// LDPC lifting size (38.212 V15.4.0 table 5.3.2-1)
uint32_t Z; uint32_t Z;
/// code blocks after bit selection in rate matching for LDPC code (38.212 V15.4.0 section 5.4.2.1) /// code blocks after bit selection in rate matching for LDPC code (38.212 V15.4.0 section 5.4.2.1)
......
...@@ -1405,9 +1405,11 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -1405,9 +1405,11 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
if (slot_ssb) { if (slot_ssb) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PBCH, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PBCH, VCD_FUNCTION_IN);
LOG_D(PHY," ------ PBCH ChannelComp/LLR: frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx); LOG_D(PHY," ------ PBCH ChannelComp/LLR: frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx);
const int estimateSz=7*2*sizeof(int)*fp->ofdm_symbol_size;
const int estimateSz = fp->symbols_per_slot * fp->ofdm_symbol_size;
__attribute__ ((aligned(32))) struct complex16 dl_ch_estimates[fp->nb_antennas_rx][estimateSz]; __attribute__ ((aligned(32))) struct complex16 dl_ch_estimates[fp->nb_antennas_rx][estimateSz];
__attribute__ ((aligned(32))) struct complex16 dl_ch_estimates_time[fp->nb_antennas_rx][estimateSz]; __attribute__ ((aligned(32))) struct complex16 dl_ch_estimates_time[fp->nb_antennas_rx][fp->ofdm_symbol_size];
for (int i=1; i<4; i++) { for (int i=1; i<4; i++) {
nr_slot_fep(ue, nr_slot_fep(ue,
...@@ -1415,7 +1417,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -1415,7 +1417,6 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
(ue->symbol_offset+i)%(fp->symbols_per_slot), (ue->symbol_offset+i)%(fp->symbols_per_slot),
nr_slot_rx); nr_slot_rx);
start_meas(&ue->dlsch_channel_estimation_stats); start_meas(&ue->dlsch_channel_estimation_stats);
nr_pbch_channel_estimation(ue, estimateSz, dl_ch_estimates, dl_ch_estimates_time,proc,gNB_id,nr_slot_rx,(ue->symbol_offset+i)%(fp->symbols_per_slot),i-1,(fp->ssb_index)&7,fp->half_frame_bit); nr_pbch_channel_estimation(ue, estimateSz, dl_ch_estimates, dl_ch_estimates_time,proc,gNB_id,nr_slot_rx,(ue->symbol_offset+i)%(fp->symbols_per_slot),i-1,(fp->ssb_index)&7,fp->half_frame_bit);
stop_meas(&ue->dlsch_channel_estimation_stats); stop_meas(&ue->dlsch_channel_estimation_stats);
...@@ -1433,7 +1434,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -1433,7 +1434,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
nr_adjust_synch_ue(fp, nr_adjust_synch_ue(fp,
ue, ue,
gNB_id, gNB_id,
estimateSz, dl_ch_estimates_time, fp->ofdm_symbol_size,
dl_ch_estimates_time,
frame_rx, frame_rx,
nr_slot_rx, nr_slot_rx,
0, 0,
......
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