Commit 75684d75 authored by Florian Kaltenberger's avatar Florian Kaltenberger

integrating SIMD optimized LDPC encoder

parent fbfe950c
......@@ -573,6 +573,7 @@ void phy_viterbi_dot11(int8_t *,uint8_t *,uint16_t);
short *ldpc_decoder(short *msgChannel,short block_length,short No_iteration,double rate);
int encode_parity_check_part(uint16_t *c,uint16_t *d, short BG,short Zc,short Kb);
int encode_parity_check_part_orig(unsigned char *c,unsigned char *d, short BG,short Zc,short Kb,short block_length);
int ldpc_encoder(unsigned char *test_input,unsigned char *channel_input,short block_length,int nom_rate,int denom_rate);
int ldpc_encoder_orig(unsigned char *test_input,unsigned char *channel_input,short block_length,int nom_rate,int denom_rate,unsigned char gen_code);
int ldpc_encoder_multi_segment(unsigned char **test_input,unsigned char **channel_input,short block_length,double rate,uint8_t n_segments);
......
......@@ -94,16 +94,14 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
int simd_size;
//determine number of bits in codeword
//if (block_length>3840)
//{
AssertFatal(block_length>3840,"Block length < 3840 not supported yet\n");
if (block_length>3840)
{
BG=1;
Kb = 22;
nrows=46; //parity check bits
ncols=22; //info bits
//}
/* else if (block_length<=3840)
}
else if (block_length<=3840)
{
BG=2;
nrows=42; //parity check bits
......@@ -117,7 +115,7 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
Kb = 8;
else
Kb = 6;
} */
}
//find minimum value in all sets of lifting size
Zc=0;
......@@ -156,6 +154,8 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
c[i]=(test_input[i/8]&(1<<(i&7)))>>(i&7);
}
stop_meas(tinput);
if (BG==1) {
// extend matrix
start_meas(tprep);
for (i1=0; i1 < ncols; i1++)
......@@ -177,6 +177,18 @@ int ldpc_encoder_optim(unsigned char *test_input,unsigned char *channel_input,sh
start_meas(tparity);
encode_parity_check_part_optim(c_extension, d, BG, Zc, Kb);
stop_meas(tparity);
}
else if (BG==2) {
if (encode_parity_check_part_orig(c, d, BG, Zc, Kb, block_length)!=0) {
printf("Problem with encoder\n");
return(-1);
}
}
else {
printf("Problem with encoder\n");
return(-1);
}
start_meas(toutput);
// information part and puncture columns
memcpy(&channel_input[0], &c[2*Zc], (block_length-2*Zc)*sizeof(unsigned char));
......
......@@ -905,7 +905,8 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
start_meas(te_stats);
memset(dlsch->harq_processes[harq_pid]->d[r],0,(96+12+3+3*8448)*sizeof(uint8_t));
ldpc_encoder((unsigned char*)dlsch->harq_processes[harq_pid]->c[r],(unsigned char*)&dlsch->harq_processes[harq_pid]->d[r][96],Kr,1,3);
//ldpc_encoder((unsigned char*)dlsch->harq_processes[harq_pid]->c[r],(unsigned char*)&dlsch->harq_processes[harq_pid]->d[r][96],Kr,1,3);
ldpc_encoder_optim((unsigned char*)dlsch->harq_processes[harq_pid]->c[r],(unsigned char*)&dlsch->harq_processes[harq_pid]->d[r][96],Kr,1,3,NULL,NULL,NULL,NULL);
stop_meas(te_stats);
#endif
......
......@@ -43,7 +43,7 @@ double get_cpu_freq_GHz(void) {
void print_meas_now(time_stats_t *ts, const char* name, FILE* file_name){
if (opp_enabled) {
if (opp_enabled && ts) {
//static double cpu_freq_GHz = 3.2;
......@@ -62,7 +62,7 @@ void print_meas_now(time_stats_t *ts, const char* name, FILE* file_name){
void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_time, time_stats_t * sf_exec_time)
{
if (opp_enabled) {
if (opp_enabled && ts) {
static int first_time = 0;
static double cpu_freq_GHz = 0.0;
......
......@@ -98,7 +98,7 @@ static inline uint32_t rdtsc_oai(void)
static inline void start_meas(time_stats_t *ts)
{
if (opp_enabled) {
if (opp_enabled && ts) {
if (ts->meas_flag==0) {
ts->trials++;
ts->in = rdtsc_oai();
......@@ -113,7 +113,7 @@ static inline void start_meas(time_stats_t *ts)
static inline void stop_meas(time_stats_t *ts)
{
if (opp_enabled) {
if (opp_enabled && ts) {
long long out = rdtsc_oai();
ts->diff_now = (out-ts->in);
......@@ -133,6 +133,8 @@ static inline void stop_meas(time_stats_t *ts)
static inline void reset_meas(time_stats_t *ts) {
if (ts) {
ts->trials=0;
ts->diff=0;
ts->diff_now=0;
......@@ -141,6 +143,7 @@ static inline void reset_meas(time_stats_t *ts) {
ts->max=0;
ts->meas_flag=0;
}
}
static inline void copy_meas(time_stats_t *dst_ts,time_stats_t *src_ts)
......
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