* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include "SIMULATION/TOOLS/defs.h"
// 4-bit quantizer
charquantize4bit(doubleD,doublex)
{
doubleqxd;
qxd=floor(x/D);
// printf("x=%f,qxd=%f\n",x,qxd);
if(qxd<=-8)
qxd=-8;
elseif(qxd>7)
qxd=7;
return((char)qxd);
}
charquantize(doubleD,doublex,unsignedcharB)
{
doubleqxd;
charmaxlev;
qxd=floor(x/D);
// printf("x=%f,qxd=%f\n",x,qxd);
maxlev=1<<(B-1);
if(qxd<=-maxlev)
qxd=-maxlev;
elseif(qxd>=maxlev)
qxd=maxlev-1;
return((char)qxd);
}
#define MAX_BLOCK_LENGTH 8448
inttest_ldpc(shortNo_iteration,
doublerate,
doubleSNR,
unsignedcharqbits,
shortblock_length,
unsignedintntrials,
unsignedint*errors,
unsignedint*crc_misses)
{
//clock initiate
time_stats_ttime;
opp_enabled=1;
cpu_freq_GHz=get_cpu_freq_GHz();
//short test_input[block_length];
char*test_input;
//short *c; //padded codeword
short*esimated_output;
char*channel_input;
double*channel_output;
double*modulated_input;
short*channel_output_fixed;
unsignedinti,trial=0;
/*
short BG,Zc,Kb,nrows,ncols,channel_temp;
int no_punctured_columns; //new
//Table of possible lifting sizes
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};