Commit b58a8c62 authored by Raymond Knopp's avatar Raymond Knopp

Merge remote-tracking branch 'origin/tx-proc-optim' into bler_txoptim

parents 5a25fdc6 bdea7f46
...@@ -314,9 +314,9 @@ add_definitions("-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAV ...@@ -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 () ...@@ -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) { ...@@ -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);
......
This diff is collapsed.
...@@ -30,10 +30,14 @@ ...@@ -30,10 +30,14 @@
Modified in June, 2001, to include the length non multiple of 8 Modified in June, 2001, to include the length non multiple of 8
*/ */
#define USE_INTEL_CRC 1
#include "coding_defs.h" #include "coding_defs.h"
#include "assertions.h" #include "assertions.h"
#ifdef USE_INTEL_CRC
#include "crc_intel.h"
#include "crc.h"
#endif
/*ref 36-212 v8.6.0 , pp 8-9 */ /*ref 36-212 v8.6.0 , pp 8-9 */
/* the highest degree is set by default */ /* the highest degree is set by default */
...@@ -94,6 +98,28 @@ static unsigned short crc11Table[256]; ...@@ -94,6 +98,28 @@ static unsigned short crc11Table[256];
static unsigned char crc8Table[256]; static unsigned char crc8Table[256];
static unsigned char crc6Table[256]; static unsigned char crc6Table[256];
#ifdef USE_INTEL_CRC
static DECLARE_ALIGNED(struct crc_pclmulqdq_ctx lte_crc24a_pclmulqdq, 16) = {
0x64e4d700, /**< k1 */
0x2c8c9d00, /**< k2 */
0xd9fe8c00, /**< k3 */
0xf845fe24, /**< q */
0x864cfb00, /**< p */
0ULL /**< res */
};
__m128i crc_xmm_be_le_swap128;
DECLARE_ALIGNED(const uint8_t crc_xmm_shift_tab[48], 16) = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
#endif
void crcTableInit (void) void crcTableInit (void)
{ {
unsigned char c = 0; unsigned char c = 0;
...@@ -108,14 +134,20 @@ void crcTableInit (void) ...@@ -108,14 +134,20 @@ void crcTableInit (void)
crc8Table[c] = (unsigned char) (crcbit (&c, 1, poly8) >> 24); crc8Table[c] = (unsigned char) (crcbit (&c, 1, poly8) >> 24);
crc6Table[c] = (unsigned char) (crcbit (&c, 1, poly6) >> 24); crc6Table[c] = (unsigned char) (crcbit (&c, 1, poly6) >> 24);
} while (++c); } while (++c);
#ifdef USE_INTEL_CRC
crc_xmm_be_le_swap128 = _mm_setr_epi32(0x0c0d0e0f, 0x08090a0b,
0x04050607, 0x00010203);
#endif
} }
/********************************************************* /*********************************************************
Byte by byte implementations, Byte by byte LUT implementations,
assuming initial byte is 0 padded (in MSB) if necessary assuming initial byte is 0 padded (in MSB) if necessary
can use SIMD optimized Intel CRC for LTE/NR 24a/24b variants
*********************************************************/ *********************************************************/
unsigned int crc24a (unsigned char * inptr, unsigned int crc24a (unsigned char * inptr,
int bitlen) int bitlen)
{ {
...@@ -124,7 +156,7 @@ unsigned int crc24a (unsigned char * inptr, ...@@ -124,7 +156,7 @@ unsigned int crc24a (unsigned char * inptr,
unsigned int crc = 0; unsigned int crc = 0;
octetlen = bitlen / 8; /* Change in octets */ octetlen = bitlen / 8; /* Change in octets */
resbit = (bitlen % 8); resbit = (bitlen % 8);
#ifndef USE_INTEL_CRC
while (octetlen-- > 0) { while (octetlen-- > 0) {
// printf("crc24a: in %x => crc %x\n",crc,*inptr); // printf("crc24a: in %x => crc %x\n",crc,*inptr);
crc = (crc << 8) ^ crc24aTable[(*inptr++) ^ (crc >> 24)]; crc = (crc << 8) ^ crc24aTable[(*inptr++) ^ (crc >> 24)];
...@@ -132,10 +164,24 @@ unsigned int crc24a (unsigned char * inptr, ...@@ -132,10 +164,24 @@ unsigned int crc24a (unsigned char * inptr,
if (resbit > 0) if (resbit > 0)
crc = (crc << resbit) ^ crc24aTable[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))]; crc = (crc << resbit) ^ crc24aTable[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))];
return crc; return crc;
#else
return crc32_calc_pclmulqdq(inptr, octetlen, 0,
&lte_crc24a_pclmulqdq) >> 8;
#endif
} }
#ifdef USE_INTEL_CRC
static DECLARE_ALIGNED(struct crc_pclmulqdq_ctx lte_crc24b_pclmulqdq, 16) = {
0x80140500, /**< k1 */
0x42000100, /**< k2 */
0x90042100, /**< k3 */
0xffff83ff, /**< q */
0x80006300, /**< p */
0ULL /**< res */
};
#endif
unsigned int crc24b (unsigned char * inptr, unsigned int crc24b (unsigned char * inptr,
int bitlen) int bitlen)
{ {
...@@ -143,7 +189,7 @@ unsigned int crc24b (unsigned char * inptr, ...@@ -143,7 +189,7 @@ unsigned int crc24b (unsigned char * inptr,
unsigned int crc = 0; unsigned int crc = 0;
octetlen = bitlen / 8; /* Change in octets */ octetlen = bitlen / 8; /* Change in octets */
resbit = (bitlen % 8); resbit = (bitlen % 8);
#ifndef USE_INTEL_CRC
while (octetlen-- > 0) { while (octetlen-- > 0) {
// printf("crc24b: in %x => crc %x (%x)\n",crc,*inptr,crc24bTable[(*inptr) ^ (crc >> 24)]); // printf("crc24b: in %x => crc %x (%x)\n",crc,*inptr,crc24bTable[(*inptr) ^ (crc >> 24)]);
crc = (crc << 8) ^ crc24bTable[(*inptr++) ^ (crc >> 24)]; crc = (crc << 8) ^ crc24bTable[(*inptr++) ^ (crc >> 24)];
...@@ -153,6 +199,10 @@ unsigned int crc24b (unsigned char * inptr, ...@@ -153,6 +199,10 @@ unsigned int crc24b (unsigned char * inptr,
crc = (crc << resbit) ^ crc24bTable[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))]; crc = (crc << resbit) ^ crc24bTable[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))];
return crc; return crc;
#else
return crc32_calc_pclmulqdq(inptr, octetlen, 0,
&lte_crc24b_pclmulqdq) >> 8;
#endif
} }
unsigned int crc24c (unsigned char * inptr, unsigned int crc24c (unsigned char * inptr,
......
This diff is collapsed.
/*******************************************************************************
Copyright (c) 2009-2018, Intel Corporation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/
/**
* Header file with CRC external definitions
*
*/
#ifndef __CRCEXT_H__
#define __CRCEXT_H__
#include <x86intrin.h>
#include "types.h"
/**
* Flag indicating availability of PCLMULQDQ instruction
* Only valid after running CRCInit() function.
*/
extern int pclmulqdq_available;
/**
* Flag indicating availability of PCLMULQDQ instruction
* Only valid after running CRCInit() function.
*/
extern __m128i crc_xmm_be_le_swap128;
extern const uint8_t crc_xmm_shift_tab[48];
/**
* @brief Shifts right 128 bit register by specified number of bytes
*
* @param reg 128 bit value
* @param num number of bytes to shift right \a reg by (0-16)
*
* @return \a reg >> (\a num * 8)
*/
__forceinline
__m128i xmm_shift_right(__m128i reg, const unsigned int num)
{
const __m128i *p = (const __m128i *)(crc_xmm_shift_tab + 16 + num);
return _mm_shuffle_epi8(reg, _mm_loadu_si128(p));
}
/**
* @brief Shifts left 128 bit register by specified number of bytes
*
* @param reg 128 bit value
* @param num number of bytes to shift left \a reg by (0-16)
*
* @return \a reg << (\a num * 8)
*/
__forceinline
__m128i xmm_shift_left(__m128i reg, const unsigned int num)
{
const __m128i *p = (const __m128i *)(crc_xmm_shift_tab + 16 - num);
return _mm_shuffle_epi8(reg, _mm_loadu_si128(p));
}
/**
* @brief Initializes CRC module.
* @note It is mandatory to run it before using any of CRC API's.
*/
extern void CRCInit(void);
#endif /* __CRCEXT_H__ */
...@@ -22,6 +22,7 @@ ...@@ -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 @@ ...@@ -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*);
......
...@@ -73,8 +73,17 @@ ...@@ -73,8 +73,17 @@
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)
{ {
......
...@@ -86,8 +86,6 @@ int nrLDPC_encod(unsigned char **test_input,unsigned char **channel_input,int 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 ...@@ -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 ...@@ -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 ...@@ -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 @@ ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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
......
/*******************************************************************************
Copyright (c) 2009-2018, Intel Corporation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/
/* Common data types, macros and functions used across the CRC library */
#ifndef CRC_TYPES_H_
#define CRC_TYPES_H_
#ifdef __KERNEL__
#include <asm/i387.h>
#include <linux/types.h>
typedef uint32_t uint_fast32_t;
typedef uint16_t uint_fast16_t;
typedef uint8_t uint_fast8_t;
#else
#include <stdint.h>
#include <stddef.h>
#endif
/* Declare variable at address aligned to a boundary */
#define DECLARE_ALIGNED(_declaration, _boundary) \
_declaration __attribute__((aligned(_boundary)))
/* Macro to make function to be always inlined */
#ifndef DEBUG
#define __forceinline \
static inline __attribute__((always_inline))
#else
#define __forceinline \
static
#endif
/* Likely & unliekly hints for the compiler */
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
/* Macro to get dimension of an array */
#ifndef DIM
#define DIM(x) (sizeof(x)/sizeof(x[0]))
#endif
/**
* Common functions
*/
/**
* @brief Swaps bytes in 16 bit word
*
* @param val 16 bit data value
*
* @return byte swapped value
*/
__forceinline uint16_t bswap2(const uint16_t val)
{
return (uint16_t) ((val >> 8) | (val << 8));
}
/**
* @brief Swaps bytes in 32 bit word
* ABCD -> DCBA
*
* @param val 32 bit data value
*
* @return byte swapped value
*/
__forceinline uint32_t bswap4(const uint32_t val)
{
return ((val >> 24) | /**< A*/
((val & 0xff0000) >> 8) | /**< B*/
((val & 0xff00) << 8) | /**< C*/
(val << 24)); /**< D*/
}
#endif /* CRC_TYPES_H_ */
This diff is collapsed.
...@@ -85,6 +85,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -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,
......
This diff is collapsed.
...@@ -368,7 +368,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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 { ...@@ -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;
...@@ -868,6 +854,9 @@ typedef struct PHY_VARS_gNB_s { ...@@ -868,6 +854,9 @@ typedef struct PHY_VARS_gNB_s {
time_stats_t dlsch_encoding_stats; time_stats_t dlsch_encoding_stats;
time_stats_t dlsch_modulation_stats; time_stats_t dlsch_modulation_stats;
time_stats_t dlsch_scrambling_stats; time_stats_t dlsch_scrambling_stats;
time_stats_t dlsch_resource_mapping_stats;
time_stats_t dlsch_layer_mapping_stats;
time_stats_t dlsch_precoding_stats;
time_stats_t tinput; time_stats_t tinput;
time_stats_t tprep; time_stats_t tprep;
time_stats_t tparity; time_stats_t tparity;
......
...@@ -843,11 +843,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int gNB_ ...@@ -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, ...@@ -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, ...@@ -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) { ...@@ -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) { ...@@ -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, ...@@ -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) { ...@@ -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); ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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");
...@@ -636,6 +635,11 @@ int main(int argc, char **argv) ...@@ -636,6 +635,11 @@ int main(int argc, char **argv)
} }
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) ...@@ -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;
} }
...@@ -827,6 +832,14 @@ int main(int argc, char **argv) ...@@ -827,6 +832,14 @@ int main(int argc, char **argv)
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;
...@@ -966,8 +979,7 @@ int main(int argc, char **argv) ...@@ -966,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
...@@ -1221,8 +1233,8 @@ int main(int argc, char **argv) ...@@ -1221,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);
...@@ -1237,6 +1249,7 @@ int main(int argc, char **argv) ...@@ -1237,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)) ||
...@@ -1250,6 +1263,7 @@ int main(int argc, char **argv) ...@@ -1250,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);
...@@ -1293,11 +1307,9 @@ int main(int argc, char **argv) ...@@ -1293,11 +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, 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.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");
...@@ -1309,6 +1321,9 @@ int main(int argc, char **argv) ...@@ -1309,6 +1321,9 @@ int main(int argc, char **argv)
printStatIndent3(&gNB->dlsch_interleaving_stats, "DLSCH Interleaving time"); printStatIndent3(&gNB->dlsch_interleaving_stats, "DLSCH Interleaving time");
printStatIndent2(&gNB->dlsch_modulation_stats,"DLSCH modulation time"); printStatIndent2(&gNB->dlsch_modulation_stats,"DLSCH modulation time");
printStatIndent2(&gNB->dlsch_scrambling_stats, "DLSCH scrambling time"); printStatIndent2(&gNB->dlsch_scrambling_stats, "DLSCH scrambling time");
printStatIndent2(&gNB->dlsch_layer_mapping_stats, "DLSCH Layer Mapping time");
printStatIndent2(&gNB->dlsch_resource_mapping_stats, "DLSCH Resource Mapping time");
printStatIndent2(&gNB->dlsch_precoding_stats,"DLSCH Layer Precoding time");
printf("\nUE RX function statistics (per %d us slot)\n",1000>>*scc->ssbSubcarrierSpacing); printf("\nUE RX function statistics (per %d us slot)\n",1000>>*scc->ssbSubcarrierSpacing);
......
...@@ -64,7 +64,7 @@ void *nrmac_stats_thread(void *arg) { ...@@ -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) {
......
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