merge from Laurent's TX-optimization-lts (cherry-picked dlsch_encoding component)
This commit is contained in:
@@ -314,9 +314,9 @@ add_definitions("-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAV
|
|||||||
set(commonOpts "-pipe -Wno-packed-bitfield-compat -fPIC -Wall -fno-strict-aliasing -rdynamic")
|
set(commonOpts "-pipe -Wno-packed-bitfield-compat -fPIC -Wall -fno-strict-aliasing -rdynamic")
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS
|
set(CMAKE_C_FLAGS
|
||||||
"${CMAKE_C_FLAGS} ${C_FLAGS_PROCESSOR} ${commonOpts} -std=gnu99 -funroll-loops")
|
"${CMAKE_C_FLAGS} ${C_FLAGS_PROCESSOR} ${commonOpts} -std=gnu99 -funroll-loops -march=native")
|
||||||
set(CMAKE_CXX_FLAGS
|
set(CMAKE_CXX_FLAGS
|
||||||
"${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} ${commonOpts} -std=c++11")
|
"${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} ${commonOpts} -std=c++11 -march=native")
|
||||||
|
|
||||||
# cuda compiler bug (limitation) on complex macro definition
|
# cuda compiler bug (limitation) on complex macro definition
|
||||||
if (CUDA_FOUND)
|
if (CUDA_FOUND)
|
||||||
@@ -332,11 +332,11 @@ endif ()
|
|||||||
add_definitions("-DASN_DISABLE_OER_SUPPORT")
|
add_definitions("-DASN_DISABLE_OER_SUPPORT")
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ggdb3 -Wl,-rpath -Wl,${CMAKE_CURRENT_BINARY_DIR}")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ggdb2 -Wl,-rpath -Wl,${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
#########################
|
#########################
|
||||||
# set a flag for changes in the source code
|
# set a flag for changes in the source code
|
||||||
# these changes are related to hardcoded path to include .h files
|
# these changes are related to hardcoded path to include .h files
|
||||||
set(debugOpt "-ggdb3 -DMALLOC_CHECK_=3 -fno-delete-null-pointer-checks")
|
set(debugOpt "-ggdb2 -DMALLOC_CHECK_=3 -fno-delete-null-pointer-checks")
|
||||||
set(CMAKE_C_FLAGS_DEBUG "${debugOpt} -O0")
|
set(CMAKE_C_FLAGS_DEBUG "${debugOpt} -O0")
|
||||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${debugOpt} -O2")
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${debugOpt} -O2")
|
||||||
set(CMAKE_C_FLAGS_RELEASE "-O3")
|
set(CMAKE_C_FLAGS_RELEASE "-O3")
|
||||||
|
|||||||
@@ -387,15 +387,15 @@ void init_gNB_Tpool(int inst) {
|
|||||||
LOG_I(PHY,"Number of threads requested in config file: %d, Number of threads available on this machine: %d\n",gNB->pusch_proc_threads,numCPU);
|
LOG_I(PHY,"Number of threads requested in config file: %d, Number of threads available on this machine: %d\n",gNB->pusch_proc_threads,numCPU);
|
||||||
int threadCnt = min(numCPU, gNB->pusch_proc_threads);
|
int threadCnt = min(numCPU, gNB->pusch_proc_threads);
|
||||||
if (threadCnt < 2) LOG_E(PHY,"Number of threads for gNB should be more than 1. Allocated only %d\n",threadCnt);
|
if (threadCnt < 2) LOG_E(PHY,"Number of threads for gNB should be more than 1. Allocated only %d\n",threadCnt);
|
||||||
char ul_pool[80];
|
char pool[80];
|
||||||
sprintf(ul_pool,"-1");
|
sprintf(pool,"-1");
|
||||||
int s_offset = 0;
|
int s_offset = 0;
|
||||||
for (int icpu=1; icpu<threadCnt; icpu++) {
|
for (int icpu=1; icpu<threadCnt; icpu++) {
|
||||||
sprintf(ul_pool+2+s_offset,",-1");
|
sprintf(pool+2+s_offset,",-1");
|
||||||
s_offset += 3;
|
s_offset += 3;
|
||||||
}
|
}
|
||||||
if (getenv("noThreads")) strcpy(ul_pool, "n");
|
if (getenv("noThreads")) strcpy(pool, "n");
|
||||||
initTpool(ul_pool, gNB->threadPool, false);
|
initTpool(pool, gNB->threadPool, false);
|
||||||
// ULSCH decoder result FIFO
|
// ULSCH decoder result FIFO
|
||||||
gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
|
gNB->respDecode = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
|
||||||
initNotifiedFIFO(gNB->respDecode);
|
initNotifiedFIFO(gNB->respDecode);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
// encoder interface
|
// encoder interface
|
||||||
#ifndef __NRLDPC_DEFS__H__
|
#ifndef __NRLDPC_DEFS__H__
|
||||||
#define __NRLDPC_DEFS__H__
|
#define __NRLDPC_DEFS__H__
|
||||||
|
#include <openair1/PHY/defs_nr_common.h>
|
||||||
#include "openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_types.h"
|
#include "openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_types.h"
|
||||||
/**
|
/**
|
||||||
\brief LDPC encoder
|
\brief LDPC encoder
|
||||||
@@ -36,13 +37,27 @@
|
|||||||
\param 9-12 time_stats_t *tinput,*tprep, *tparity,*toutput
|
\param 9-12 time_stats_t *tinput,*tprep, *tparity,*toutput
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int n_segments; // optim8seg
|
unsigned int n_segments; // optim8seg
|
||||||
unsigned int macro_num; // optim8segmulti
|
unsigned int macro_num; // optim8segmulti
|
||||||
unsigned char gen_code; //orig
|
unsigned char gen_code; //orig
|
||||||
time_stats_t *tinput;
|
time_stats_t *tinput;
|
||||||
time_stats_t *tprep;
|
time_stats_t *tprep;
|
||||||
time_stats_t *tparity;
|
time_stats_t *tparity;
|
||||||
time_stats_t *toutput;
|
time_stats_t *toutput;
|
||||||
|
int Kr;
|
||||||
|
uint32_t Kb;
|
||||||
|
uint32_t *Zc;
|
||||||
|
void *harq;
|
||||||
|
/// Encoder BG
|
||||||
|
uint8_t BG;
|
||||||
|
/// Interleaver outputs
|
||||||
|
unsigned char *output;
|
||||||
|
/// Number of bits in "small" code segments
|
||||||
|
uint32_t K;
|
||||||
|
/// Number of "Filler" bits
|
||||||
|
uint32_t F;
|
||||||
|
/// LDPC-code outputs
|
||||||
|
uint8_t *d[MAX_NUM_NR_DLSCH_SEGMENTS];
|
||||||
}encoder_implemparams_t;
|
}encoder_implemparams_t;
|
||||||
#define INIT0_LDPCIMPLEMPARAMS {0,0,0,NULL,NULL,NULL,NULL}
|
#define INIT0_LDPCIMPLEMPARAMS {0,0,0,NULL,NULL,NULL,NULL}
|
||||||
typedef int(*nrLDPC_encoderfunc_t)(unsigned char **,unsigned char **,int,int,short, short, encoder_implemparams_t*);
|
typedef int(*nrLDPC_encoderfunc_t)(unsigned char **,unsigned char **,int,int,short, short, encoder_implemparams_t*);
|
||||||
@@ -56,4 +71,4 @@ typedef int(*nrLDPC_encoderfunc_t)(unsigned char **,unsigned char **,int,int,sho
|
|||||||
\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_procBuf* , t_nrLDPC_time_stats* );
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -73,9 +73,18 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static inline void encode_parity_check_part_optim(uint8_t *c,uint8_t *d, short BG,short Zc,short Kb)
|
static void encode_parity_check_part_optim(uint8_t *cc,uint8_t *d, short BG,short Zc,short Kb, int simd_size, int ncols)
|
||||||
{
|
{
|
||||||
|
unsigned char c[2*22*Zc*simd_size] __attribute__((aligned(32))); //double size matrix of c
|
||||||
|
|
||||||
|
for (int i1=0; i1 < ncols; i1++) {
|
||||||
|
memcpy(&c[2*i1*Zc], &cc[i1*Zc], Zc*sizeof(unsigned char));
|
||||||
|
memcpy(&c[(2*i1+1)*Zc], &cc[i1*Zc], Zc*sizeof(unsigned char));
|
||||||
|
}
|
||||||
|
for (int i1=1;i1<simd_size;i1++) {
|
||||||
|
memcpy(&c[(2*ncols*Zc*i1)], &c[i1], (2*ncols*Zc*sizeof(unsigned char))-i1);
|
||||||
|
}
|
||||||
|
|
||||||
if (BG==1)
|
if (BG==1)
|
||||||
{
|
{
|
||||||
switch (Zc)
|
switch (Zc)
|
||||||
|
|||||||
@@ -86,8 +86,6 @@ int nrLDPC_encod(unsigned char **test_input,unsigned char **channel_input,int Zc
|
|||||||
unsigned char c[22*Zc] __attribute__((aligned(32))); //padded input, unpacked, max size
|
unsigned char c[22*Zc] __attribute__((aligned(32))); //padded input, unpacked, max size
|
||||||
unsigned char d[46*Zc] __attribute__((aligned(32))); //coded parity part output, unpacked, max size
|
unsigned char d[46*Zc] __attribute__((aligned(32))); //coded parity part output, unpacked, max size
|
||||||
|
|
||||||
unsigned char c_extension[2*22*Zc*simd_size] __attribute__((aligned(32))); //double size matrix of c
|
|
||||||
|
|
||||||
// calculate number of punctured bits
|
// calculate number of punctured bits
|
||||||
no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*rate)/Zc;
|
no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*rate)/Zc;
|
||||||
removed_bit=(nrows-no_punctured_columns-2) * Zc+block_length-(int)(block_length*rate);
|
removed_bit=(nrows-no_punctured_columns-2) * Zc+block_length-(int)(block_length*rate);
|
||||||
@@ -108,24 +106,10 @@ int nrLDPC_encod(unsigned char **test_input,unsigned char **channel_input,int Zc
|
|||||||
if ((BG==1 && Zc>176) || (BG==2 && Zc>64)) {
|
if ((BG==1 && Zc>176) || (BG==2 && Zc>64)) {
|
||||||
// extend matrix
|
// extend matrix
|
||||||
if(impp->tprep != NULL) start_meas(impp->tprep);
|
if(impp->tprep != NULL) start_meas(impp->tprep);
|
||||||
for (i1=0; i1 < ncols; i1++)
|
|
||||||
{
|
|
||||||
memcpy(&c_extension[2*i1*Zc], &c[i1*Zc], Zc*sizeof(unsigned char));
|
|
||||||
memcpy(&c_extension[(2*i1+1)*Zc], &c[i1*Zc], Zc*sizeof(unsigned char));
|
|
||||||
}
|
|
||||||
for (i1=1;i1<simd_size;i1++) {
|
|
||||||
memcpy(&c_extension[(2*ncols*Zc*i1)], &c_extension[i1], (2*ncols*Zc*sizeof(unsigned char))-i1);
|
|
||||||
// memset(&c_extension[(2*ncols*Zc*i1)],0,i1);
|
|
||||||
/*
|
|
||||||
printf("shift %d: ",i1);
|
|
||||||
for (int j=0;j<64;j++) printf("%d ",c_extension[(2*ncols*Zc*i1)+j]);
|
|
||||||
printf("\n");
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
if(impp->tprep != NULL) stop_meas(impp->tprep);
|
if(impp->tprep != NULL) stop_meas(impp->tprep);
|
||||||
//parity check part
|
//parity check part
|
||||||
if(impp->tparity != NULL) start_meas(impp->tparity);
|
if(impp->tparity != NULL) start_meas(impp->tparity);
|
||||||
encode_parity_check_part_optim(c_extension, d, BG, Zc, Kb);
|
encode_parity_check_part_optim(c, d, BG, Zc, Kb,simd_size, ncols);
|
||||||
if(impp->tparity != NULL) stop_meas(impp->tparity);
|
if(impp->tparity != NULL) stop_meas(impp->tparity);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -102,7 +102,6 @@ int nrLDPC_encod(unsigned char **test_input,unsigned char **channel_input,int Zc
|
|||||||
unsigned char c[22*Zc] __attribute__((aligned(32))); //padded input, unpacked, max size
|
unsigned char c[22*Zc] __attribute__((aligned(32))); //padded input, unpacked, max size
|
||||||
unsigned char d[46*Zc] __attribute__((aligned(32))); //coded parity part output, unpacked, max size
|
unsigned char d[46*Zc] __attribute__((aligned(32))); //coded parity part output, unpacked, max size
|
||||||
|
|
||||||
unsigned char c_extension[2*22*Zc*simd_size] __attribute__((aligned(32))); //double size matrix of c
|
|
||||||
|
|
||||||
// calculate number of punctured bits
|
// calculate number of punctured bits
|
||||||
no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*rate)/Zc;
|
no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*rate)/Zc;
|
||||||
@@ -151,24 +150,10 @@ int nrLDPC_encod(unsigned char **test_input,unsigned char **channel_input,int Zc
|
|||||||
if ((BG==1 && Zc>176) || (BG==2 && Zc>64)) {
|
if ((BG==1 && Zc>176) || (BG==2 && Zc>64)) {
|
||||||
// extend matrix
|
// extend matrix
|
||||||
if(impp->tprep != NULL) start_meas(impp->tprep);
|
if(impp->tprep != NULL) start_meas(impp->tprep);
|
||||||
for (i1=0; i1 < ncols; i1++)
|
|
||||||
{
|
|
||||||
memcpy(&c_extension[2*i1*Zc], &c[i1*Zc], Zc*sizeof(unsigned char));
|
|
||||||
memcpy(&c_extension[(2*i1+1)*Zc], &c[i1*Zc], Zc*sizeof(unsigned char));
|
|
||||||
}
|
|
||||||
for (i1=1;i1<simd_size;i1++) {
|
|
||||||
memcpy(&c_extension[(2*ncols*Zc*i1)], &c_extension[i1], (2*ncols*Zc*sizeof(unsigned char))-i1);
|
|
||||||
// memset(&c_extension[(2*ncols*Zc*i1)],0,i1);
|
|
||||||
/*
|
|
||||||
printf("shift %d: ",i1);
|
|
||||||
for (int j=0;j<64;j++) printf("%d ",c_extension[(2*ncols*Zc*i1)+j]);
|
|
||||||
printf("\n");
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
if(impp->tprep != NULL) stop_meas(impp->tprep);
|
if(impp->tprep != NULL) stop_meas(impp->tprep);
|
||||||
//parity check part
|
//parity check part
|
||||||
if(impp->tparity != NULL) start_meas(impp->tparity);
|
if(impp->tparity != NULL) start_meas(impp->tparity);
|
||||||
encode_parity_check_part_optim(c_extension, d, BG, Zc, Kb);
|
encode_parity_check_part_optim(c, d, BG, Zc, Kb, simd_size, ncols);
|
||||||
if(impp->tparity != NULL) stop_meas(impp->tparity);
|
if(impp->tparity != NULL) stop_meas(impp->tparity);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -38,18 +38,19 @@
|
|||||||
#include "common/utils/LOG/log.h"
|
#include "common/utils/LOG/log.h"
|
||||||
#include "PHY/TOOLS/time_meas.h"
|
#include "PHY/TOOLS/time_meas.h"
|
||||||
#include "openair1/PHY/CODING/nrLDPC_defs.h"
|
#include "openair1/PHY/CODING/nrLDPC_defs.h"
|
||||||
|
#define DEBUG_LDPC
|
||||||
//#define DEBUG_LDPC
|
|
||||||
|
|
||||||
#include "ldpc_encode_parity_check.c"
|
#include "ldpc_encode_parity_check.c"
|
||||||
#include "ldpc_generate_coefficient.c"
|
#include "ldpc_generate_coefficient.c"
|
||||||
|
|
||||||
|
|
||||||
int nrLDPC_encod(unsigned char **test_input,unsigned char **channel_input,int Zc,int Kb,short block_length, short BG, encoder_implemparams_t *impp)
|
int nrLDPC_encod(unsigned char **input,unsigned char **output,int Zc,int Kb,short block_length, short BG, encoder_implemparams_t *impp)
|
||||||
{
|
{
|
||||||
|
//set_log(PHY, 4);
|
||||||
|
|
||||||
|
|
||||||
short nrows=0,ncols=0;
|
int nrows=0,ncols=0;
|
||||||
int i,i1,j,rate=3;
|
int rate=3;
|
||||||
int no_punctured_columns,removed_bit;
|
int no_punctured_columns,removed_bit;
|
||||||
//Table of possible lifting sizes
|
//Table of possible lifting sizes
|
||||||
char temp;
|
char temp;
|
||||||
@@ -95,8 +96,8 @@ int nrLDPC_encod(unsigned char **test_input,unsigned char **channel_input,int Zc
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_LDPC
|
#ifdef DEBUG_LDPC
|
||||||
LOG_D(PHY,"ldpc_encoder_optim_8seg: BG %d, Zc %d, Kb %d, block_length %d, segments %d\n",BG,Zc,Kb,block_length,n_segments);
|
LOG_D(PHY,"ldpc_encoder_optim_8seg: BG %d, Zc %d, Kb %d, block_length %d, segments %d\n",BG,Zc,Kb,block_length,impp->n_segments);
|
||||||
LOG_D(PHY,"ldpc_encoder_optim_8seg: PDU (seg 0) %x %x %x %x\n",test_input[0][0],test_input[0][1],test_input[0][2],test_input[0][3]);
|
LOG_D(PHY,"ldpc_encoder_optim_8seg: PDU (seg 0) %x %x %x %x\n",input[0][0],input[0][1],input[0][2],input[0][3]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AssertFatal(Zc>0,"no valid Zc found for block length %d\n",block_length);
|
AssertFatal(Zc>0,"no valid Zc found for block length %d\n",block_length);
|
||||||
@@ -104,10 +105,8 @@ int nrLDPC_encod(unsigned char **test_input,unsigned char **channel_input,int Zc
|
|||||||
if ((Zc&31) > 0) simd_size = 16;
|
if ((Zc&31) > 0) simd_size = 16;
|
||||||
else simd_size = 32;
|
else simd_size = 32;
|
||||||
|
|
||||||
unsigned char c[22*Zc] __attribute__((aligned(32))); //padded input, unpacked, max size
|
unsigned char cc[22*Zc] __attribute__((aligned(32))); //padded input, unpacked, max size
|
||||||
unsigned char d[46*Zc] __attribute__((aligned(32))); //coded parity part output, unpacked, max size
|
unsigned char dd[46*Zc] __attribute__((aligned(32))); //coded parity part output, unpacked, max size
|
||||||
|
|
||||||
unsigned char c_extension[2*22*Zc*simd_size] __attribute__((aligned(32))); //double size matrix of c
|
|
||||||
|
|
||||||
// calculate number of punctured bits
|
// calculate number of punctured bits
|
||||||
no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*rate)/Zc;
|
no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*rate)/Zc;
|
||||||
@@ -115,8 +114,8 @@ int nrLDPC_encod(unsigned char **test_input,unsigned char **channel_input,int Zc
|
|||||||
//printf("%d\n",no_punctured_columns);
|
//printf("%d\n",no_punctured_columns);
|
||||||
//printf("%d\n",removed_bit);
|
//printf("%d\n",removed_bit);
|
||||||
// unpack input
|
// unpack input
|
||||||
memset(c,0,sizeof(unsigned char) * ncols * Zc);
|
memset(cc,0,sizeof(unsigned char) * ncols * Zc);
|
||||||
memset(d,0,sizeof(unsigned char) * nrows * Zc);
|
memset(dd,0,sizeof(unsigned char) * nrows * Zc);
|
||||||
|
|
||||||
if(impp->tinput != NULL) start_meas(impp->tinput);
|
if(impp->tinput != NULL) start_meas(impp->tinput);
|
||||||
#if 0
|
#if 0
|
||||||
@@ -124,29 +123,29 @@ int nrLDPC_encod(unsigned char **test_input,unsigned char **channel_input,int Zc
|
|||||||
//for (j=0; j<n_segments; j++) {
|
//for (j=0; j<n_segments; j++) {
|
||||||
for (j=macro_segment; j < macro_segment_end; j++) {
|
for (j=macro_segment; j < macro_segment_end; j++) {
|
||||||
|
|
||||||
temp = (test_input[j][i/8]&(1<<(i&7)))>>(i&7);
|
temp = (input[j][i/8]&(1<<(i&7)))>>(i&7);
|
||||||
//printf("c(%d,%d)=%d\n",j,i,temp);
|
//printf("c(%d,%d)=%d\n",j,i,temp);
|
||||||
c[i] |= (temp << (j-macro_segment));
|
c[i] |= (temp << (j-macro_segment));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#ifdef __AVX2__
|
#ifdef __AVX2__
|
||||||
for (i=0; i<block_length>>5; i++) {
|
for (int i=0; i<block_length>>5; i++) {
|
||||||
c256 = _mm256_and_si256(_mm256_cmpeq_epi8(_mm256_andnot_si256(_mm256_shuffle_epi8(_mm256_set1_epi32(((uint32_t*)test_input[macro_segment])[i]), shufmask),andmask),zero256),masks[0]);
|
c256 = _mm256_and_si256(_mm256_cmpeq_epi8(_mm256_andnot_si256(_mm256_shuffle_epi8(_mm256_set1_epi32(((uint32_t*)input[macro_segment])[i]), shufmask),andmask),zero256),masks[0]);
|
||||||
//for (j=1; j<n_segments; j++) {
|
//for (j=1; j<n_segments; j++) {
|
||||||
for (j=macro_segment+1; j < macro_segment_end; j++) {
|
for (int j=macro_segment+1; j < macro_segment_end; j++) {
|
||||||
c256 = _mm256_or_si256(_mm256_and_si256(_mm256_cmpeq_epi8(_mm256_andnot_si256(_mm256_shuffle_epi8(_mm256_set1_epi32(((uint32_t*)test_input[j])[i]), shufmask),andmask),zero256),masks[j-macro_segment]),c256);
|
c256 = _mm256_or_si256(_mm256_and_si256(_mm256_cmpeq_epi8(_mm256_andnot_si256(_mm256_shuffle_epi8(_mm256_set1_epi32(((uint32_t*)input[j])[i]), shufmask),andmask),zero256),masks[j-macro_segment]),c256);
|
||||||
}
|
}
|
||||||
((__m256i *)c)[i] = c256;
|
((__m256i *)cc)[i] = c256;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=(block_length>>5)<<5;i<block_length;i++) {
|
for (int i=(block_length>>5)<<5;i<block_length;i++) {
|
||||||
//for (j=0; j<n_segments; j++) {
|
//for (j=0; j<n_segments; j++) {
|
||||||
for (j=macro_segment; j < macro_segment_end; j++) {
|
for (int j=macro_segment; j < macro_segment_end; j++) {
|
||||||
|
|
||||||
temp = (test_input[j][i/8]&(128>>(i&7)))>>(7-(i&7));
|
temp = (input[j][i/8]&(128>>(i&7)))>>(7-(i&7));
|
||||||
//printf("c(%d,%d)=%d\n",j,i,temp);
|
//printf("c(%d,%d)=%d\n",j,i,temp);
|
||||||
c[i] |= (temp << (j-macro_segment));
|
cc[i] |= (temp << (j-macro_segment));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@@ -159,28 +158,14 @@ int nrLDPC_encod(unsigned char **test_input,unsigned char **channel_input,int Zc
|
|||||||
if ((BG==1 && Zc>176) || (BG==2 && Zc>64)) {
|
if ((BG==1 && Zc>176) || (BG==2 && Zc>64)) {
|
||||||
// extend matrix
|
// extend matrix
|
||||||
if(impp->tprep != NULL) start_meas(impp->tprep);
|
if(impp->tprep != NULL) start_meas(impp->tprep);
|
||||||
for (i1=0; i1 < ncols; i1++)
|
|
||||||
{
|
|
||||||
memcpy(&c_extension[2*i1*Zc], &c[i1*Zc], Zc*sizeof(unsigned char));
|
|
||||||
memcpy(&c_extension[(2*i1+1)*Zc], &c[i1*Zc], Zc*sizeof(unsigned char));
|
|
||||||
}
|
|
||||||
for (i1=1;i1<simd_size;i1++) {
|
|
||||||
memcpy(&c_extension[(2*ncols*Zc*i1)], &c_extension[i1], (2*ncols*Zc*sizeof(unsigned char))-i1);
|
|
||||||
// memset(&c_extension[(2*ncols*Zc*i1)],0,i1);
|
|
||||||
/*
|
|
||||||
printf("shift %d: ",i1);
|
|
||||||
for (int j=0;j<64;j++) printf("%d ",c_extension[(2*ncols*Zc*i1)+j]);
|
|
||||||
printf("\n");
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
if(impp->tprep != NULL) stop_meas(impp->tprep);
|
if(impp->tprep != NULL) stop_meas(impp->tprep);
|
||||||
//parity check part
|
//parity check part
|
||||||
if(impp->tparity != NULL) start_meas(impp->tparity);
|
if(impp->tparity != NULL) start_meas(impp->tparity);
|
||||||
encode_parity_check_part_optim(c_extension, d, BG, Zc, Kb);
|
encode_parity_check_part_optim(cc, dd, BG, Zc, Kb, simd_size, ncols);
|
||||||
if(impp->tparity != NULL) stop_meas(impp->tparity);
|
if(impp->tparity != NULL) stop_meas(impp->tparity);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (encode_parity_check_part_orig(c, d, BG, Zc, Kb, block_length)!=0) {
|
if (encode_parity_check_part_orig(cc, dd, BG, Zc, Kb, block_length)!=0) {
|
||||||
printf("Problem with encoder\n");
|
printf("Problem with encoder\n");
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
@@ -188,8 +173,8 @@ int nrLDPC_encod(unsigned char **test_input,unsigned char **channel_input,int Zc
|
|||||||
if(impp->toutput != NULL) start_meas(impp->toutput);
|
if(impp->toutput != NULL) start_meas(impp->toutput);
|
||||||
// information part and puncture columns
|
// information part and puncture columns
|
||||||
/*
|
/*
|
||||||
memcpy(&channel_input[0], &c[2*Zc], (block_length-2*Zc)*sizeof(unsigned char));
|
memcpy(&output[0], &c[2*Zc], (block_length-2*Zc)*sizeof(unsigned char));
|
||||||
memcpy(&channel_input[block_length-2*Zc], &d[0], ((nrows-no_punctured_columns) * Zc-removed_bit)*sizeof(unsigned char));
|
memcpy(&output[block_length-2*Zc], &d[0], ((nrows-no_punctured_columns) * Zc-removed_bit)*sizeof(unsigned char));
|
||||||
*/
|
*/
|
||||||
#ifdef __AVX2__
|
#ifdef __AVX2__
|
||||||
if ((((2*Zc)&31) == 0) && (((block_length-(2*Zc))&31) == 0)) {
|
if ((((2*Zc)&31) == 0) && (((block_length-(2*Zc))&31) == 0)) {
|
||||||
@@ -197,34 +182,34 @@ int nrLDPC_encod(unsigned char **test_input,unsigned char **channel_input,int Zc
|
|||||||
//AssertFatal(((block_length-(2*Zc))&31) == 0,"block_length-(2*Zc) needs to be a multiple of 32 for now\n");
|
//AssertFatal(((block_length-(2*Zc))&31) == 0,"block_length-(2*Zc) needs to be a multiple of 32 for now\n");
|
||||||
uint32_t l1 = (block_length-(2*Zc))>>5;
|
uint32_t l1 = (block_length-(2*Zc))>>5;
|
||||||
uint32_t l2 = ((nrows-no_punctured_columns) * Zc-removed_bit)>>5;
|
uint32_t l2 = ((nrows-no_punctured_columns) * Zc-removed_bit)>>5;
|
||||||
__m256i *c256p = (__m256i *)&c[2*Zc];
|
__m256i *c256p = (__m256i *)&cc[2*Zc];
|
||||||
__m256i *d256p = (__m256i *)&d[0];
|
__m256i *d256p = (__m256i *)&dd[0];
|
||||||
// if (((block_length-(2*Zc))&31)>0) l1++;
|
// if (((block_length-(2*Zc))&31)>0) l1++;
|
||||||
|
|
||||||
for (i=0;i<l1;i++)
|
for (int i=0;i<l1;i++)
|
||||||
//for (j=0;j<n_segments;j++) ((__m256i *)channel_input[j])[i] = _mm256_and_si256(_mm256_srai_epi16(c256p[i],j),masks[0]);
|
//for (j=0;j<n_segments;j++) ((__m256i *)output[j])[i] = _mm256_and_si256(_mm256_srai_epi16(c256p[i],j),masks[0]);
|
||||||
for (j=macro_segment; j < macro_segment_end; j++) ((__m256i *)channel_input[j])[i] = _mm256_and_si256(_mm256_srai_epi16(c256p[i],j-macro_segment),masks[0]);
|
for (int j=macro_segment; j < macro_segment_end; j++) ((__m256i *)output[j])[i] = _mm256_and_si256(_mm256_srai_epi16(c256p[i],j-macro_segment),masks[0]);
|
||||||
|
|
||||||
|
|
||||||
// if ((((nrows-no_punctured_columns) * Zc-removed_bit)&31)>0) l2++;
|
// if ((((nrows-no_punctured_columns) * Zc-removed_bit)&31)>0) l2++;
|
||||||
|
|
||||||
for (i1=0;i1<l2;i1++,i++)
|
for (int i1=0, i=l1;i1<l2;i1++,i++)
|
||||||
//for (j=0;j<n_segments;j++) ((__m256i *)channel_input[j])[i] = _mm256_and_si256(_mm256_srai_epi16(d256p[i1],j),masks[0]);
|
//for (j=0;j<n_segments;j++) ((__m256i *)output[j])[i] = _mm256_and_si256(_mm256_srai_epi16(d256p[i1],j),masks[0]);
|
||||||
for (j=macro_segment; j < macro_segment_end; j++) ((__m256i *)channel_input[j])[i] = _mm256_and_si256(_mm256_srai_epi16(d256p[i1],j-macro_segment),masks[0]);
|
for (int j=macro_segment; j < macro_segment_end; j++) ((__m256i *)output[j])[i] = _mm256_and_si256(_mm256_srai_epi16(d256p[i1],j-macro_segment),masks[0]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#ifdef DEBUG_LDPC
|
#ifdef DEBUG_LDPC
|
||||||
LOG_W(PHY,"using non-optimized version\n");
|
LOG_W(PHY,"using non-optimized version\n");
|
||||||
#endif
|
#endif
|
||||||
// do non-SIMD version
|
// do non-SIMD version
|
||||||
for (i=0;i<(block_length-2*Zc);i++)
|
for (int i=0;i<(block_length-2*Zc);i++)
|
||||||
//for (j=0; j<n_segments; j++)
|
//for (j=0; j<n_segments; j++)
|
||||||
for (j=macro_segment; j < macro_segment_end; j++)
|
for (int j=macro_segment; j < macro_segment_end; j++)
|
||||||
channel_input[j][i] = (c[2*Zc+i]>>(j-macro_segment))&1;
|
output[j][i] = (cc[2*Zc+i]>>(j-macro_segment))&1;
|
||||||
for (i=0;i<((nrows-no_punctured_columns) * Zc-removed_bit);i++)
|
for (int i=0;i<((nrows-no_punctured_columns) * Zc-removed_bit);i++)
|
||||||
//for (j=0; j<n_segments; j++)
|
//for (j=0; j<n_segments; j++)
|
||||||
for (j=macro_segment; j < macro_segment_end; j++)
|
for (int j=macro_segment; j < macro_segment_end; j++)
|
||||||
channel_input[j][block_length-2*Zc+i] = (d[i]>>(j-macro_segment))&1;
|
output[j][block_length-2*Zc+i] = (dd[i]>>(j-macro_segment))&1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -180,9 +180,12 @@ uint8_t nr_generate_pdsch(processingData_L1tx_t *msgTx,
|
|||||||
|
|
||||||
/// CRC, coding, interleaving and rate matching
|
/// CRC, coding, interleaving and rate matching
|
||||||
AssertFatal(harq->pdu!=NULL,"harq->pdu is null\n");
|
AssertFatal(harq->pdu!=NULL,"harq->pdu is null\n");
|
||||||
|
unsigned char output[rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS] __attribute__((aligned(32)));
|
||||||
|
bzero(output,rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS);
|
||||||
start_meas(dlsch_encoding_stats);
|
start_meas(dlsch_encoding_stats);
|
||||||
nr_dlsch_encoding(gNB,
|
nr_dlsch_encoding(gNB,
|
||||||
harq->pdu, frame, slot, dlsch, frame_parms,tinput,tprep,tparity,toutput,
|
harq->pdu, frame, slot, dlsch, frame_parms, output,
|
||||||
|
tinput,tprep,tparity,toutput,
|
||||||
dlsch_rate_matching_stats,
|
dlsch_rate_matching_stats,
|
||||||
dlsch_interleaving_stats,
|
dlsch_interleaving_stats,
|
||||||
dlsch_segmentation_stats);
|
dlsch_segmentation_stats);
|
||||||
@@ -197,7 +200,7 @@ uint8_t nr_generate_pdsch(processingData_L1tx_t *msgTx,
|
|||||||
printf("\nEncoded payload:\n");
|
printf("\nEncoded payload:\n");
|
||||||
for (int i=0; i<encoded_length>>3; i++) {
|
for (int i=0; i<encoded_length>>3; i++) {
|
||||||
for (int j=0; j<8; j++)
|
for (int j=0; j<8; j++)
|
||||||
printf("%d", harq->f[(i<<3)+j]);
|
printf("%d", output[(i<<3)+j]);
|
||||||
printf("\t");
|
printf("\t");
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@@ -210,7 +213,7 @@ uint8_t nr_generate_pdsch(processingData_L1tx_t *msgTx,
|
|||||||
for (int q=0; q<rel15->NrOfCodewords; q++)
|
for (int q=0; q<rel15->NrOfCodewords; q++)
|
||||||
memset((void*)scrambled_output[q], 0, (encoded_length>>5)*sizeof(uint32_t));
|
memset((void*)scrambled_output[q], 0, (encoded_length>>5)*sizeof(uint32_t));
|
||||||
for (int q=0; q<rel15->NrOfCodewords; q++)
|
for (int q=0; q<rel15->NrOfCodewords; q++)
|
||||||
nr_pdsch_codeword_scrambling_optim(harq->f,
|
nr_pdsch_codeword_scrambling_optim(output,
|
||||||
encoded_length,
|
encoded_length,
|
||||||
q,
|
q,
|
||||||
rel15->dataScramblingId,
|
rel15->dataScramblingId,
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
|||||||
uint8_t slot,
|
uint8_t slot,
|
||||||
NR_gNB_DLSCH_t *dlsch,
|
NR_gNB_DLSCH_t *dlsch,
|
||||||
NR_DL_FRAME_PARMS* frame_parms,
|
NR_DL_FRAME_PARMS* frame_parms,
|
||||||
|
unsigned char * output,
|
||||||
time_stats_t *tinput,
|
time_stats_t *tinput,
|
||||||
time_stats_t *tprep,
|
time_stats_t *tprep,
|
||||||
time_stats_t *tparity,
|
time_stats_t *tparity,
|
||||||
|
|||||||
@@ -50,70 +50,47 @@
|
|||||||
//#define DEBUG_DLSCH_FREE 1
|
//#define DEBUG_DLSCH_FREE 1
|
||||||
|
|
||||||
|
|
||||||
void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB)
|
void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB) {
|
||||||
{
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
NR_gNB_DLSCH_t *dlsch = *dlschptr;
|
NR_gNB_DLSCH_t *dlsch = *dlschptr;
|
||||||
|
|
||||||
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated
|
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated
|
||||||
if (dlsch) {
|
|
||||||
|
|
||||||
|
if (dlsch) {
|
||||||
if (N_RB != 273) {
|
if (N_RB != 273) {
|
||||||
a_segments = a_segments*N_RB;
|
a_segments = a_segments*N_RB;
|
||||||
a_segments = a_segments/273 +1;
|
a_segments = a_segments/273 +1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_DLSCH_FREE
|
#ifdef DEBUG_DLSCH_FREE
|
||||||
LOG_D(PHY,"Freeing dlsch %p\n",dlsch);
|
LOG_D(PHY,"Freeing dlsch %p\n",dlsch);
|
||||||
#endif
|
#endif
|
||||||
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
|
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
|
||||||
|
|
||||||
if (harq->b) {
|
if (harq->b) {
|
||||||
free16(harq->b, a_segments * 1056);
|
free16(harq->b, a_segments * 1056);
|
||||||
harq->b = NULL;
|
harq->b = NULL;
|
||||||
#ifdef DEBUG_DLSCH_FREE
|
#ifdef DEBUG_DLSCH_FREE
|
||||||
LOG_D(PHY, "Freeing harq->b (%p)\n", harq->b);
|
LOG_D(PHY, "Freeing harq->b (%p)\n", harq->b);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
if (harq->e) {
|
|
||||||
free16(harq->e, 14 * N_RB * 12 * 8);
|
|
||||||
harq->e = NULL;
|
|
||||||
#ifdef DEBUG_DLSCH_FREE
|
#ifdef DEBUG_DLSCH_FREE
|
||||||
printf("Freeing dlsch process %d e (%p)\n", i, harq->e);
|
LOG_D(PHY, "Freeing dlsch process %d c (%p)\n", i, harq->c);
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
for (r = 0; r < a_segments; r++) {
|
||||||
if (harq->f) {
|
|
||||||
free16(harq->f, 14 * N_RB * 12 * 8);
|
|
||||||
harq->f = NULL;
|
|
||||||
#ifdef DEBUG_DLSCH_FREE
|
#ifdef DEBUG_DLSCH_FREE
|
||||||
printf("Freeing dlsch process %d f (%p)\n", i, harq->f);
|
LOG_D(PHY, "Freeing dlsch process %d c[%d] (%p)\n", i, r, harq->c[r]);
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
if (harq->c[r]) {
|
||||||
#ifdef DEBUG_DLSCH_FREE
|
free16(harq->c[r], 1056);
|
||||||
LOG_D(PHY, "Freeing dlsch process %d c (%p)\n", i, harq->c);
|
harq->c[r] = NULL;
|
||||||
#endif
|
|
||||||
|
|
||||||
for (r = 0; r < a_segments; r++) {
|
|
||||||
#ifdef DEBUG_DLSCH_FREE
|
|
||||||
LOG_D(PHY, "Freeing dlsch process %d c[%d] (%p)\n", i, r, harq->c[r]);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (harq->c[r]) {
|
|
||||||
free16(harq->c[r], 1056);
|
|
||||||
harq->c[r] = NULL;
|
|
||||||
}
|
|
||||||
if (harq->d[r]) {
|
|
||||||
free16(harq->d[r], 3 * 8448);
|
|
||||||
harq->d[r] = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
free16(dlsch, sizeof(NR_gNB_DLSCH_t));
|
||||||
|
*dlschptr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
free16(dlsch, sizeof(NR_gNB_DLSCH_t));
|
|
||||||
*dlschptr = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
|
NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
|
||||||
@@ -121,8 +98,7 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
|
|||||||
unsigned char Mdlharq,
|
unsigned char Mdlharq,
|
||||||
uint32_t Nsoft,
|
uint32_t Nsoft,
|
||||||
uint8_t abstraction_flag,
|
uint8_t abstraction_flag,
|
||||||
uint16_t N_RB)
|
uint16_t N_RB) {
|
||||||
{
|
|
||||||
unsigned char i,r,aa,layer;
|
unsigned char i,r,aa,layer;
|
||||||
int re;
|
int re;
|
||||||
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated
|
uint16_t a_segments = MAX_NUM_NR_DLSCH_SEGMENTS; //number of segments to be allocated
|
||||||
@@ -133,10 +109,8 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint16_t dlsch_bytes = a_segments*1056; // allocated bytes per segment
|
uint16_t dlsch_bytes = a_segments*1056; // allocated bytes per segment
|
||||||
|
|
||||||
NR_gNB_DLSCH_t *dlsch = malloc16(sizeof(NR_gNB_DLSCH_t));
|
NR_gNB_DLSCH_t *dlsch = malloc16(sizeof(NR_gNB_DLSCH_t));
|
||||||
AssertFatal(dlsch, "cannot allocate dlsch\n");
|
AssertFatal(dlsch, "cannot allocate dlsch\n");
|
||||||
|
|
||||||
bzero(dlsch,sizeof(NR_gNB_DLSCH_t));
|
bzero(dlsch,sizeof(NR_gNB_DLSCH_t));
|
||||||
dlsch->Kmimo = Kmimo;
|
dlsch->Kmimo = Kmimo;
|
||||||
dlsch->Mdlharq = Mdlharq;
|
dlsch->Mdlharq = Mdlharq;
|
||||||
@@ -144,11 +118,12 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
|
|||||||
dlsch->Nsoft = Nsoft;
|
dlsch->Nsoft = Nsoft;
|
||||||
|
|
||||||
for (layer=0; layer<NR_MAX_NB_LAYERS; layer++) {
|
for (layer=0; layer<NR_MAX_NB_LAYERS; layer++) {
|
||||||
dlsch->ue_spec_bf_weights[layer] = (int32_t**)malloc16(64*sizeof(int32_t*));
|
dlsch->ue_spec_bf_weights[layer] = (int32_t **)malloc16(64*sizeof(int32_t *));
|
||||||
|
|
||||||
for (aa=0; aa<64; aa++) {
|
for (aa=0; aa<64; aa++) {
|
||||||
dlsch->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
|
dlsch->ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
|
||||||
for (re=0;re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) {
|
|
||||||
|
for (re=0; re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) {
|
||||||
dlsch->ue_spec_bf_weights[layer][aa][re] = 0x00007fff;
|
dlsch->ue_spec_bf_weights[layer][aa][re] = 0x00007fff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -160,7 +135,8 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
|
|||||||
for (int q=0; q<NR_MAX_NB_CODEWORDS; q++)
|
for (int q=0; q<NR_MAX_NB_CODEWORDS; q++)
|
||||||
dlsch->mod_symbs[q] = (int32_t *)malloc16(NR_MAX_PDSCH_ENCODED_LENGTH*sizeof(int32_t));
|
dlsch->mod_symbs[q] = (int32_t *)malloc16(NR_MAX_PDSCH_ENCODED_LENGTH*sizeof(int32_t));
|
||||||
|
|
||||||
dlsch->calib_dl_ch_estimates = (int32_t**)malloc16(64*sizeof(int32_t*));
|
dlsch->calib_dl_ch_estimates = (int32_t **)malloc16(64*sizeof(int32_t *));
|
||||||
|
|
||||||
for (aa=0; aa<64; aa++) {
|
for (aa=0; aa<64; aa++) {
|
||||||
dlsch->calib_dl_ch_estimates[aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
|
dlsch->calib_dl_ch_estimates[aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*sizeof(int32_t));
|
||||||
}
|
}
|
||||||
@@ -172,7 +148,6 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
|
|||||||
|
|
||||||
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
|
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
|
||||||
bzero(harq, sizeof(NR_DL_gNB_HARQ_t));
|
bzero(harq, sizeof(NR_DL_gNB_HARQ_t));
|
||||||
|
|
||||||
harq->b = malloc16(dlsch_bytes);
|
harq->b = malloc16(dlsch_bytes);
|
||||||
AssertFatal(harq->b, "cannot allocate memory for harq->b\n");
|
AssertFatal(harq->b, "cannot allocate memory for harq->b\n");
|
||||||
harq->pdu = malloc16(dlsch_bytes);
|
harq->pdu = malloc16(dlsch_bytes);
|
||||||
@@ -188,71 +163,33 @@ NR_gNB_DLSCH_t *new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms,
|
|||||||
// In section 5.3.2 in 38.212, the for loop is up to N + 2*Zc (maximum size of N is 66*Zc, therefore 68*Zc)
|
// In section 5.3.2 in 38.212, the for loop is up to N + 2*Zc (maximum size of N is 66*Zc, therefore 68*Zc)
|
||||||
harq->c[r] = malloc16(8448);
|
harq->c[r] = malloc16(8448);
|
||||||
AssertFatal(harq->c[r], "cannot allocate harq->c[%d]\n", r);
|
AssertFatal(harq->c[r], "cannot allocate harq->c[%d]\n", r);
|
||||||
harq->d[r] = malloc16(68 * 384);
|
|
||||||
AssertFatal(harq->d[r], "cannot allocate harq->d[%d]\n", r); // max size for coded output
|
|
||||||
bzero(harq->c[r], 8448);
|
bzero(harq->c[r], 8448);
|
||||||
bzero(harq->d[r], (3 * 8448));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
harq->e = malloc16(N_RB * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS);
|
|
||||||
AssertFatal(harq->e, "cannot allocate harq->e\n");
|
|
||||||
bzero(harq->e, N_RB * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS);
|
|
||||||
harq->f = malloc16(N_RB * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS);
|
|
||||||
AssertFatal(harq->f, "cannot allocate harq->f\n");
|
|
||||||
bzero(harq->f, N_RB * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS);
|
|
||||||
|
|
||||||
return(dlsch);
|
return(dlsch);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch)
|
void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch) {
|
||||||
{
|
|
||||||
|
|
||||||
unsigned char Mdlharq;
|
|
||||||
unsigned char i,j,r;
|
|
||||||
|
|
||||||
AssertFatal(dlsch!=NULL,"dlsch is null\n");
|
AssertFatal(dlsch!=NULL,"dlsch is null\n");
|
||||||
Mdlharq = dlsch->Mdlharq;
|
unsigned char Mdlharq = dlsch->Mdlharq;
|
||||||
dlsch->rnti = 0;
|
dlsch->rnti = 0;
|
||||||
dlsch->active = 0;
|
dlsch->active = 0;
|
||||||
NR_DL_gNB_HARQ_t *harq=&dlsch->harq_process;
|
for (int i=0; i<10; i++) {
|
||||||
|
|
||||||
for (i=0; i<10; i++) {
|
|
||||||
dlsch->harq_ids[0][i] = Mdlharq;
|
dlsch->harq_ids[0][i] = Mdlharq;
|
||||||
dlsch->harq_ids[1][i] = Mdlharq;
|
dlsch->harq_ids[1][i] = Mdlharq;
|
||||||
}
|
}
|
||||||
for (i=0; i<Mdlharq; i++) {
|
|
||||||
for (j=0; j<96; j++)
|
|
||||||
for (r=0; r<MAX_NUM_NR_DLSCH_SEGMENTS; r++)
|
|
||||||
if (harq->d[r])
|
|
||||||
harq->d[r][j] = NR_NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
void ldpc8blocks( void *p) {
|
||||||
unsigned char *a,
|
encoder_implemparams_t *impp=(encoder_implemparams_t *) p;
|
||||||
int frame,
|
NR_DL_gNB_HARQ_t *harq = (NR_DL_gNB_HARQ_t *)impp->harq;
|
||||||
uint8_t slot,
|
uint16_t Kr= impp->K;
|
||||||
NR_gNB_DLSCH_t *dlsch,
|
|
||||||
NR_DL_FRAME_PARMS* frame_parms,
|
|
||||||
time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput,
|
|
||||||
time_stats_t *dlsch_rate_matching_stats,time_stats_t *dlsch_interleaving_stats,
|
|
||||||
time_stats_t *dlsch_segmentation_stats)
|
|
||||||
{
|
|
||||||
|
|
||||||
unsigned int G;
|
|
||||||
unsigned int crc=1;
|
|
||||||
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
|
|
||||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &harq->pdsch_pdu.pdsch_pdu_rel15;
|
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &harq->pdsch_pdu.pdsch_pdu_rel15;
|
||||||
|
uint8_t mod_order = rel15->qamModOrder[0];
|
||||||
uint16_t nb_rb = rel15->rbSize;
|
uint16_t nb_rb = rel15->rbSize;
|
||||||
uint8_t nb_symb_sch = rel15->NrOfSymbols;
|
uint8_t nb_symb_sch = rel15->NrOfSymbols;
|
||||||
uint32_t A, Kb, F=0;
|
uint16_t length_dmrs = get_num_dmrs(rel15->dlDmrsSymbPos);
|
||||||
uint32_t *Zc = &dlsch->harq_process.Z;
|
uint32_t A = rel15->TBSize[0]<<3;
|
||||||
uint8_t mod_order = rel15->qamModOrder[0];
|
|
||||||
uint16_t Kr=0,r;
|
|
||||||
uint32_t r_offset=0;
|
|
||||||
uint32_t E;
|
|
||||||
uint8_t Ilbrm = 1;
|
|
||||||
uint32_t Tbslbrm = 950984; //max tbs
|
|
||||||
uint8_t nb_re_dmrs;
|
uint8_t nb_re_dmrs;
|
||||||
|
|
||||||
if (rel15->dmrsConfigType==NFAPI_NR_DMRS_TYPE1)
|
if (rel15->dmrsConfigType==NFAPI_NR_DMRS_TYPE1)
|
||||||
@@ -260,24 +197,115 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
|||||||
else
|
else
|
||||||
nb_re_dmrs = 4*rel15->numDmrsCdmGrpsNoData;
|
nb_re_dmrs = 4*rel15->numDmrsCdmGrpsNoData;
|
||||||
|
|
||||||
uint16_t length_dmrs = get_num_dmrs(rel15->dlDmrsSymbPos);
|
unsigned int G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs,mod_order,rel15->nrOfLayers);
|
||||||
uint16_t R=rel15->targetCodeRate[0];
|
LOG_D(PHY,"dlsch coding A %d Kr %d G %d (nb_rb %d, nb_symb_sch %d, nb_re_dmrs %d, length_dmrs %d, mod_order %d)\n",
|
||||||
|
A,impp->K,G, nb_rb,nb_symb_sch,nb_re_dmrs,length_dmrs,(int)mod_order);
|
||||||
|
// nrLDPC_encoder output is in "d"
|
||||||
|
// let's make this interface happy!
|
||||||
|
uint8_t tmp[8][68 * 384]__attribute__((aligned(32)));
|
||||||
|
for (int rr=impp->macro_num*8, i=0; rr < impp->n_segments && rr < (impp->macro_num+1)*8; rr++,i++ )
|
||||||
|
impp->d[rr]=tmp[i];
|
||||||
|
nrLDPC_encoder(harq->c,impp->d,*impp->Zc, impp->Kb,Kr,impp->BG,impp);
|
||||||
|
// Compute where to place in output buffer that is concatenation of all segments
|
||||||
|
uint32_t r_offset=0;
|
||||||
|
for (int i=0; i < impp->macro_num*8; i++ )
|
||||||
|
r_offset+=nr_get_E(G, impp->n_segments, mod_order, rel15->nrOfLayers, i);
|
||||||
|
for (int rr=impp->macro_num*8; rr < impp->n_segments && rr < (impp->macro_num+1)*8; rr++ ) {
|
||||||
|
if (impp->F>0) {
|
||||||
|
// writing into positions d[r][k-2Zc] as in clause 5.3.2 step 2) in 38.212
|
||||||
|
memset(&impp->d[rr][Kr-impp->F-2*(*impp->Zc)], impp->F, NR_NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG_DLSCH_CODING
|
||||||
|
LOG_D(PHY,"rvidx in encoding = %d\n", rel15->rvIndex[0]);
|
||||||
|
#endif
|
||||||
|
uint32_t E = nr_get_E(G, impp->n_segments, mod_order, rel15->nrOfLayers, rr);
|
||||||
|
//#ifdef DEBUG_DLSCH_CODING
|
||||||
|
LOG_D(NR_PHY,"Rate Matching, Code segment %d/%d (coded bits (G) %u, E %d, Filler bits %d, Filler offset %d mod_order %d, nb_rb %d)...\n",
|
||||||
|
rr,
|
||||||
|
impp->n_segments,
|
||||||
|
G,
|
||||||
|
E,
|
||||||
|
impp->F,
|
||||||
|
Kr-impp->F-2*(*impp->Zc),
|
||||||
|
mod_order,nb_rb);
|
||||||
|
// for tbslbrm calculation according to 5.4.2.1 of 38.212
|
||||||
|
uint8_t Nl = 4;
|
||||||
|
|
||||||
|
if (rel15->nrOfLayers < Nl)
|
||||||
|
Nl = rel15->nrOfLayers;
|
||||||
|
|
||||||
|
uint32_t Tbslbrm = nr_compute_tbslbrm(rel15->mcsTable[0],nb_rb,Nl);
|
||||||
|
uint8_t Ilbrm = 1;
|
||||||
|
|
||||||
|
uint8_t e[E];
|
||||||
|
bzero (e, E);
|
||||||
|
nr_rate_matching_ldpc(Ilbrm,
|
||||||
|
Tbslbrm,
|
||||||
|
impp->BG,
|
||||||
|
*impp->Zc,
|
||||||
|
impp->d[rr],
|
||||||
|
e,
|
||||||
|
impp->n_segments,
|
||||||
|
impp->F,
|
||||||
|
Kr-impp->F-2*(*impp->Zc),
|
||||||
|
rel15->rvIndex[0],
|
||||||
|
E);
|
||||||
|
#ifdef DEBUG_DLSCH_CODING
|
||||||
|
|
||||||
|
for (int i =0; i<16; i++)
|
||||||
|
printf("output ratematching e[%d]= %d r_offset %u\n", i,harq->e[i+r_offset], r_offset);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
nr_interleaving_ldpc(E,
|
||||||
|
mod_order,
|
||||||
|
e,
|
||||||
|
impp->output+r_offset);
|
||||||
|
#ifdef DEBUG_DLSCH_CODING
|
||||||
|
|
||||||
|
for (int i =0; i<16; i++)
|
||||||
|
printf("output interleaving f[%d]= %d r_offset %u\n", i,impp->output[i+r_offset], r_offset);
|
||||||
|
|
||||||
|
if (r==impp->n_segments-1)
|
||||||
|
write_output("enc_output.m","enc",impp->output,G,1,4);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
r_offset += E;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
||||||
|
unsigned char *a,
|
||||||
|
int frame,
|
||||||
|
uint8_t slot,
|
||||||
|
NR_gNB_DLSCH_t *dlsch,
|
||||||
|
NR_DL_FRAME_PARMS *frame_parms,
|
||||||
|
unsigned char * output,
|
||||||
|
time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput,
|
||||||
|
time_stats_t *dlsch_rate_matching_stats,time_stats_t *dlsch_interleaving_stats,
|
||||||
|
time_stats_t *dlsch_segmentation_stats) {
|
||||||
|
encoder_implemparams_t impp;
|
||||||
|
impp.output=output;
|
||||||
|
unsigned int crc=1;
|
||||||
|
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
|
||||||
|
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &harq->pdsch_pdu.pdsch_pdu_rel15;
|
||||||
|
impp.Zc = &dlsch->harq_process.Z;
|
||||||
float Coderate = 0.0;
|
float Coderate = 0.0;
|
||||||
uint8_t Nl = 4;
|
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_IN);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_IN);
|
||||||
|
uint32_t A = rel15->TBSize[0]<<3;
|
||||||
|
|
||||||
A = rel15->TBSize[0]<<3;
|
|
||||||
if ( dlsch->rnti != SI_RNTI )
|
if ( dlsch->rnti != SI_RNTI )
|
||||||
trace_NRpdu(DIRECTION_DOWNLINK, a, rel15->TBSize[0], 0, WS_C_RNTI, dlsch->rnti, frame, slot,0, 0);
|
trace_NRpdu(DIRECTION_DOWNLINK, a, rel15->TBSize[0], 0, WS_C_RNTI, dlsch->rnti, frame, slot,0, 0);
|
||||||
|
|
||||||
NR_gNB_SCH_STATS_t *stats=NULL;
|
NR_gNB_SCH_STATS_t *stats=NULL;
|
||||||
int first_free=-1;
|
int first_free=-1;
|
||||||
for (int i=0;i<NUMBER_OF_NR_SCH_STATS_MAX;i++) {
|
|
||||||
|
for (int i=0; i<NUMBER_OF_NR_SCH_STATS_MAX; i++) {
|
||||||
if (gNB->dlsch_stats[i].rnti == 0 && first_free == -1) {
|
if (gNB->dlsch_stats[i].rnti == 0 && first_free == -1) {
|
||||||
first_free = i;
|
first_free = i;
|
||||||
stats=&gNB->dlsch_stats[i];
|
stats=&gNB->dlsch_stats[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gNB->dlsch_stats[i].rnti == dlsch->rnti) {
|
if (gNB->dlsch_stats[i].rnti == dlsch->rnti) {
|
||||||
stats=&gNB->dlsch_stats[i];
|
stats=&gNB->dlsch_stats[i];
|
||||||
break;
|
break;
|
||||||
@@ -290,179 +318,94 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
|||||||
stats->current_RI = rel15->nrOfLayers;
|
stats->current_RI = rel15->nrOfLayers;
|
||||||
stats->current_Qm = rel15->qamModOrder[0];
|
stats->current_Qm = rel15->qamModOrder[0];
|
||||||
}
|
}
|
||||||
G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs,mod_order,rel15->nrOfLayers);
|
|
||||||
|
|
||||||
LOG_D(PHY,"dlsch coding A %d G %d (nb_rb %d, nb_symb_sch %d, nb_re_dmrs %d, length_dmrs %d, mod_order %d)\n",
|
|
||||||
A,G, nb_rb,nb_symb_sch,nb_re_dmrs,length_dmrs,(int)mod_order);
|
|
||||||
|
|
||||||
if (A > 3824) {
|
if (A > 3824) {
|
||||||
// Add 24-bit crc (polynomial A) to payload
|
// Add 24-bit crc (polynomial A) to payload
|
||||||
crc = crc24a(a,A)>>8;
|
crc = crc24a(a,A)>>8;
|
||||||
a[A>>3] = ((uint8_t*)&crc)[2];
|
a[A>>3] = ((uint8_t *)&crc)[2];
|
||||||
a[1+(A>>3)] = ((uint8_t*)&crc)[1];
|
a[1+(A>>3)] = ((uint8_t *)&crc)[1];
|
||||||
a[2+(A>>3)] = ((uint8_t*)&crc)[0];
|
a[2+(A>>3)] = ((uint8_t *)&crc)[0];
|
||||||
//printf("CRC %x (A %d)\n",crc,A);
|
//printf("CRC %x (A %d)\n",crc,A);
|
||||||
//printf("a0 %d a1 %d a2 %d\n", a[A>>3], a[1+(A>>3)], a[2+(A>>3)]);
|
//printf("a0 %d a1 %d a2 %d\n", a[A>>3], a[1+(A>>3)], a[2+(A>>3)]);
|
||||||
|
|
||||||
harq->B = A+24;
|
harq->B = A+24;
|
||||||
// harq->b = a;
|
// harq->b = a;
|
||||||
|
|
||||||
AssertFatal((A / 8) + 4 <= MAX_NR_DLSCH_PAYLOAD_BYTES,
|
AssertFatal((A / 8) + 4 <= MAX_NR_DLSCH_PAYLOAD_BYTES,
|
||||||
"A %d is too big (A/8+4 = %d > %d)\n",
|
"A %d is too big (A/8+4 = %d > %d)\n",
|
||||||
A,
|
A,
|
||||||
(A / 8) + 4,
|
(A / 8) + 4,
|
||||||
MAX_NR_DLSCH_PAYLOAD_BYTES);
|
MAX_NR_DLSCH_PAYLOAD_BYTES);
|
||||||
|
|
||||||
memcpy(harq->b, a, (A / 8) + 4); // why is this +4 if the CRC is only 3 bytes?
|
memcpy(harq->b, a, (A / 8) + 4); // why is this +4 if the CRC is only 3 bytes?
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// Add 16-bit crc (polynomial A) to payload
|
// Add 16-bit crc (polynomial A) to payload
|
||||||
crc = crc16(a,A)>>16;
|
crc = crc16(a,A)>>16;
|
||||||
a[A>>3] = ((uint8_t*)&crc)[1];
|
a[A>>3] = ((uint8_t *)&crc)[1];
|
||||||
a[1+(A>>3)] = ((uint8_t*)&crc)[0];
|
a[1+(A>>3)] = ((uint8_t *)&crc)[0];
|
||||||
//printf("CRC %x (A %d)\n",crc,A);
|
//printf("CRC %x (A %d)\n",crc,A);
|
||||||
//printf("a0 %d a1 %d \n", a[A>>3], a[1+(A>>3)]);
|
//printf("a0 %d a1 %d \n", a[A>>3], a[1+(A>>3)]);
|
||||||
|
|
||||||
harq->B = A+16;
|
harq->B = A+16;
|
||||||
// harq->b = a;
|
// harq->b = a;
|
||||||
|
|
||||||
AssertFatal((A / 8) + 3 <= MAX_NR_DLSCH_PAYLOAD_BYTES,
|
AssertFatal((A / 8) + 3 <= MAX_NR_DLSCH_PAYLOAD_BYTES,
|
||||||
"A %d is too big (A/8+3 = %d > %d)\n",
|
"A %d is too big (A/8+3 = %d > %d)\n",
|
||||||
A,
|
A,
|
||||||
(A / 8) + 3,
|
(A / 8) + 3,
|
||||||
MAX_NR_DLSCH_PAYLOAD_BYTES);
|
MAX_NR_DLSCH_PAYLOAD_BYTES);
|
||||||
|
|
||||||
memcpy(harq->b, a, (A / 8) + 3); // using 3 bytes to mimic the case of 24 bit crc
|
memcpy(harq->b, a, (A / 8) + 3); // using 3 bytes to mimic the case of 24 bit crc
|
||||||
}
|
}
|
||||||
if (R<1000)
|
|
||||||
Coderate = (float) R /(float) 1024;
|
if (rel15->targetCodeRate[0]<1000)
|
||||||
|
Coderate = (float)rel15->targetCodeRate[0] /(float) 1024;
|
||||||
else // to scale for mcs 20 and 26 in table 5.1.3.1-2 which are decimal and input 2* in nr_tbs_tools
|
else // to scale for mcs 20 and 26 in table 5.1.3.1-2 which are decimal and input 2* in nr_tbs_tools
|
||||||
Coderate = (float) R /(float) 2048;
|
Coderate = (float)rel15->targetCodeRate[0] /(float) 2048;
|
||||||
|
|
||||||
if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25)
|
if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25)
|
||||||
harq->BG = 2;
|
impp.BG = 2;
|
||||||
else
|
else
|
||||||
harq->BG = 1;
|
impp.BG = 1;
|
||||||
|
|
||||||
start_meas(dlsch_segmentation_stats);
|
start_meas(dlsch_segmentation_stats);
|
||||||
Kb = nr_segmentation(harq->b, harq->c, harq->B, &harq->C, &harq->K, Zc, &harq->F, harq->BG);
|
impp.Kb = nr_segmentation(harq->b, harq->c, harq->B, &impp.n_segments, &impp.K, impp.Zc, &impp.F, impp.BG);
|
||||||
stop_meas(dlsch_segmentation_stats);
|
stop_meas(dlsch_segmentation_stats);
|
||||||
F = harq->F;
|
|
||||||
|
|
||||||
Kr = harq->K;
|
for (int r=0; r<impp.n_segments; r++) {
|
||||||
#ifdef DEBUG_DLSCH_CODING
|
|
||||||
uint16_t Kr_bytes;
|
|
||||||
Kr_bytes = Kr>>3;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//printf("segment Z %d k %d Kr %d BG %d C %d\n", *Zc,harq->K,Kr,BG,harq->C);
|
|
||||||
|
|
||||||
for (r=0; r<harq->C; r++) {
|
|
||||||
//d_tmp[r] = &harq->d[r][0];
|
//d_tmp[r] = &harq->d[r][0];
|
||||||
//channel_input[r] = &harq->d[r][0];
|
//channel_input[r] = &harq->d[r][0];
|
||||||
#ifdef DEBUG_DLSCH_CODING
|
#ifdef DEBUG_DLSCH_CODING
|
||||||
LOG_D(PHY,"Encoder: B %d F %d \n",harq->B, harq->F);
|
LOG_D(PHY,"Encoder: B %d F %d \n",harq->B, impp->F);
|
||||||
LOG_D(PHY,"start ldpc encoder segment %d/%d\n",r,harq->C);
|
LOG_D(PHY,"start ldpc encoder segment %d/%d\n",r,impp.n_segments);
|
||||||
LOG_D(PHY,"input %d %d %d %d %d \n", harq->c[r][0], harq->c[r][1], harq->c[r][2],harq->c[r][3], harq->c[r][4]);
|
LOG_D(PHY,"input %d %d %d %d %d \n", harq->c[r][0], harq->c[r][1], harq->c[r][2],harq->c[r][3], harq->c[r][4]);
|
||||||
for (int cnt =0 ; cnt < 22*(*Zc)/8; cnt ++){
|
|
||||||
|
for (int cnt =0 ; cnt < 22*(*Zc)/8; cnt ++) {
|
||||||
LOG_D(PHY,"%d ", harq->c[r][cnt]);
|
LOG_D(PHY,"%d ", harq->c[r][cnt]);
|
||||||
}
|
}
|
||||||
LOG_D(PHY,"\n");
|
|
||||||
|
|
||||||
|
LOG_D(PHY,"\n");
|
||||||
#endif
|
#endif
|
||||||
//ldpc_encoder_orig((unsigned char*)harq->c[r],harq->d[r],*Zc,Kb,Kr,BG,0);
|
//ldpc_encoder_orig((unsigned char*)harq->c[r],harq->d[r],*Zc,Kb,Kr,BG,0);
|
||||||
//ldpc_encoder_optim((unsigned char*)harq->c[r],(unsigned char*)&harq->d[r][0],*Zc,Kb,Kr,BG,NULL,NULL,NULL,NULL);
|
//ldpc_encoder_optim((unsigned char*)harq->c[r],(unsigned char*)&harq->d[r][0],*Zc,Kb,Kr,BG,NULL,NULL,NULL,NULL);
|
||||||
}
|
}
|
||||||
encoder_implemparams_t impp;
|
|
||||||
impp.n_segments=harq->C;
|
|
||||||
impp.tprep = tprep;
|
impp.tprep = tprep;
|
||||||
impp.tinput = tinput;
|
impp.tinput = tinput;
|
||||||
impp.tparity = tparity;
|
impp.tparity = tparity;
|
||||||
impp.toutput = toutput;
|
impp.toutput = toutput;
|
||||||
|
|
||||||
for(int j=0;j<(harq->C/8+((harq->C&7)==0 ? 0 : 1));j++) {
|
impp.harq=harq;
|
||||||
impp.macro_num=j;
|
notifiedFIFO_t nf;
|
||||||
nrLDPC_encoder(harq->c,harq->d,*Zc,Kb,Kr,harq->BG,&impp);
|
initNotifiedFIFO(&nf);
|
||||||
|
int nbJobs=0;
|
||||||
|
for(int j=0; j<(impp.n_segments/8+((impp.n_segments&7)==0 ? 0 : 1)); j++) {
|
||||||
|
notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(impp), j, &nf, ldpc8blocks);
|
||||||
|
encoder_implemparams_t* perJobImpp=(encoder_implemparams_t*)NotifiedFifoData(req);
|
||||||
|
*perJobImpp=impp;
|
||||||
|
perJobImpp->macro_num=j;
|
||||||
|
pushTpool(gNB->threadPool,req);
|
||||||
|
nbJobs++;
|
||||||
}
|
}
|
||||||
|
while(nbJobs) {
|
||||||
#ifdef DEBUG_DLSCH_CODING
|
notifiedFIFO_elt_t *req=pullTpool(&nf, gNB->threadPool);
|
||||||
write_output("enc_input0.m","enc_in0",&harq->c[0][0],Kr_bytes,1,4);
|
delNotifiedFIFO_elt(req);
|
||||||
write_output("enc_output0.m","enc0",&harq->d[0][0],(3*8*Kr_bytes)+12,1,4);
|
nbJobs--;
|
||||||
#endif
|
|
||||||
|
|
||||||
F = harq->F;
|
|
||||||
|
|
||||||
Kr = harq->K;
|
|
||||||
for (r=0; r<harq->C; r++) {
|
|
||||||
|
|
||||||
if (F>0) {
|
|
||||||
for (int k=(Kr-F-2*(*Zc)); k<Kr-2*(*Zc); k++) {
|
|
||||||
// writing into positions d[r][k-2Zc] as in clause 5.3.2 step 2) in 38.212
|
|
||||||
harq->d[r][k] = NR_NULL;
|
|
||||||
//if (k<(Kr-F+8))
|
|
||||||
//printf("r %d filler bits [%d] = %d \n", r,k, harq->d[r][k]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG_DLSCH_CODING
|
|
||||||
LOG_D(PHY,"rvidx in encoding = %d\n", rel15->rvIndex[0]);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
E = nr_get_E(G, harq->C, mod_order, rel15->nrOfLayers, r);
|
|
||||||
|
|
||||||
//#ifdef DEBUG_DLSCH_CODING
|
|
||||||
LOG_D(NR_PHY,"Rate Matching, Code segment %d/%d (coded bits (G) %u, E %d, Filler bits %d, Filler offset %d mod_order %d, nb_rb %d)...\n",
|
|
||||||
r,
|
|
||||||
harq->C,
|
|
||||||
G,
|
|
||||||
E,
|
|
||||||
F,
|
|
||||||
Kr-F-2*(*Zc),
|
|
||||||
mod_order,nb_rb);
|
|
||||||
|
|
||||||
// for tbslbrm calculation according to 5.4.2.1 of 38.212
|
|
||||||
if (rel15->nrOfLayers < Nl)
|
|
||||||
Nl = rel15->nrOfLayers;
|
|
||||||
|
|
||||||
Tbslbrm = nr_compute_tbslbrm(rel15->mcsTable[0],nb_rb,Nl);
|
|
||||||
|
|
||||||
start_meas(dlsch_rate_matching_stats);
|
|
||||||
nr_rate_matching_ldpc(Ilbrm,
|
|
||||||
Tbslbrm,
|
|
||||||
harq->BG,
|
|
||||||
*Zc,
|
|
||||||
harq->d[r],
|
|
||||||
harq->e+r_offset,
|
|
||||||
harq->C,
|
|
||||||
F,
|
|
||||||
Kr-F-2*(*Zc),
|
|
||||||
rel15->rvIndex[0],
|
|
||||||
E);
|
|
||||||
stop_meas(dlsch_rate_matching_stats);
|
|
||||||
#ifdef DEBUG_DLSCH_CODING
|
|
||||||
for (int i =0; i<16; i++)
|
|
||||||
printf("output ratematching e[%d]= %d r_offset %u\n", i,harq->e[i+r_offset], r_offset);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
start_meas(dlsch_interleaving_stats);
|
|
||||||
nr_interleaving_ldpc(E,
|
|
||||||
mod_order,
|
|
||||||
harq->e+r_offset,
|
|
||||||
harq->f+r_offset);
|
|
||||||
stop_meas(dlsch_interleaving_stats);
|
|
||||||
|
|
||||||
#ifdef DEBUG_DLSCH_CODING
|
|
||||||
for (int i =0; i<16; i++)
|
|
||||||
printf("output interleaving f[%d]= %d r_offset %u\n", i,harq->f[i+r_offset], r_offset);
|
|
||||||
|
|
||||||
if (r==harq->C-1)
|
|
||||||
write_output("enc_output.m","enc",harq->f,G,1,4);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
r_offset += E;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -368,7 +368,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
|||||||
xrtmag_next = temp;
|
xrtmag_next = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
av_corr/=nr_sequences/l;
|
//av_corr/=nr_sequences/l;
|
||||||
|
|
||||||
int xrtmag_dBtimes10 = 10*(int)dB_fixed64(xrtmag/(12*l));
|
int xrtmag_dBtimes10 = 10*(int)dB_fixed64(xrtmag/(12*l));
|
||||||
int xrtmag_next_dBtimes10 = 10*(int)dB_fixed64(xrtmag_next/(12*l));
|
int xrtmag_next_dBtimes10 = 10*(int)dB_fixed64(xrtmag_next/(12*l));
|
||||||
|
|||||||
@@ -389,7 +389,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
|||||||
printf("[AbsSFN %u.%d] Slot%d Symbol %d type %d: Pilot/Data extraction %5.2f \n",
|
printf("[AbsSFN %u.%d] Slot%d Symbol %d type %d: Pilot/Data extraction %5.2f \n",
|
||||||
frame,nr_slot_rx,slot,symbol,type,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
frame,nr_slot_rx,slot,symbol,type,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
||||||
#else
|
#else
|
||||||
LOG_I(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d type %d: Pilot/Data extraction %5.2f \n",
|
LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d type %d: Pilot/Data extraction %5.2f \n",
|
||||||
frame,nr_slot_rx,slot,symbol,type,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
frame,nr_slot_rx,slot,symbol,type,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -411,7 +411,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
|||||||
#if DISABLE_LOG_X
|
#if DISABLE_LOG_X
|
||||||
printf("[AbsSFN %u.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
printf("[AbsSFN %u.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
||||||
#else
|
#else
|
||||||
LOG_I(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
||||||
#endif
|
#endif
|
||||||
start_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
|
start_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
|
||||||
if (first_symbol_flag==1) {
|
if (first_symbol_flag==1) {
|
||||||
@@ -472,7 +472,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
|||||||
#if DISABLE_LOG_X
|
#if DISABLE_LOG_X
|
||||||
printf("[AbsSFN %u.%d] Slot%d Symbol %d first_symbol_flag %d: Channel Level %5.2f \n",frame,nr_slot_rx,slot,symbol,first_symbol_flag,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
printf("[AbsSFN %u.%d] Slot%d Symbol %d first_symbol_flag %d: Channel Level %5.2f \n",frame,nr_slot_rx,slot,symbol,first_symbol_flag,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
||||||
#else
|
#else
|
||||||
LOG_I(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d first_symbol_flag %d: Channel Level %5.2f \n",frame,nr_slot_rx,slot,symbol,first_symbol_flag,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d first_symbol_flag %d: Channel Level %5.2f \n",frame,nr_slot_rx,slot,symbol,first_symbol_flag,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
start_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
|
start_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
|
||||||
@@ -524,7 +524,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
|||||||
#if DISABLE_LOG_X
|
#if DISABLE_LOG_X
|
||||||
printf("[AbsSFN %u.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n", frame, nr_slot_rx, slot, symbol, pdsch_vars[gNB_id]->log2_maxh, proc->channel_level, ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
printf("[AbsSFN %u.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n", frame, nr_slot_rx, slot, symbol, pdsch_vars[gNB_id]->log2_maxh, proc->channel_level, ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
||||||
#else
|
#else
|
||||||
LOG_I(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n", frame, nr_slot_rx, slot, symbol, pdsch_vars[gNB_id]->log2_maxh, proc->channel_level, ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n", frame, nr_slot_rx, slot, symbol, pdsch_vars[gNB_id]->log2_maxh, proc->channel_level, ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
||||||
#endif
|
#endif
|
||||||
start_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
|
start_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
|
||||||
|
|
||||||
@@ -583,7 +583,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
|||||||
#if DISABLE_LOG_X
|
#if DISABLE_LOG_X
|
||||||
printf("[AbsSFN %u.%d] Slot%d Symbol %d: Channel Combine %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
printf("[AbsSFN %u.%d] Slot%d Symbol %d: Channel Combine %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
||||||
#else
|
#else
|
||||||
LOG_I(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Combine %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Combine %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
||||||
#endif
|
#endif
|
||||||
start_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
|
start_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
|
||||||
/* Store the valid DL RE's */
|
/* Store the valid DL RE's */
|
||||||
@@ -666,7 +666,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
|||||||
#if DISABLE_LOG_X
|
#if DISABLE_LOG_X
|
||||||
printf("[AbsSFN %u.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
printf("[AbsSFN %u.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
||||||
#else
|
#else
|
||||||
LOG_I(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Please keep it: useful for debugging
|
// Please keep it: useful for debugging
|
||||||
|
|||||||
@@ -96,20 +96,6 @@ typedef struct {
|
|||||||
uint32_t subframe;
|
uint32_t subframe;
|
||||||
/// MIMO mode for this DLSCH
|
/// MIMO mode for this DLSCH
|
||||||
MIMO_mode_t mimo_mode;
|
MIMO_mode_t mimo_mode;
|
||||||
/// Concatenated sequences
|
|
||||||
uint8_t *e;
|
|
||||||
/// LDPC-code outputs
|
|
||||||
uint8_t *d[MAX_NUM_NR_DLSCH_SEGMENTS];
|
|
||||||
/// Interleaver outputs
|
|
||||||
uint8_t *f;
|
|
||||||
/// Number of code segments
|
|
||||||
uint32_t C;
|
|
||||||
/// Number of bits in "small" code segments
|
|
||||||
uint32_t K;
|
|
||||||
/// Number of "Filler" bits
|
|
||||||
uint32_t F;
|
|
||||||
/// Encoder BG
|
|
||||||
uint8_t BG;
|
|
||||||
/// LDPC lifting size
|
/// LDPC lifting size
|
||||||
uint32_t Z;
|
uint32_t Z;
|
||||||
} NR_DL_gNB_HARQ_t;
|
} NR_DL_gNB_HARQ_t;
|
||||||
|
|||||||
@@ -843,11 +843,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int gNB_
|
|||||||
} else AssertFatal(1==0,"Not RA_PDSCH, SI_PDSCH or PDSCH\n");
|
} else AssertFatal(1==0,"Not RA_PDSCH, SI_PDSCH or PDSCH\n");
|
||||||
|
|
||||||
stop_meas(&ue->dlsch_llr_stats_parallelization[proc->thread_id][slot]);
|
stop_meas(&ue->dlsch_llr_stats_parallelization[proc->thread_id][slot]);
|
||||||
#if PHYSIM
|
|
||||||
printf("[AbsSFN %d.%d] LLR Computation Symbol %d %5.2f \n",frame_rx,nr_slot_rx,m,ue->dlsch_llr_stats_parallelization[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
|
||||||
#else
|
|
||||||
LOG_D(PHY, "[AbsSFN %d.%d] LLR Computation Symbol %d %5.2f \n",frame_rx,nr_slot_rx,m,ue->dlsch_llr_stats_parallelization[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
LOG_D(PHY, "[AbsSFN %d.%d] LLR Computation Symbol %d %5.2f \n",frame_rx,nr_slot_rx,m,ue->dlsch_llr_stats_parallelization[proc->thread_id][slot].p_time/(cpuf*1000.0));
|
||||||
#endif
|
|
||||||
|
|
||||||
if(first_symbol_flag) {
|
if(first_symbol_flag) {
|
||||||
proc->first_symbol_available = 1;
|
proc->first_symbol_available = 1;
|
||||||
@@ -1041,17 +1037,10 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
|||||||
|
|
||||||
|
|
||||||
stop_meas(&ue->dlsch_decoding_stats[proc->thread_id]);
|
stop_meas(&ue->dlsch_decoding_stats[proc->thread_id]);
|
||||||
#if PHYSIM
|
LOG_D(PHY, " --> Unscrambling for CW0 %5.3f\n",
|
||||||
printf(" --> Unscrambling for CW0 %5.3f\n",
|
|
||||||
(ue->dlsch_unscrambling_stats.p_time)/(cpuf*1000.0));
|
|
||||||
printf("AbsSubframe %d.%d --> LDPC Decoding for CW0 %5.3f\n",
|
|
||||||
frame_rx%1024, nr_slot_rx,(ue->dlsch_decoding_stats[proc->thread_id].p_time)/(cpuf*1000.0));
|
|
||||||
#else
|
|
||||||
LOG_I(PHY, " --> Unscrambling for CW0 %5.3f\n",
|
|
||||||
(ue->dlsch_unscrambling_stats.p_time)/(cpuf*1000.0));
|
(ue->dlsch_unscrambling_stats.p_time)/(cpuf*1000.0));
|
||||||
LOG_I(PHY, "AbsSubframe %d.%d --> LDPC Decoding for CW0 %5.3f\n",
|
LOG_D(PHY, "AbsSubframe %d.%d --> LDPC Decoding for CW0 %5.3f\n",
|
||||||
frame_rx%1024, nr_slot_rx,(ue->dlsch_decoding_stats[proc->thread_id].p_time)/(cpuf*1000.0));
|
frame_rx%1024, nr_slot_rx,(ue->dlsch_decoding_stats[proc->thread_id].p_time)/(cpuf*1000.0));
|
||||||
#endif
|
|
||||||
|
|
||||||
if(is_cw1_active) {
|
if(is_cw1_active) {
|
||||||
// start ldpc decode for CW 1
|
// start ldpc decode for CW 1
|
||||||
@@ -1117,17 +1106,10 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
|||||||
|
|
||||||
|
|
||||||
stop_meas(&ue->dlsch_decoding_stats[proc->thread_id]);
|
stop_meas(&ue->dlsch_decoding_stats[proc->thread_id]);
|
||||||
#if PHYSIM
|
|
||||||
printf(" --> Unscrambling for CW1 %5.3f\n",
|
|
||||||
(ue->dlsch_unscrambling_stats.p_time)/(cpuf*1000.0));
|
|
||||||
printf("AbsSubframe %d.%d --> ldpc Decoding for CW1 %5.3f\n",
|
|
||||||
frame_rx%1024, nr_slot_rx,(ue->dlsch_decoding_stats[proc->thread_id].p_time)/(cpuf*1000.0));
|
|
||||||
#else
|
|
||||||
LOG_D(PHY, " --> Unscrambling for CW1 %5.3f\n",
|
LOG_D(PHY, " --> Unscrambling for CW1 %5.3f\n",
|
||||||
(ue->dlsch_unscrambling_stats.p_time)/(cpuf*1000.0));
|
(ue->dlsch_unscrambling_stats.p_time)/(cpuf*1000.0));
|
||||||
LOG_D(PHY, "AbsSubframe %d.%d --> ldpc Decoding for CW1 %5.3f\n",
|
LOG_D(PHY, "AbsSubframe %d.%d --> ldpc Decoding for CW1 %5.3f\n",
|
||||||
frame_rx%1024, nr_slot_rx,(ue->dlsch_decoding_stats[proc->thread_id].p_time)/(cpuf*1000.0));
|
frame_rx%1024, nr_slot_rx,(ue->dlsch_decoding_stats[proc->thread_id].p_time)/(cpuf*1000.0));
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
LOG_D(PHY,"AbsSubframe %d.%d --> ldpc Decoding for CW1 %5.3f\n",
|
LOG_D(PHY,"AbsSubframe %d.%d --> ldpc Decoding for CW1 %5.3f\n",
|
||||||
@@ -1438,11 +1420,7 @@ void *UE_thread_slot1_dl_processing(void *arg) {
|
|||||||
|
|
||||||
|
|
||||||
stop_meas(&ue->ue_front_end_per_slot_stat[proc->thread_id][1]);
|
stop_meas(&ue->ue_front_end_per_slot_stat[proc->thread_id][1]);
|
||||||
#if PHYSIM
|
|
||||||
printf("[AbsSFN %d.%d] Slot1: FFT + Channel Estimate + Pdsch Proc Slot0 %5.2f \n",frame_rx,nr_slot_rx,ue->ue_front_end_per_slot_stat[proc->thread_id][1].p_time/(cpuf*1000.0));
|
|
||||||
#else
|
|
||||||
LOG_D(PHY, "[AbsSFN %d.%d] Slot1: FFT + Channel Estimate + Pdsch Proc Slot0 %5.2f \n",frame_rx,nr_slot_rx,ue->ue_front_end_per_slot_stat[proc->thread_id][1].p_time/(cpuf*1000.0));
|
LOG_D(PHY, "[AbsSFN %d.%d] Slot1: FFT + Channel Estimate + Pdsch Proc Slot0 %5.2f \n",frame_rx,nr_slot_rx,ue->ue_front_end_per_slot_stat[proc->thread_id][1].p_time/(cpuf*1000.0));
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
//wait until pdcch is decoded
|
//wait until pdcch is decoded
|
||||||
@@ -1532,11 +1510,7 @@ void *UE_thread_slot1_dl_processing(void *arg) {
|
|||||||
//printf("Set available LLR slot1 to 1 AbsSubframe %d.%d \n",frame_rx,nr_slot_rx);
|
//printf("Set available LLR slot1 to 1 AbsSubframe %d.%d \n",frame_rx,nr_slot_rx);
|
||||||
|
|
||||||
stop_meas(&ue->pdsch_procedures_per_slot_stat[proc->thread_id][1]);
|
stop_meas(&ue->pdsch_procedures_per_slot_stat[proc->thread_id][1]);
|
||||||
#if PHYSIM
|
|
||||||
printf("[AbsSFN %d.%d] Slot1: LLR Computation %5.2f \n",frame_rx,nr_slot_rx,ue->pdsch_procedures_per_slot_stat[proc->thread_id][1].p_time/(cpuf*1000.0));
|
|
||||||
#else
|
|
||||||
LOG_D(PHY, "[AbsSFN %d.%d] Slot1: LLR Computation %5.2f \n",frame_rx,nr_slot_rx,ue->pdsch_procedures_per_slot_stat[proc->thread_id][1].p_time/(cpuf*1000.0));
|
LOG_D(PHY, "[AbsSFN %d.%d] Slot1: LLR Computation %5.2f \n",frame_rx,nr_slot_rx,ue->pdsch_procedures_per_slot_stat[proc->thread_id][1].p_time/(cpuf*1000.0));
|
||||||
#endif
|
|
||||||
|
|
||||||
if (pthread_mutex_lock(&proc->mutex_slot1_dl_processing) != 0) {
|
if (pthread_mutex_lock(&proc->mutex_slot1_dl_processing) != 0) {
|
||||||
LOG_E( PHY, "[SCHED][UE] error locking mutex for UE RXTX\n" );
|
LOG_E( PHY, "[SCHED][UE] error locking mutex for UE RXTX\n" );
|
||||||
@@ -1906,13 +1880,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
|
|||||||
dlsch_parallel);
|
dlsch_parallel);
|
||||||
|
|
||||||
stop_meas(&ue->dlsch_procedures_stat[proc->thread_id]);
|
stop_meas(&ue->dlsch_procedures_stat[proc->thread_id]);
|
||||||
#if PHYSIM
|
|
||||||
printf("[SFN %d] Slot1: Pdsch Proc %5.2f\n",nr_slot_rx,ue->pdsch_procedures_stat[proc->thread_id].p_time/(cpuf*1000.0));
|
|
||||||
printf("[SFN %d] Slot0 Slot1: Dlsch Proc %5.2f\n",nr_slot_rx,ue->dlsch_procedures_stat[proc->thread_id].p_time/(cpuf*1000.0));
|
|
||||||
#else
|
|
||||||
LOG_D(PHY, "[SFN %d] Slot1: Pdsch Proc %5.2f\n",nr_slot_rx,ue->pdsch_procedures_stat[proc->thread_id].p_time/(cpuf*1000.0));
|
LOG_D(PHY, "[SFN %d] Slot1: Pdsch Proc %5.2f\n",nr_slot_rx,ue->pdsch_procedures_stat[proc->thread_id].p_time/(cpuf*1000.0));
|
||||||
LOG_D(PHY, "[SFN %d] Slot0 Slot1: Dlsch Proc %5.2f\n",nr_slot_rx,ue->dlsch_procedures_stat[proc->thread_id].p_time/(cpuf*1000.0));
|
LOG_D(PHY, "[SFN %d] Slot0 Slot1: Dlsch Proc %5.2f\n",nr_slot_rx,ue->dlsch_procedures_stat[proc->thread_id].p_time/(cpuf*1000.0));
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1989,9 +1958,6 @@ if (nr_slot_rx==9) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stop_meas(&ue->generic_stat);
|
stop_meas(&ue->generic_stat);
|
||||||
#if PHYSIM
|
|
||||||
printf("after tubo until end of Rx %5.2f \n",ue->generic_stat.p_time/(cpuf*1000.0));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef EMOS
|
#ifdef EMOS
|
||||||
phy_procedures_emos_UE_RX(ue,slot,gNB_id);
|
phy_procedures_emos_UE_RX(ue,slot,gNB_id);
|
||||||
@@ -2001,11 +1967,7 @@ phy_procedures_emos_UE_RX(ue,slot,gNB_id);
|
|||||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_OUT);
|
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_OUT);
|
||||||
|
|
||||||
stop_meas(&ue->phy_proc_rx[proc->thread_id]);
|
stop_meas(&ue->phy_proc_rx[proc->thread_id]);
|
||||||
#if PHYSIM
|
|
||||||
printf("------FULL RX PROC [SFN %d]: %5.2f ------\n",nr_slot_rx,ue->phy_proc_rx[proc->thread_id].p_time/(cpuf*1000.0));
|
|
||||||
#else
|
|
||||||
LOG_D(PHY, "------FULL RX PROC [SFN %d]: %5.2f ------\n",nr_slot_rx,ue->phy_proc_rx[proc->thread_id].p_time/(cpuf*1000.0));
|
LOG_D(PHY, "------FULL RX PROC [SFN %d]: %5.2f ------\n",nr_slot_rx,ue->phy_proc_rx[proc->thread_id].p_time/(cpuf*1000.0));
|
||||||
#endif
|
|
||||||
|
|
||||||
//#endif //pdsch
|
//#endif //pdsch
|
||||||
|
|
||||||
|
|||||||
@@ -503,8 +503,10 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
//printf("crc32: [0]->0x%08x\n",crc24c(test_input, 32));
|
//printf("crc32: [0]->0x%08x\n",crc24c(test_input, 32));
|
||||||
// generate signal
|
// generate signal
|
||||||
|
unsigned char output[rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS] __attribute__((aligned(32)));
|
||||||
|
bzero(output,rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS);
|
||||||
if (input_fd == NULL) {
|
if (input_fd == NULL) {
|
||||||
nr_dlsch_encoding(gNB, test_input, frame, slot, dlsch, frame_parms,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
nr_dlsch_encoding(gNB, test_input, frame, slot, dlsch, frame_parms,output,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SNR = snr0; SNR < snr1; SNR += snr_step) {
|
for (SNR = snr0; SNR < snr1; SNR += snr_step) {
|
||||||
@@ -521,11 +523,12 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
//if (i<16)
|
//if (i<16)
|
||||||
// printf("encoder output f[%d] = %d\n",i,dlsch->harq_processes[0]->f[i]);
|
// printf("encoder output f[%d] = %d\n",i,dlsch->harq_processes[0]->f[i]);
|
||||||
|
/*
|
||||||
if (dlsch->harq_process.f[i] == 0)
|
if (dlsch->harq_process.f[i] == 0)
|
||||||
modulated_input[i] = 1.0; ///sqrt(2); //QPSK
|
modulated_input[i] = 1.0; ///sqrt(2); //QPSK
|
||||||
else
|
else
|
||||||
modulated_input[i] = -1.0; ///sqrt(2);
|
modulated_input[i] = -1.0; ///sqrt(2);
|
||||||
|
*/
|
||||||
//if (i<16) printf("modulated_input[%d] = %d\n",i,modulated_input[i]);
|
//if (i<16) printf("modulated_input[%d] = %d\n",i,modulated_input[i]);
|
||||||
//SNR =10;
|
//SNR =10;
|
||||||
SNR_lin = pow(10, SNR / 10.0);
|
SNR_lin = pow(10, SNR / 10.0);
|
||||||
@@ -548,9 +551,10 @@ int main(int argc, char **argv)
|
|||||||
channel_output_uncoded[i] = 1; //QPSK demod
|
channel_output_uncoded[i] = 1; //QPSK demod
|
||||||
else
|
else
|
||||||
channel_output_uncoded[i] = 0;
|
channel_output_uncoded[i] = 0;
|
||||||
|
/*
|
||||||
if (channel_output_uncoded[i] != dlsch->harq_process.f[i])
|
if (channel_output_uncoded[i] != dlsch->harq_process.f[i])
|
||||||
errors_bit_uncoded = errors_bit_uncoded + 1;
|
errors_bit_uncoded = errors_bit_uncoded + 1;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (errors_bit_uncoded>10)
|
//if (errors_bit_uncoded>10)
|
||||||
|
|||||||
@@ -369,6 +369,7 @@ int main(int argc, char **argv)
|
|||||||
uint8_t n_tx=1,n_rx=1;
|
uint8_t n_tx=1,n_rx=1;
|
||||||
uint8_t round;
|
uint8_t round;
|
||||||
uint8_t num_rounds = 4;
|
uint8_t num_rounds = 4;
|
||||||
|
char gNBthreads[128]="n";
|
||||||
|
|
||||||
channel_desc_t *gNB2UE;
|
channel_desc_t *gNB2UE;
|
||||||
//uint32_t nsymb,tx_lev,tx_lev1 = 0,tx_lev2 = 0;
|
//uint32_t nsymb,tx_lev,tx_lev1 = 0,tx_lev2 = 0;
|
||||||
@@ -430,9 +431,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
FILE *scg_fd=NULL;
|
FILE *scg_fd=NULL;
|
||||||
|
|
||||||
|
while ((c = getopt (argc, argv, "f:hA:pf:g:in:s:S:t:x:y:z:M:N:F:GR:dPIL:Ea:b:d:e:m:w:T:U:qX:")) != -1) {
|
||||||
while ((c = getopt (argc, argv, "f:hA:pf:g:in:s:S:t:x:y:z:M:N:F:GR:dPIL:Ea:b:D:e:m:w:T:U:q")) != -1) {
|
|
||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'f':
|
case 'f':
|
||||||
scg_fd = fopen(optarg,"r");
|
scg_fd = fopen(optarg,"r");
|
||||||
@@ -635,7 +634,12 @@ int main(int argc, char **argv)
|
|||||||
dmrs_arg[i] = atoi(argv[optind++]);
|
dmrs_arg[i] = atoi(argv[optind++]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'X':
|
||||||
|
strncpy(gNBthreads, optarg, sizeof(gNBthreads));
|
||||||
|
gNBthreads[sizeof(gNBthreads)-1]=0;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
case 'h':
|
case 'h':
|
||||||
printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n",
|
printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n",
|
||||||
@@ -671,7 +675,8 @@ int main(int argc, char **argv)
|
|||||||
printf("-U Change DMRS Config, arguments list DMRS TYPE{0=A,1=B} DMRS AddPos{0:2} DMRS ConfType{1:2}, e.g. -U 3 0 2 1 \n");
|
printf("-U Change DMRS Config, arguments list DMRS TYPE{0=A,1=B} DMRS AddPos{0:2} DMRS ConfType{1:2}, e.g. -U 3 0 2 1 \n");
|
||||||
printf("-P Print DLSCH performances\n");
|
printf("-P Print DLSCH performances\n");
|
||||||
printf("-w Write txdata to binary file (one frame)\n");
|
printf("-w Write txdata to binary file (one frame)\n");
|
||||||
printf("-D number of dlsch threads, 0: no dlsch parallelization\n");
|
printf("-d number of dlsch threads, 0: no dlsch parallelization\n");
|
||||||
|
printf("-X gNB thread pool configuration, n => no threads");
|
||||||
exit (-1);
|
exit (-1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -823,18 +828,18 @@ int main(int argc, char **argv)
|
|||||||
fs = 122.88e6;
|
fs = 122.88e6;
|
||||||
bw = 100e6;
|
bw = 100e6;
|
||||||
}
|
}
|
||||||
else if (mu == 1 && N_RB_DL == 162) {
|
|
||||||
fs = 61.44e6;
|
|
||||||
bw = 60e6;
|
|
||||||
}
|
|
||||||
else if (mu == 1 && N_RB_DL == 133) {
|
|
||||||
fs = 61.44e6;
|
|
||||||
bw = 50e6;
|
|
||||||
}
|
|
||||||
else if (mu == 1 && N_RB_DL == 106) {
|
else if (mu == 1 && N_RB_DL == 106) {
|
||||||
fs = 61.44e6;
|
fs = 61.44e6;
|
||||||
bw = 40e6;
|
bw = 40e6;
|
||||||
}
|
}
|
||||||
|
else if (mu == 1 && N_RB_DL == 133) {
|
||||||
|
fs = 61.44e6;
|
||||||
|
bw = 50e6;
|
||||||
|
}
|
||||||
|
else if (mu == 1 && N_RB_DL == 162) {
|
||||||
|
fs = 61.44e6;
|
||||||
|
bw = 60e6;
|
||||||
|
}
|
||||||
else if (mu == 3 && N_RB_DL == 66) {
|
else if (mu == 3 && N_RB_DL == 66) {
|
||||||
fs = 122.88e6;
|
fs = 122.88e6;
|
||||||
bw = 100e6;
|
bw = 100e6;
|
||||||
@@ -974,8 +979,7 @@ int main(int argc, char **argv)
|
|||||||
snrRun = 0;
|
snrRun = 0;
|
||||||
|
|
||||||
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
|
gNB->threadPool = (tpool_t*)malloc(sizeof(tpool_t));
|
||||||
char tp_param[] = "n";
|
initTpool(gNBthreads, gNB->threadPool, true);
|
||||||
initTpool(tp_param, gNB->threadPool, true);
|
|
||||||
gNB->resp_L1_tx = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
|
gNB->resp_L1_tx = (notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
|
||||||
initNotifiedFIFO(gNB->resp_L1_tx);
|
initNotifiedFIFO(gNB->resp_L1_tx);
|
||||||
// we create 2 threads for L1 tx processing
|
// we create 2 threads for L1 tx processing
|
||||||
@@ -1229,8 +1233,8 @@ int main(int argc, char **argv)
|
|||||||
UE->dlsch[UE_proc.thread_id][0][0]->max_ldpc_iterations+1)
|
UE->dlsch[UE_proc.thread_id][0][0]->max_ldpc_iterations+1)
|
||||||
n_errors++;
|
n_errors++;
|
||||||
|
|
||||||
NR_UE_PDSCH **pdsch_vars = UE->pdsch_vars[UE_proc.thread_id];
|
//NR_UE_PDSCH **pdsch_vars = UE->pdsch_vars[UE_proc.thread_id];
|
||||||
int16_t *UE_llr = pdsch_vars[0]->llr[0];
|
//int16_t *UE_llr = pdsch_vars[0]->llr[0];
|
||||||
|
|
||||||
TBS = UE_harq_process->TBS;//rel15->TBSize[0];
|
TBS = UE_harq_process->TBS;//rel15->TBSize[0];
|
||||||
uint16_t length_dmrs = get_num_dmrs(rel15->dlDmrsSymbPos);
|
uint16_t length_dmrs = get_num_dmrs(rel15->dlDmrsSymbPos);
|
||||||
@@ -1245,6 +1249,7 @@ int main(int argc, char **argv)
|
|||||||
printf("[DLSIM][PTRS] Available bits are: %5u, removed PTRS bits are: %5u \n",available_bits, (ptrsSymbPerSlot * ptrsRePerSymb *rel15->nrOfLayers* 2) );
|
printf("[DLSIM][PTRS] Available bits are: %5u, removed PTRS bits are: %5u \n",available_bits, (ptrsSymbPerSlot * ptrsRePerSymb *rel15->nrOfLayers* 2) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
for (i = 0; i < available_bits; i++) {
|
for (i = 0; i < available_bits; i++) {
|
||||||
|
|
||||||
if(((gNB_dlsch->harq_process.f[i] == 0) && (UE_llr[i] <= 0)) ||
|
if(((gNB_dlsch->harq_process.f[i] == 0) && (UE_llr[i] <= 0)) ||
|
||||||
@@ -1258,6 +1263,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
for (i = 0; i < TBS; i++) {
|
for (i = 0; i < TBS; i++) {
|
||||||
|
|
||||||
estimated_output_bit[i] = (UE_harq_process->b[i/8] & (1 << (i & 7))) >> (i & 7);
|
estimated_output_bit[i] = (UE_harq_process->b[i/8] & (1 << (i & 7))) >> (i & 7);
|
||||||
@@ -1301,12 +1307,9 @@ int main(int argc, char **argv)
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
if (print_perf==1) {
|
if (print_perf==1) {
|
||||||
printf("\ngNB TX function statistics (per %d us slot, NPRB %d, mcs %d, TBS %d, C %d, Kr %d (Zc %d))\n",
|
printf("\ngNB TX function statistics (per %d us slot, NPRB %d, mcs %d, TBS %d)\n",
|
||||||
1000>>*scc->ssbSubcarrierSpacing, g_rbSize, g_mcsIndex,
|
1000>>*scc->ssbSubcarrierSpacing, g_rbSize, g_mcsIndex,
|
||||||
msgDataTx->dlsch[0][0]->harq_process.pdsch_pdu.pdsch_pdu_rel15.TBSize[0]<<3,
|
msgDataTx->dlsch[0][0]->harq_process.pdsch_pdu.pdsch_pdu_rel15.TBSize[0]<<3);
|
||||||
msgDataTx->dlsch[0][0]->harq_process.C,
|
|
||||||
msgDataTx->dlsch[0][0]->harq_process.K,
|
|
||||||
msgDataTx->dlsch[0][0]->harq_process.K/((msgDataTx->dlsch[0][0]->harq_process.pdsch_pdu.pdsch_pdu_rel15.TBSize[0]<<3)>3824?22:10));
|
|
||||||
printDistribution(gNB->phy_proc_tx_0,table_tx,"PHY proc tx");
|
printDistribution(gNB->phy_proc_tx_0,table_tx,"PHY proc tx");
|
||||||
printStatIndent2(&gNB->dlsch_encoding_stats,"DLSCH encoding time");
|
printStatIndent2(&gNB->dlsch_encoding_stats,"DLSCH encoding time");
|
||||||
printStatIndent3(&gNB->dlsch_segmentation_stats,"DLSCH segmentation time");
|
printStatIndent3(&gNB->dlsch_segmentation_stats,"DLSCH segmentation time");
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ void *nrmac_stats_thread(void *arg) {
|
|||||||
fseek(fd,0,SEEK_SET);
|
fseek(fd,0,SEEK_SET);
|
||||||
}
|
}
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
return (void *)0;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_mac_stats(gNB_MAC_INST *gNB) {
|
void clear_mac_stats(gNB_MAC_INST *gNB) {
|
||||||
|
|||||||
Reference in New Issue
Block a user