Commit 71d8113e authored by wang's avatar wang

update dlsch decoding

parent 34746b24
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
//#define DEBUG_DLSCH_CODING //#define DEBUG_DLSCH_CODING
//#define DEBUG_DLSCH_FREE 1 //#define DEBUG_DLSCH_FREE 1
//#define TD_DECODING
/* /*
#define is_not_pilot(pilots,first_pilot,re) (pilots==0) || \ #define is_not_pilot(pilots,first_pilot,re) (pilots==0) || \
...@@ -575,11 +576,13 @@ int dlsch_encoding(PHY_VARS_eNB *eNB, ...@@ -575,11 +576,13 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms; LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
unsigned char harq_pid = dlsch->current_harq_pid; unsigned char harq_pid = dlsch->current_harq_pid;
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb; unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb;
unsigned int A; unsigned int A, Z;
unsigned *pz = &Z;
unsigned char mod_order; unsigned char mod_order;
unsigned int Kr=0,Kr_bytes,r,r_offset=0; unsigned int Kr=0,Kr_bytes,r,r_offset=0;
unsigned short m=dlsch->harq_processes[harq_pid]->mcs; unsigned short m=dlsch->harq_processes[harq_pid]->mcs;
uint8_t beamforming_mode=0; uint8_t beamforming_mode=0;
double rate = 0.33;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN);
...@@ -620,8 +623,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB, ...@@ -620,8 +623,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
// dlsch->harq_processes[harq_pid]->b = a; // dlsch->harq_processes[harq_pid]->b = a;
memcpy(dlsch->harq_processes[harq_pid]->b,a,(A/8)+4); memcpy(dlsch->harq_processes[harq_pid]->b,a,(A/8)+4);
#ifdef TD_DECODING
if (lte_segmentation(dlsch->harq_processes[harq_pid]->b, if (lte_segmentation(dlsch->harq_processes[harq_pid]->b,
dlsch->harq_processes[harq_pid]->c, dlsch->harq_processes[harq_pid]->c,
dlsch->harq_processes[harq_pid]->B, dlsch->harq_processes[harq_pid]->B,
...@@ -632,14 +634,24 @@ int dlsch_encoding(PHY_VARS_eNB *eNB, ...@@ -632,14 +634,24 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
&dlsch->harq_processes[harq_pid]->Kminus, &dlsch->harq_processes[harq_pid]->Kminus,
&dlsch->harq_processes[harq_pid]->F)<0) &dlsch->harq_processes[harq_pid]->F)<0)
return(-1); return(-1);
#else
nr_segmentation(dlsch->harq_processes[harq_pid]->b,
dlsch->harq_processes[harq_pid]->c,
dlsch->harq_processes[harq_pid]->B,
&dlsch->harq_processes[harq_pid]->C,
&dlsch->harq_processes[harq_pid]->Kplus,
&dlsch->harq_processes[harq_pid]->Kminus,
pz,
&dlsch->harq_processes[harq_pid]->F);
#endif
printf("Encoder: B %d F %d \n",dlsch->harq_processes[harq_pid]->B, dlsch->harq_processes[harq_pid]->F); printf("Encoder: B %d F %d \n",dlsch->harq_processes[harq_pid]->B, dlsch->harq_processes[harq_pid]->F);
for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) { for (r=0; r<dlsch->harq_processes[harq_pid]->C; r++) {
if (r<dlsch->harq_processes[harq_pid]->Cminus) //if (r<dlsch->harq_processes[harq_pid]->Cminus)
Kr = dlsch->harq_processes[harq_pid]->Kminus; // Kr = dlsch->harq_processes[harq_pid]->Kminus;
else //else
Kr = dlsch->harq_processes[harq_pid]->Kplus; Kr = dlsch->harq_processes[harq_pid]->Kplus;
Kr_bytes = Kr>>3; Kr_bytes = Kr>>3;
...@@ -655,7 +667,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB, ...@@ -655,7 +667,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
iind = 123 + ((Kr_bytes-256)>>3); iind = 123 + ((Kr_bytes-256)>>3);
else { else {
printf("dlsch_coding: Illegal codeword size %d!!!\n",Kr_bytes); printf("dlsch_coding: Illegal codeword size %d!!!\n",Kr_bytes);
return(-1); // return(-1);
} }
...@@ -680,6 +692,14 @@ int dlsch_encoding(PHY_VARS_eNB *eNB, ...@@ -680,6 +692,14 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
printf("turbo tbc number %d input %d\n",tbc_counter, dlsch->harq_processes[harq_pid]->c[r][tbc_counter]); printf("turbo tbc number %d input %d\n",tbc_counter, dlsch->harq_processes[harq_pid]->c[r][tbc_counter]);
} }
printf("start encoder kr %d kr>>3 %d\n", Kr, Kr>>3);
for (int tbs_counter = 0; tbs_counter< Kr>>3; tbs_counter++){
printf("%d\n", dlsch->harq_processes[harq_pid]->c[r][tbs_counter]);
}
printf("end encoder \n");
#ifdef TD_DECODING
threegpplte_turbo_encoder(dlsch->harq_processes[harq_pid]->c[r], threegpplte_turbo_encoder(dlsch->harq_processes[harq_pid]->c[r],
Kr>>3, Kr>>3,
&dlsch->harq_processes[harq_pid]->d[r][96], &dlsch->harq_processes[harq_pid]->d[r][96],
...@@ -687,15 +707,24 @@ int dlsch_encoding(PHY_VARS_eNB *eNB, ...@@ -687,15 +707,24 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
f1f2mat_old[iind*2], // f1 (see 36121-820, page 14) f1f2mat_old[iind*2], // f1 (see 36121-820, page 14)
f1f2mat_old[(iind*2)+1] // f2 (see 36121-820, page 14) f1f2mat_old[(iind*2)+1] // f2 (see 36121-820, page 14)
); );
#else
/*printf("start ldpc encoder\n"); printf("start ldpc encoder\n");
printf("input %d %d %d %d %d \n", dlsch->harq_processes[harq_pid]->c[r][0], dlsch->harq_processes[harq_pid]->c[r][1], dlsch->harq_processes[harq_pid]->c[r][2],dlsch->harq_processes[harq_pid]->c[r][3], dlsch->harq_processes[harq_pid]->c[r][4]); printf("input %d %d %d %d %d \n", dlsch->harq_processes[harq_pid]->c[r][0], dlsch->harq_processes[harq_pid]->c[r][1], dlsch->harq_processes[harq_pid]->c[r][2],dlsch->harq_processes[harq_pid]->c[r][3], dlsch->harq_processes[harq_pid]->c[r][4]);
ldpc_encoder((char*)dlsch->harq_processes[harq_pid]->c[r],(char*)&dlsch->harq_processes[harq_pid]->d[r][96],dlsch->harq_processes[harq_pid]->B,rate); ldpc_encoder((char*)dlsch->harq_processes[harq_pid]->c[r],(char*)&dlsch->harq_processes[harq_pid]->d[r][96],dlsch->harq_processes[harq_pid]->B,rate);
printf("end ldpc encoder\n"); ldpc_encoder((unsigned char*)dlsch->harq_processes[harq_pid]->c[r],&dlsch->harq_processes[harq_pid]->d[r][96],dlsch->harq_processes[harq_pid]->B,rate);
printf("output %d %d %d %d %d \n", dlsch->harq_processes[harq_pid]->d[r][96], dlsch->harq_processes[harq_pid]->d[r][96+1], dlsch->harq_processes[harq_pid]->d[r][96+2],dlsch->harq_processes[harq_pid]->d[r][96+3], dlsch->harq_processes[harq_pid]->d[r][96+4]);
*/ #endif
printf("end ldpc encoder -- output\n");
//printf("output %d %d %d %d %d \n", dlsch->harq_processes[harq_pid]->d[r][96], dlsch->harq_processes[harq_pid]->d[r][96+1], dlsch->harq_processes[harq_pid]->d[r][96+2],dlsch->harq_processes[harq_pid]->d[r][96+3], dlsch->harq_processes[harq_pid]->d[r][96+4]);
for (int cnt =0 ; cnt < 66*128; cnt ++){
printf("%d \n", dlsch->harq_processes[harq_pid]->d[r][96+cnt]);
}
printf("\n");
stop_meas(te_stats); stop_meas(te_stats);
#ifdef DEBUG_DLSCH_CODING #ifdef DEBUG_DLSCH_CODING
......
...@@ -37,16 +37,18 @@ ...@@ -37,16 +37,18 @@
#include "SCHED/extern.h" #include "SCHED/extern.h"
#include "SIMULATION/TOOLS/defs.h" #include "SIMULATION/TOOLS/defs.h"
#include "targets/RT/USER/lte-softmodem.h" #include "targets/RT/USER/lte-softmodem.h"
#include "PHY/CODING/nrLDPC_decoder.h"
#include "PHY/CODING/nrLDPC_types.h" #include "PHY/CODING/nrLDPC_types.h"
//#define DEBUG_DLSCH_DECODING //#define DEBUG_DLSCH_DECODING
//#define TD_DECODING
#define OAI_LDPC_MAX_NUM_LLR 26112 // NR_LDPC_NCOL_BG1*NR_LDPC_ZMAX #define OAI_LDPC_MAX_NUM_LLR 26112 // NR_LDPC_NCOL_BG1*NR_LDPC_ZMAX
static int8_t llrRes [OAI_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32))); static int8_t llrRes [OAI_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32)));
static int8_t llrProcBuf[OAI_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32))); static int8_t llrProcBuf[OAI_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32)));
//__m128i* p_llrRes; static uint8_t ullrProcBuf[OAI_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32)));
//__m128i* p_llrRes = (__m128i*) &llrRes [0];
extern double cpuf; extern double cpuf;
...@@ -193,22 +195,20 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, ...@@ -193,22 +195,20 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
uint8_t crc_type; uint8_t crc_type;
t_nrLDPC_dec_params decParams; t_nrLDPC_dec_params decParams;
t_nrLDPC_dec_params* p_decParams = &decParams; t_nrLDPC_dec_params* p_decParams = &decParams;
int8_t llrOut_inter;
int8_t* p_llrOut_inter = &llrOut_inter;
__m256i ymm0, ymm1, ymmRes0, ymmRes1;
t_nrLDPC_time_stats procTime; t_nrLDPC_time_stats procTime;
t_nrLDPC_time_stats* p_procTime =&procTime ; t_nrLDPC_time_stats* p_procTime =&procTime ;
/*p_procTime->llr2llrProcBuf = 0.0; int16_t z [68*128];
p_procTime->llr2CnProcBuf= 0.0; int8_t l [68*128];
p_procTime->cnProc= 0.0; //__m128i l;
p_procTime->bnProcPc=0.0;
p_procTime->bnProc=0.0; uint32_t i,j;
p_procTime->cn2bnProcBuf=0.0; uint32_t k;
p_procTime->bn2cnProcBuf=0.0;
p_procTime->llrRes2llrOut=0.0; __m128i *pv = (__m128i*)&z;
p_procTime->llr2bit=0.0; __m128i *pl = (__m128i*)&l;
p_procTime->total=0.0;*/
#ifdef DEBUG_DLSCH_DECODING #ifdef DEBUG_DLSCH_DECODING
uint16_t i; uint16_t i;
#endif #endif
...@@ -347,9 +347,11 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, ...@@ -347,9 +347,11 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
} }
p_decParams->Z = 128; p_decParams->Z = 128;
p_decParams->BG = 2; p_decParams->BG = 1;
p_decParams->R = 13; p_decParams->R = 13;
p_decParams->numMaxIter = 5; p_decParams->numMaxIter = 2;
Kr = p_decParams->Z*22;
p_decParams->outMode= 0;
/* /*
else { else {
...@@ -533,8 +535,23 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, ...@@ -533,8 +535,23 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
start_meas(dlsch_turbo_decoding_stats); start_meas(dlsch_turbo_decoding_stats);
#endif #endif
LOG_D(PHY,"AbsSubframe %d.%d Start turbo segment %d/%d \n",frame%1024,nr_tti_rx,r,harq_process->C-1); LOG_D(PHY,"AbsSubframe %d.%d Start turbo segment %d/%d \n",frame%1024,nr_tti_rx,r,harq_process->C-1);
//if (decoder_switch ==0){
/*ret = tc printf("harq process dr \n");
for (int cnt =0; cnt < 66*p_decParams->Z; cnt++){
printf("%d \n", harq_process->d[r][96+cnt]);
}
printf(" \n");
/*printf("end dr \n");
for (int cnt =(50*p_decParams->Z-16) ; cnt < 50*p_decParams->Z; cnt++){
printf("%d ", harq_process->d[r][96+cnt]);
}
printf(" \n");*/
#ifdef TD_DECODING
ret = tc
(&harq_process->d[r][96], (&harq_process->d[r][96],
harq_process->c[r], harq_process->c[r],
Kr, Kr,
...@@ -549,36 +566,33 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, ...@@ -549,36 +566,33 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
&phy_vars_ue->dlsch_tc_gamma_stats, &phy_vars_ue->dlsch_tc_gamma_stats,
&phy_vars_ue->dlsch_tc_ext_stats, &phy_vars_ue->dlsch_tc_ext_stats,
&phy_vars_ue->dlsch_tc_intl1_stats, &phy_vars_ue->dlsch_tc_intl1_stats,
&phy_vars_ue->dlsch_tc_intl2_stats);*/ &phy_vars_ue->dlsch_tc_intl2_stats);
//(is_crnti==0)?harq_pid:harq_pid+1); //(is_crnti==0)?harq_pid:harq_pid+1);
//} #else
//else{
memset(pv,0,2*p_decParams->Z*sizeof(int16_t));
//memset(pl,0,2*p_decParams->Z*sizeof(int8_t));
/*nrLDPC_decoder(p_decParams, for (i=2*p_decParams->Z/8, j = 0; i < (68*p_decParams->Z/8+1); i++, j++)
&harq_process->d[r][96], {
harq_process->c[r], pv[i]= _mm_loadu_si128((__m128i*)&harq_process->d[r][96+8*j]);
p_procTime);} }
*/
//__m256i *m11_128
//llrRes = &harq_process->d[r][96];
printf("start LDPC decoder\n"); for (i=0, j=0; j < (68*p_decParams->Z/16); i+=2, j++)
/*nrLDPC_decoder(p_decParams, {
llrRes, //printf("mm packs i %d j %d\n", i, j);
llrProcBuf, //print128_num(pv[i]);
p_procTime);*/ //print128_num(pv[i+1]);
//harq_process->c[r] = (uint8_t *) p_llrOut_inter; pl[j] = _mm_packs_epi16(pv[i],pv[i+1]);
printf("harq process dr %d @dr %d llrRes %d \n",harq_process->d[r][96], &harq_process->d[r][96], llrRes); //print128_num2bytes(pl[j]);
}
nrLDPC_decoder(p_decParams, nrLDPC_decoder(p_decParams,
&harq_process->d[r][96], &pl[0],
// llrRes, llrProcBuf,
harq_process->c[r],
p_procTime); p_procTime);
//} #endif
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
......
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