Merge remote-tracking branch 'origin/fix-ubsan-ldpc' into integration_2023_w16b

This commit is contained in:
Robert Schmidt
2023-04-21 16:30:52 +02:00
54 changed files with 1792 additions and 2445 deletions
+9 -2
View File
@@ -332,11 +332,18 @@ class Cluster:
ranbuild_job = self._start_build('ran-build')
attemptedImages += ['ran-build']
wait = ranbuild_job is not None and physim_job is not None and self._wait_build_end([ranbuild_job, physim_job], 1200)
if not wait: logging.error('error during build of ranbuild_job or physim_job')
self._recreate_is_tag('oai-clang', imageTag, 'openshift/oai-clang-is.yaml')
self._recreate_bc('oai-clang', imageTag, 'openshift/oai-clang-bc.yaml')
self._retag_image_statement('ran-base', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-base', baseTag, 'docker/Dockerfile.clang.rhel8.2')
clang_job = self._start_build('oai-clang')
attemptedImages += ['oai-clang']
wait = ranbuild_job is not None and physim_job is not None and clang_job is not None and self._wait_build_end([ranbuild_job, physim_job, clang_job], 1200)
if not wait: logging.error('error during build of ranbuild_job or physim_job or clang_job')
status = status and wait
self.cmd.run(f'oc logs {ranbuild_job} &> cmake_targets/log/ran-build.log')
self.cmd.run(f'oc logs {physim_job} &> cmake_targets/log/oai-physim.log')
self.cmd.run(f'oc logs {clang_job} &> cmake_targets/log/oai-clang.log')
self.cmd.run(f'oc get pods.metrics.k8s.io &>> cmake_targets/log/build-metrics.log', '\$', 10)
if status:
+1 -1
View File
@@ -81,7 +81,7 @@
#define RLC_TX_MAXSIZE 10000000
#define RLC_RX_MAXSIZE 10000000
#define SEND_MRW_ON 240
#define MAX_ANT 8
// CBA constant
#define NUM_MAX_CBA_GROUP 4
+9 -7
View File
@@ -153,15 +153,17 @@ static inline void start_meas(time_stats_t *ts) {
static inline void stop_meas(time_stats_t *ts) {
if (opp_enabled) {
long long out = rdtsc_oai();
ts->diff += (out-ts->in);
/// process duration is the difference between two clock points
ts->p_time = (out-ts->in);
ts->diff_square += ((double)out-ts->in)*((double)out-ts->in);
if (ts->in) {
ts->diff += (out - ts->in);
/// process duration is the difference between two clock points
ts->p_time = (out - ts->in);
ts->diff_square += ((double)out - ts->in) * ((double)out - ts->in);
if ((out-ts->in) > ts->max)
ts->max = out-ts->in;
if ((out - ts->in) > ts->max)
ts->max = out - ts->in;
ts->meas_flag=0;
ts->meas_flag = 0;
}
}
}
+43
View File
@@ -0,0 +1,43 @@
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
#---------------------------------------------------------------------
#
# Dockerfile for the Open-Air-Interface BUILD service
# Valid for RHEL8
#
#---------------------------------------------------------------------
FROM ran-base:latest AS oai-clang
RUN rm -Rf /oai-ran
WORKDIR /oai-ran
COPY . .
#only install LLVM (clang, ...) for this container, the others don't need it
RUN yum install -y llvm-toolset
#run build_oai to build the target image
RUN /bin/sh oaienv && \
cd cmake_targets && \
mkdir -p log && \
export CC=/usr/bin/clang && \
export CXX=/usr/bin/clang++ && \
./build_oai --phy_simulators --gNB --eNB --nrUE --UE --ninja --verbose-ci --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror
+4 -5
View File
@@ -31,16 +31,14 @@ RUN rm -Rf /oai-ran
WORKDIR /oai-ran
COPY . .
#only install address sanitizer and LLVM (clang, ...) for this container, the others don't need it
RUN yum install -y libasan llvm-toolset
#only install address and undefined behavior sanitizer for this container, the others don't need it
RUN yum install -y libasan libubsan
#run build_oai to build the target image
RUN /bin/sh oaienv && \
cd cmake_targets && \
mkdir -p log && \
export CC=/usr/bin/clang && \
export CXX=/usr/bin/clang++ && \
./build_oai --phy_simulators --gNB --eNB --nrUE --UE --ninja --verbose-ci --sanitize-address --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror
./build_oai --phy_simulators --ninja --verbose-ci --sanitize --noavx512 -c --cmake-opt -DCMAKE_C_FLAGS=-Werror --cmake-opt -DCMAKE_CXX_FLAGS=-Werror
#start from scratch for target executable
FROM registry.access.redhat.com/ubi8/ubi:latest as oai-physim
@@ -89,6 +87,7 @@ COPY --from=phy-sim-build \
/lib64/libexslt.so.0 \
/lib64/libxslt.so.1 \
/usr/lib64/libasan.so.5 \
/usr/lib64/libubsan.so.1 \
/oai-ran/cmake_targets/ran_build/build/libdfts.so \
/oai-ran/cmake_targets/ran_build/build/libldpc.so \
/oai-ran/cmake_targets/ran_build/build/libldpc_orig.so \
+1 -1
View File
@@ -127,7 +127,7 @@ int main(int argc, char *argv[])
time_t currentTime;
char fileName[512], currentTimeInfo[25];
char folderName[] = ".";
FILE *logFile;
FILE *logFile = NULL;
/*folderName=getenv("HOME");
strcat(folderName,"/Desktop/polartestResults");*/
+53 -63
View File
@@ -44,16 +44,16 @@
/*ref 36-212 v8.6.0 , pp 8-9 */
/* the highest degree is set by default */
unsigned int poly24a = 0x864cfb00; // 1000 0110 0100 1100 1111 1011
// D^24 + D^23 + D^18 + D^17 + D^14 + D^11 + D^10 + D^7 + D^6 + D^5 + D^4 + D^3 + D + 1
unsigned int poly24b = 0x80006300; // 1000 0000 0000 0000 0110 0011
// D^24 + D^23 + D^6 + D^5 + D + 1
unsigned int poly24c = 0xb2b11700; // 1011 0010 1011 0001 0001 0111
// D^24+D^23+D^21+D^20+D^17+D^15+D^13+D^12+D^8+D^4+D^2+D+1
uint32_t poly24a = 0x864cfb00; // 1000 0110 0100 1100 1111 1011
// D^24 + D^23 + D^18 + D^17 + D^14 + D^11 + D^10 + D^7 + D^6 + D^5 + D^4 + D^3 + D + 1
uint32_t poly24b = 0x80006300; // 1000 0000 0000 0000 0110 0011
// D^24 + D^23 + D^6 + D^5 + D + 1
uint32_t poly24c = 0xb2b11700; // 1011 0010 1011 0001 0001 0111
// D^24+D^23+D^21+D^20+D^17+D^15+D^13+D^12+D^8+D^4+D^2+D+1
unsigned int poly16 = 0x10210000; // 0001 0000 0010 0001 D^16 + D^12 + D^5 + 1
unsigned int poly12 = 0x80F00000; // 1000 0000 1111 D^12 + D^11 + D^3 + D^2 + D + 1
unsigned int poly8 = 0x9B000000; // 1001 1011 D^8 + D^7 + D^4 + D^3 + D + 1
uint32_t poly16 = 0x10210000; // 0001 0000 0010 0001 D^16 + D^12 + D^5 + 1
uint32_t poly12 = 0x80F00000; // 1000 0000 1111 D^12 + D^11 + D^3 + D^2 + D + 1
uint32_t poly8 = 0x9B000000; // 1001 1011 D^8 + D^7 + D^4 + D^3 + D + 1
uint32_t poly6 = 0x84000000; // 10000100000... -> D^6+D^5+1
uint32_t poly11 = 0xc4200000; //11000100001000... -> D^11+D^10+D^9+D^5+1
@@ -65,14 +65,12 @@ For initialization && verification purposes,
The first bit is in the MSB of each byte
*********************************************************/
unsigned int crcbit (unsigned char * inputptr,
int octetlen,
unsigned int poly)
uint32_t crcbit(unsigned char* inputptr, int octetlen, uint32_t poly)
{
unsigned int i, crc = 0, c;
uint32_t i, crc = 0, c;
while (octetlen-- > 0) {
c = ((unsigned int)(*inputptr++)) << 24;
c = ((uint32_t)(*inputptr++)) << 24;
for (i = 8; i != 0; i--) {
if ((1U << 31) & (c ^ crc))
@@ -92,14 +90,14 @@ unsigned int crcbit (unsigned char * inputptr,
crc table initialization
*********************************************************/
static unsigned int crc24aTable[256];
static unsigned int crc24bTable[256];
static unsigned int crc24cTable[256];
static unsigned short crc16Table[256];
static unsigned short crc12Table[256];
static unsigned short crc11Table[256];
static unsigned char crc8Table[256];
static unsigned char crc6Table[256];
static uint32_t crc24aTable[256];
static uint32_t crc24bTable[256];
static uint32_t crc24cTable[256];
static uint32_t crc16Table[256];
static uint32_t crc12Table[256];
static uint32_t crc11Table[256];
static uint32_t crc8Table[256];
static uint32_t crc6Table[256];
#if USE_INTEL_CRC
static DECLARE_ALIGNED(struct crc_pclmulqdq_ctx lte_crc24a_pclmulqdq, 16) = {
@@ -131,11 +129,11 @@ void crcTableInit (void)
crc24aTable[c] = crcbit (&c, 1, poly24a);
crc24bTable[c] = crcbit (&c, 1, poly24b);
crc24cTable[c] = crcbit (&c, 1, poly24c);
crc16Table[c] = (unsigned short) (crcbit (&c, 1, poly16) >> 16);
crc12Table[c] = (unsigned short) (crcbit (&c, 1, poly12) >> 16);
crc11Table[c] = (unsigned short) (crcbit (&c, 1, poly11) >> 16);
crc8Table[c] = (unsigned char) (crcbit (&c, 1, poly8) >> 24);
crc6Table[c] = (unsigned char) (crcbit (&c, 1, poly6) >> 24);
crc16Table[c] = crcbit(&c, 1, poly16) >> 16;
crc12Table[c] = crcbit(&c, 1, poly12) >> 16;
crc11Table[c] = crcbit(&c, 1, poly11) >> 16;
crc8Table[c] = crcbit(&c, 1, poly8) >> 24;
crc6Table[c] = crcbit(&c, 1, poly6) >> 24;
} while (++c);
#if USE_INTEL_CRC
crc_xmm_be_le_swap128 = _mm_setr_epi32(0x0c0d0e0f, 0x08090a0b,
@@ -151,19 +149,18 @@ 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,
int bitlen)
uint32_t crc24a(unsigned char* inptr, int bitlen)
{
int octetlen = bitlen / 8; /* Change in octets */
if ( bitlen % 8 || !USE_INTEL_CRC ) {
unsigned int crc = 0;
int resbit= (bitlen % 8);
uint32_t crc = 0;
int resbit = (bitlen % 8);
while (octetlen-- > 0) {
// printf("crc24a: in %x => crc %x\n",crc,*inptr);
crc = (crc << 8) ^ crc24aTable[(*inptr++) ^ (crc >> 24)];
}
while (octetlen-- > 0) {
// printf("crc24a: in %x => crc %x\n",crc,*inptr);
crc = (crc << 8) ^ crc24aTable[(*inptr++) ^ (crc >> 24)];
}
if (resbit > 0)
crc = (crc << resbit) ^ crc24aTable[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))];
@@ -188,19 +185,18 @@ static DECLARE_ALIGNED(struct crc_pclmulqdq_ctx lte_crc24b_pclmulqdq, 16) = {
0ULL /**< res */
};
#endif
unsigned int crc24b (unsigned char * inptr,
int bitlen)
uint32_t crc24b(unsigned char* inptr, int bitlen)
{
int octetlen = bitlen / 8; /* Change in octets */
if ( bitlen % 8 || !USE_INTEL_CRC ) {
unsigned int crc = 0;
int resbit = (bitlen % 8);
uint32_t crc = 0;
int resbit = (bitlen % 8);
while (octetlen-- > 0) {
// printf("crc24b: in %x => crc %x (%x)\n",crc,*inptr,crc24bTable[(*inptr) ^ (crc >> 24)]);
crc = (crc << 8) ^ crc24bTable[(*inptr++) ^ (crc >> 24)];
}
while (octetlen-- > 0) {
// printf("crc24b: in %x => crc %x (%x)\n",crc,*inptr,crc24bTable[(*inptr) ^ (crc >> 24)]);
crc = (crc << 8) ^ crc24bTable[(*inptr++) ^ (crc >> 24)];
}
if (resbit > 0)
crc = (crc << resbit) ^ crc24bTable[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))];
@@ -215,11 +211,10 @@ unsigned int crc24b (unsigned char * inptr,
#endif
}
unsigned int crc24c (unsigned char * inptr,
int bitlen)
uint32_t crc24c(unsigned char* inptr, int bitlen)
{
int octetlen, resbit;
unsigned int crc = 0;
uint32_t crc = 0;
octetlen = bitlen / 8; /* Change in octets */
resbit = (bitlen % 8);
@@ -234,11 +229,10 @@ unsigned int crc24c (unsigned char * inptr,
return crc;
}
unsigned int
crc16 (unsigned char * inptr, int bitlen)
uint32_t crc16(unsigned char* inptr, int bitlen)
{
int octetlen, resbit;
unsigned int crc = 0;
uint32_t crc = 0;
octetlen = bitlen / 8; /* Change in octets */
resbit = (bitlen % 8);
@@ -253,11 +247,10 @@ crc16 (unsigned char * inptr, int bitlen)
return crc;
}
unsigned int
crc12 (unsigned char * inptr, int bitlen)
uint32_t crc12(unsigned char* inptr, int bitlen)
{
int octetlen, resbit;
unsigned int crc = 0;
uint32_t crc = 0;
octetlen = bitlen / 8; /* Change in octets */
resbit = (bitlen % 8);
@@ -271,11 +264,10 @@ crc12 (unsigned char * inptr, int bitlen)
return crc;
}
unsigned int
crc11 (unsigned char * inptr, int bitlen)
uint32_t crc11(unsigned char* inptr, int bitlen)
{
int octetlen, resbit;
unsigned int crc = 0;
uint32_t crc = 0;
octetlen = bitlen / 8; /* Change in octets */
resbit = (bitlen % 8);
@@ -289,29 +281,27 @@ crc11 (unsigned char * inptr, int bitlen)
return crc;
}
unsigned int
crc8 (unsigned char * inptr, int bitlen)
uint32_t crc8(unsigned char* inptr, int bitlen)
{
int octetlen, resbit;
unsigned int crc = 0;
uint32_t crc = 0;
octetlen = bitlen / 8; /* Change in octets */
resbit = (bitlen % 8);
while (octetlen-- > 0) {
crc = ((unsigned int)crc8Table[(*inptr++) ^ (crc >> 24)]) << 24;
crc = ((uint32_t)crc8Table[(*inptr++) ^ (crc >> 24)]) << 24;
}
if (resbit > 0)
crc = (crc << resbit) ^ ((unsigned int)(crc8Table[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))]) << 24);
crc = (crc << resbit) ^ ((uint32_t)(crc8Table[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))]) << 24);
return crc;
}
unsigned int
crc6 (unsigned char * inptr, int bitlen)
uint32_t crc6(unsigned char* inptr, int bitlen)
{
int octetlen, resbit;
unsigned int crc = 0;
uint32_t crc = 0;
octetlen = bitlen / 8; /* Change in octets */
resbit = (bitlen % 8);
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -34,6 +34,21 @@
#include "time_meas.h"
#endif
#include "nrLDPCdecoder_defs.h"
typedef struct {
uint8_t* d;
int dim1;
int dim2;
} arr8_t;
typedef struct {
uint16_t* d;
int dim1;
int dim2;
} arr16_t;
typedef struct {
uint32_t* d;
int dim1;
int dim2;
} arr32_t;
// ==============================================================================
// TYPES
@@ -46,12 +61,12 @@ typedef struct nrLDPC_lut {
const uint8_t* numBnInBnGroups; /**< Number of CNs in every BN group */
const uint32_t* startAddrBnGroups; /**< Start addresses for BN groups in BN processing buffer */
const uint16_t* startAddrBnGroupsLlr; /**< Start addresses for BN groups in LLR processing buffer */
const uint16_t** circShift[NR_LDPC_NUM_CN_GROUPS_BG1]; /**< LUT for circular shift values for all CN groups and Zs */
const uint32_t** startAddrBnProcBuf[NR_LDPC_NUM_CN_GROUPS_BG1]; /**< LUT of start addresses of CN groups in BN proc buffer */
const uint8_t** bnPosBnProcBuf[NR_LDPC_NUM_CN_GROUPS_BG1]; /**< LUT of BN positions in BG for CN groups */
arr16_t circShift[NR_LDPC_NUM_CN_GROUPS_BG1]; /**< LUT for circular shift values for all CN groups and Zs */
arr32_t startAddrBnProcBuf[NR_LDPC_NUM_CN_GROUPS_BG1]; /**< LUT of start addresses of CN groups in BN proc buffer */
arr8_t bnPosBnProcBuf[NR_LDPC_NUM_CN_GROUPS_BG1]; /**< LUT of BN positions in BG for CN groups */
const uint16_t* llr2llrProcBufAddr; /**< LUT for transferring input LLRs to LLR processing buffer */
const uint8_t* llr2llrProcBufBnPos; /**< LUT BN position in BG */
const uint8_t** posBnInCnProcBuf[NR_LDPC_NUM_CN_GROUPS_BG1]; /**< LUT for llr2cnProcBuf */
arr8_t posBnInCnProcBuf[NR_LDPC_NUM_CN_GROUPS_BG1]; /**< LUT for llr2cnProcBuf */
} t_nrLDPC_lut;
/**
+3 -1
View File
@@ -753,7 +753,9 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
const int Prx = gNB->gNB_config.carrier_config.num_rx_ant.value;
const int max_ul_mimo_layers = 4; // taken from phy_init_nr_gNB()
const int n_buf = Prx * max_ul_mimo_layers;
PHY_MEASUREMENTS_gNB *meas=&gNB->measurements;
free_and_zero(meas->n0_subband_power);
free_and_zero(meas->n0_subband_power_dB);
int max_dl_mimo_layers =(fp->nb_antennas_tx<NR_MAX_NB_LAYERS) ? fp->nb_antennas_tx : NR_MAX_NB_LAYERS;
if (fp->nb_antennas_tx>1) {
for (int nl = 0; nl < max_dl_mimo_layers; nl++) {
@@ -1024,7 +1024,7 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
#elif defined(__arm__) || defined(__aarch64__)
int16x8_t *dl_ch0_128, *dl_ch1_128;
#endif
int *dl_ch0,*dl_ch1;
int *dl_ch0=NULL,*dl_ch1=NULL;
LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
int nb_subbands,subband_size,last_subband_size;
+10 -11
View File
@@ -352,16 +352,16 @@ void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t
if (ra_header==0) {
for (i=16; i>0; i--) {
if ((rb_alloc&(1<<i)) != 0)
rb_alloc2[(3*(16-i))>>5] |= (7<<((3*(16-i))%32));
if ((rb_alloc & (1 << i)) != 0)
rb_alloc2[(3 * (16 - i)) >> 5] |= (7U << ((3 * (16 - i)) % 32));
}
// bit mask across
if ((rb_alloc2[0]>>31)==1)
rb_alloc2[1] |= 1;
rb_alloc2[1] |= 1;
if ((rb_alloc&1) != 0)
rb_alloc2[1] |= (3<<16);
rb_alloc2[1] |= (3 << 16);
}
else {
LOG_W(PHY,"resource type 1 not supported for N_RB_DL=50\n");
@@ -371,10 +371,10 @@ void conv_rballoc(uint8_t ra_header,uint32_t rb_alloc,uint32_t N_RB_DL,uint32_t
case 100:
if (ra_header==0) {
for (i=0; i<25; i++) {
if ((rb_alloc&(1<<(24-i))) != 0)
rb_alloc2[(4*i)>>5] |= (0xf<<((4*i)%32));
if ((rb_alloc & (1 << (24 - i))) != 0)
rb_alloc2[(4 * i) >> 5] |= (0xfU << ((4 * i) % 32));
// printf("rb_alloc2[%d] (type 0) %x (%d)\n",(4*i)>>5,rb_alloc2[(4*i)>>5],rb_alloc&(1<<i));
// printf("rb_alloc2[%d] (type 0) %x (%d)\n",(4*i)>>5,rb_alloc2[(4*i)>>5],rb_alloc&(1<<i));
}
}
else {
@@ -960,8 +960,8 @@ uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t
case 2:
if ((subframe!=2) && (subframe!=7)) {
LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config);
ret=255;
LOG_E(PHY, "subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n", subframe, frame_parms->tdd_config);
ret = 255;
}
else ret = (subframe/7);
break;
@@ -996,8 +996,7 @@ uint8_t subframe2harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t
}
}
AssertFatal(ret!=255,
"invalid harq_pid(%d) at SFN/SF = %d/%d\n", (int8_t)ret, frame, subframe);
AssertFatal(ret != 255, "invalid harq_pid(%d) at SFN/SF = %d/%d\n", (int8_t)ret, frame, subframe);
return ret;
}
+12 -12
View File
@@ -840,16 +840,16 @@ int allocate_REs_in_RB_no_pilots_16QAM_tm2(PHY_VARS_eNB* phy_vars_eNB,
(((uint32_t)x0p[4])<<5)|(((uint32_t)x0p[6])<<4)|
(((uint32_t)x0p[5])<<7)|(((uint32_t)x0p[7])<<6);
txF0[0]=qam_table16_0[qam16_table_offset];
txF1[0]=qam_table16_1[qam16_table_offset];
memcpy(txF0, &qam_table16_0[qam16_table_offset], sizeof(*txF0));
memcpy(txF1, &qam_table16_1[qam16_table_offset], sizeof(*txF1));
x0p+=8;
qam16_table_offset=(((uint32_t)x0p[0])<<1)|(((uint32_t)x0p[2]))|
(((uint32_t)x0p[1])<<3)|(((uint32_t)x0p[3])<<2) |
(((uint32_t)x0p[4])<<5)|(((uint32_t)x0p[6])<<4) |
(((uint32_t)x0p[5])<<7)|(((uint32_t)x0p[7])<<6);
txF0[1]=qam_table16_0[qam16_table_offset];
txF1[1]=qam_table16_1[qam16_table_offset];
memcpy(txF0 + 1, &qam_table16_0[qam16_table_offset], sizeof(*txF0));
memcpy(txF1 + 1, &qam_table16_1[qam16_table_offset], sizeof(*txF1));
x0p+=8;
qam16_table_offset=(((uint32_t)x0p[0])<<1)|(((uint32_t)x0p[2]))|
@@ -857,8 +857,8 @@ int allocate_REs_in_RB_no_pilots_16QAM_tm2(PHY_VARS_eNB* phy_vars_eNB,
(((uint32_t)x0p[4])<<5)|(((uint32_t)x0p[6])<<4) |
(((uint32_t)x0p[5])<<7)|(((uint32_t)x0p[7])<<6);
txF0[2]=qam_table16_0[qam16_table_offset];
txF1[2]=qam_table16_1[qam16_table_offset];
memcpy(txF0 + 2, &qam_table16_0[qam16_table_offset], sizeof(*txF0));
memcpy(txF1 + 2, &qam_table16_1[qam16_table_offset], sizeof(*txF1));
if(skip_half==0) {
if (skip_dc>0) {
@@ -872,23 +872,23 @@ int allocate_REs_in_RB_no_pilots_16QAM_tm2(PHY_VARS_eNB* phy_vars_eNB,
(((uint32_t)x0p[4])<<5)|(((uint32_t)x0p[6])<<4) |
(((uint32_t)x0p[5])<<7)|(((uint32_t)x0p[7])<<6);
txF0[3]=qam_table16_0[qam16_table_offset];
txF1[3]=qam_table16_1[qam16_table_offset];
memcpy(txF0 + 3, &qam_table16_0[qam16_table_offset], sizeof(*txF0));
memcpy(txF1 + 3, &qam_table16_1[qam16_table_offset], sizeof(*txF1));
x0p+=8;
qam16_table_offset=(((uint32_t)x0p[0])<<1)|(((uint32_t)x0p[2]))|
(((uint32_t)x0p[1])<<3)|(((uint32_t)x0p[3])<<2) |
(((uint32_t)x0p[4])<<5)|(((uint32_t)x0p[6])<<4) |
(((uint32_t)x0p[5])<<7)|(((uint32_t)x0p[7])<<6);
txF0[4]=qam_table16_0[qam16_table_offset];
txF1[4]=qam_table16_1[qam16_table_offset];
memcpy(txF0 + 4, &qam_table16_0[qam16_table_offset], sizeof(*txF0));
memcpy(txF1 + 4, &qam_table16_1[qam16_table_offset], sizeof(*txF1));
x0p+=8;
qam16_table_offset=(((uint32_t)x0p[0])<<1)|(((uint32_t)x0p[2]))|
(((uint32_t)x0p[1])<<3)|(((uint32_t)x0p[3])<<2) |
(((uint32_t)x0p[4])<<5)|(((uint32_t)x0p[6])<<4) |
(((uint32_t)x0p[5])<<7)|(((uint32_t)x0p[7])<<6);
txF0[5]=qam_table16_0[qam16_table_offset];
txF1[5]=qam_table16_1[qam16_table_offset];
memcpy(txF0 + 5, &qam_table16_0[qam16_table_offset], sizeof(*txF0));
memcpy(txF1 + 5, &qam_table16_1[qam16_table_offset], sizeof(*txF1));
}
if(skip_half!=0)
{
@@ -4706,7 +4706,8 @@ unsigned short dlsch_extract_rbs_single(int **rxdataF,
}
if (rb_alloc_ind==1) {
*pmi_ext = (pmi>>((rb>>2)<<1))&3;
uint32_t tmp = (rb >> 2) << 1;
*pmi_ext = tmp >= 16 ? 0 : (pmi >> tmp) & 3;
memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int));
/*
@@ -146,7 +146,19 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb
PHY_MEASUREMENTS_gNB *measurements = &gNB->measurements;
int rb, nb_symb[275]={0};
memset(measurements->n0_subband_power, 0, sizeof(measurements->n0_subband_power));
allocCast2D(n0_subband_power,
unsigned int,
gNB->measurements.n0_subband_power,
frame_parms->nb_antennas_rx,
frame_parms->N_RB_UL,
false);
clearArray(gNB->measurements.n0_subband_power, unsigned int);
allocCast2D(n0_subband_power_dB,
unsigned int,
gNB->measurements.n0_subband_power_dB,
frame_parms->nb_antennas_rx,
frame_parms->N_RB_UL,
false);
for (int s=first_symb;s<(first_symb+num_symb);s++) {
int offset0 = ((slot&3)*frame_parms->symbols_per_slot + s) * frame_parms->ofdm_symbol_size;
@@ -166,7 +178,7 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb
} else {
signal_energy = signal_energy_nodc(ul_ch, 12);
}
measurements->n0_subband_power[aarx][rb] += signal_energy;
n0_subband_power[aarx][rb] += signal_energy;
LOG_D(PHY,"slot %d symbol %d RB %d aarx %d n0_subband_power %d\n", slot, s, rb, aarx, signal_energy);
} //antenna
}
@@ -182,10 +194,10 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb
int32_t n0_subband_tot_perPRB=0;
if (nb_symb[rb] > 0) {
for (int aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++) {
measurements->n0_subband_power[aarx][rb]/=nb_symb[rb];
measurements->n0_subband_power_dB[aarx][rb] = dB_fixed(measurements->n0_subband_power[aarx][rb]);
n0_subband_tot_perPRB+=measurements->n0_subband_power[aarx][rb];
n0_subband_tot_perANT[aarx]+=measurements->n0_subband_power[aarx][rb];
n0_subband_power[aarx][rb] /= nb_symb[rb];
n0_subband_power_dB[aarx][rb] = dB_fixed(n0_subband_power[aarx][rb]);
n0_subband_tot_perPRB += n0_subband_power[aarx][rb];
n0_subband_tot_perANT[aarx] += n0_subband_power[aarx][rb];
}
n0_subband_tot_perPRB/=frame_parms->nb_antennas_rx;
measurements->n0_subband_power_tot_dB[rb] = dB_fixed(n0_subband_tot_perPRB);
@@ -218,30 +230,31 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB,
unsigned short rx_power_avg_dB;
unsigned short rx_power_tot_dB;
double rx_gain = openair0_cfg[0].rx_gain[0];
double rx_gain_offset = openair0_cfg[0].rx_gain_offset[0];
double rx_gain = openair0_cfg[0].rx_gain[0];
double rx_gain_offset = openair0_cfg[0].rx_gain_offset[0];
PHY_MEASUREMENTS_gNB *meas = &gNB->measurements;
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
int ch_offset = fp->ofdm_symbol_size * symbol;
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
int ch_offset = fp->ofdm_symbol_size * symbol;
int N_RB_UL = ulsch->harq_process->ulsch_pdu.rb_size;
ulsch_measurements_gNB *ulsch_measurements = &ulsch->ulsch_measurements;
int rx_power[fp->nb_antennas_rx];
allocCast2D(rx_spatial_power, int, ulsch_measurements->rx_spatial_power, nrOfLayers, fp->nb_antennas_rx, true);
allocCast2D(rx_spatial_power_dB, unsigned short, ulsch_measurements->rx_spatial_power_dB, nrOfLayers, fp->nb_antennas_rx, true);
for (int aarx = 0; aarx < fp->nb_antennas_rx; aarx++){
rx_power[aarx] = 0;
for (int aatx = 0; aatx < nrOfLayers; aatx++){
ulsch_measurements->rx_spatial_power[aatx][aarx] =
rx_spatial_power[aatx][aarx] =
(signal_energy_nodc(&pusch_vars->ul_ch_estimates[aatx * fp->nb_antennas_rx + aarx][ch_offset],
N_RB_UL * NR_NB_SC_PER_RB));
if (ulsch_measurements->rx_spatial_power[aatx][aarx] < 0) {
ulsch_measurements->rx_spatial_power[aatx][aarx] = 0;
if (rx_spatial_power[aatx][aarx] < 0) {
rx_spatial_power[aatx][aarx] = 0;
}
ulsch_measurements->rx_spatial_power_dB[aatx][aarx] =
(unsigned short)dB_fixed(ulsch_measurements->rx_spatial_power[aatx][aarx]);
rx_power[aarx] += ulsch_measurements->rx_spatial_power[aatx][aarx];
rx_spatial_power_dB[aatx][aarx] = (unsigned short)dB_fixed(rx_spatial_power[aatx][aarx]);
rx_power[aarx] += rx_spatial_power[aatx][aarx];
}
LOG_D(PHY, "[RNTI %04x] RX power in antenna %d = %d\n", ulsch->rnti, aarx, rx_power[aarx]);
+5 -1
View File
@@ -72,7 +72,11 @@ void nr_chest_time_domain_avg(NR_DL_FRAME_PARMS *frame_parms,
uint16_t dmrs_bitmap,
uint16_t num_rbs);
static inline uint8_t is_dmrs_symbol(uint8_t l, uint16_t dmrsSymbMask ) { return ((dmrsSymbMask >> l) & 0x1); }
static inline uint8_t is_dmrs_symbol(uint8_t l, uint16_t dmrsSymbMask)
{
DevAssert(l < 32);
return ((dmrsSymbMask >> l) & 0x1);
}
#undef EXTERN
#endif /* DMRS_NR_H */
+4 -7
View File
@@ -373,7 +373,7 @@ int8_t nr_ptrs_process_slot(uint16_t dmrsSymbPos,
}
/* check for left side first */
/* right side a DMRS symbol then we need to left extrapolate */
if(is_dmrs_symbol(rightRef,dmrsSymbPos)) {
if (rightRef != -1 && is_dmrs_symbol(rightRef, dmrsSymbPos)) {
/* calculate slope from next valid estimates*/
tmp = get_next_estimate_in_slot(ptrsSymbPos,dmrsSymbPos,rightRef+1,symbInSlot);
/* Special case when DMRS is not followed by PTRS symbol then reuse old slope */
@@ -382,22 +382,19 @@ int8_t nr_ptrs_process_slot(uint16_t dmrsSymbPos,
}
ptrs_estimate_from_slope(estPerSymb,slope_p,leftRef, rightRef);
symb = rightRef -1;
}
else if(is_ptrs_symbol(rightRef,ptrsSymbPos)) {
} else if (rightRef != -1 && is_ptrs_symbol(rightRef, ptrsSymbPos)) {
/* calculate slope from next valid estimates */
get_slope_from_estimates(leftRef,rightRef,estPerSymb, slope_p);
ptrs_estimate_from_slope(estPerSymb,slope_p,leftRef, rightRef);
symb = rightRef -1;
}
else if((rightRef ==-1) && (symb <symbInSlot)) {
} else if ((rightRef == -1) && (symb < symbInSlot)) {
// in right extrapolation use the last slope
#ifdef DEBUG_PTRS
printf("[PHY][PTRS]: Last Slop Reused :(%4f %4f)\n", slope_p[0],slope_p[1]);
#endif
ptrs_estimate_from_slope(estPerSymb,slope_p,symb-1,symbInSlot);
symb = symbInSlot;
}
else {
} else {
printf("Wrong PTRS Setup, PTRS compensation will be skipped !");
return -1;
}
+50 -25
View File
@@ -404,43 +404,68 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
}
}
else {
__m64 *txF=(__m64*)&txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size+start_sc)<<1)];
__m128i *txF = (__m128i *)&txdataF_precoding[nl][((l * frame_parms->ofdm_symbol_size + start_sc) << 1)];
__m64 *txl = (__m64*)&tx_layers[nl][m<<1];
__m64 amp64=_mm_set1_pi16(amp);
for (int i=0; i<(upper_limit>>1); i++) {
txF[i] = _mm_mulhrs_pi16(amp64,txl[i]);
__m128i *txl = (__m128i *)&tx_layers[nl][m << 1];
__m128i amp64 = _mm_set1_epi16(amp);
int i;
for (i = 0; i < (upper_limit >> 2); i++) {
const __m128i txL = _mm_loadu_si128(txl + i);
_mm_storeu_si128(txF + i, _mm_mulhrs_epi16(amp64, txL));
#ifdef DEBUG_DLSCH_MAPPING
if ((i&1) > 0)
printf("m %d\t l %d \t k %d \t txdataF: %d %d\n",
m, l, start_sc+(i>>1), txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + start_sc+(i>>1))<<1)],
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + start_sc+(i>>1))<<1) + 1]);
printf("m %d\t l %d \t k %d \t txdataF: %d %d\n",
m,
l,
start_sc + (i >> 1),
txdataF_precoding[nl][((l * frame_parms->ofdm_symbol_size + start_sc + (i >> 1)) << 1)],
txdataF_precoding[nl][((l * frame_parms->ofdm_symbol_size + start_sc + (i >> 1)) << 1) + 1]);
#endif
/* handle this, mute RE */
/*else {
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = 0;
txdataF_precoding[anl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = 0;
}*/
} //RE loop, first part
}*/
}
if (i * 4 != upper_limit) {
c16_t *txFc = (c16_t *)&txdataF_precoding[nl][((l * frame_parms->ofdm_symbol_size + start_sc) << 1)];
c16_t *txlc = (c16_t *)&tx_layers[nl][m << 1];
for (i = (upper_limit >> 2) << 2; i < upper_limit; i++) {
txFc[i].r = ((txlc[i].r * amp) >> 14) + 1;
txFc[i].i = ((txlc[i].i * amp) >> 14) + 1;
}
}
m+=upper_limit;
if (remaining_re > 0) {
txF = (__m64*)&txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size)<<1)];
txl = (__m64*)&tx_layers[nl][m<<1];
for (int i=0; i<(remaining_re>>1); i++) {
txF[i] = _mm_mulhrs_pi16(amp64,txl[i]);
txF = (__m128i *)&txdataF_precoding[nl][((l * frame_parms->ofdm_symbol_size) << 1)];
txl = (__m128i *)&tx_layers[nl][m << 1];
int i;
for (i = 0; i < (remaining_re >> 2); i++) {
const __m128i txL = _mm_loadu_si128(txl + i);
_mm_storeu_si128(txF + i, _mm_mulhrs_epi16(amp64, txL));
#ifdef DEBUG_DLSCH_MAPPING
if ((i&1) > 0)
printf("m %d\t l %d \t k %d \t txdataF: %d %d\n",
m, l, i>>1, txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + (i>>1))<<1) ],
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + (i>>1))<<1) + 1]);
if ((i & 1) > 0)
printf("m %d\t l %d \t k %d \t txdataF: %d %d\n",
m,
l,
i >> 1,
txdataF_precoding[nl][((l * frame_parms->ofdm_symbol_size + (i >> 1)) << 1)],
txdataF_precoding[nl][((l * frame_parms->ofdm_symbol_size + (i >> 1)) << 1) + 1]);
#endif
/* handle this, mute RE */
/*else {
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = 0;
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = 0;
}*/
} //RE loop, second part
/* handle this, mute RE */
/*else {
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = 0;
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = 0;
}*/
} // RE loop, second part
if (i * 4 != remaining_re) {
c16_t *txFc = (c16_t *)&txdataF_precoding[nl][((l * frame_parms->ofdm_symbol_size) << 1)];
c16_t *txlc = (c16_t *)&tx_layers[nl][m << 1];
for (i = (remaining_re >> 2) << 2; i < remaining_re; i++) {
txFc[i].r = ((txlc[i].r * amp) >> 14) + 1;
txFc[i].i = ((txlc[i].i * amp) >> 14) + 1;
}
}
} //
m+=remaining_re;
} // N_RB_DL even
+1 -2
View File
@@ -88,8 +88,7 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB, int frame, int slot, nfapi_nr_pusch_pdu_t
harq->round++;
memcpy(&ulsch->harq_process->ulsch_pdu, ulsch_pdu, sizeof(ulsch->harq_process->ulsch_pdu));
LOG_D(PHY, "Initializing nFAPI for ULSCH, harq_pid %d\n", harq_pid);
LOG_D(PHY, "Initializing nFAPI for ULSCH, harq_pid %d, layers %d\n", harq_pid, ulsch_pdu->nrOfLayers);
}
void reset_active_ulsch(PHY_VARS_gNB *gNB, int frame)
@@ -93,7 +93,7 @@ NR_gNB_ULSCH_t new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL)
}
uint32_t ulsch_bytes = a_segments * 1056; // allocated bytes per segment
NR_gNB_ULSCH_t ulsch;
NR_gNB_ULSCH_t ulsch = {0};
ulsch.max_ldpc_iterations = max_ldpc_iterations;
ulsch.harq_pid = -1;
@@ -1905,7 +1905,12 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
}
nr_gnb_measurements(gNB, ulsch, pusch_vars, symbol, rel15_ul->nrOfLayers);
allocCast2D(n0_subband_power,
unsigned int,
gNB->measurements.n0_subband_power,
frame_parms->nb_antennas_rx,
frame_parms->N_RB_UL,
false);
for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) {
if (symbol == rel15_ul->start_symbol_index) {
pusch_vars->ulsch_power[aarx] = 0;
@@ -1918,7 +1923,7 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
}
for (int rb = 0; rb < rel15_ul->rb_size; rb++) {
pusch_vars->ulsch_noise_power[aarx] +=
gNB->measurements.n0_subband_power[aarx][rel15_ul->bwp_start + rel15_ul->rb_start + rb] / rel15_ul->rb_size;
n0_subband_power[aarx][rel15_ul->bwp_start + rel15_ul->rb_start + rb] / rel15_ul->rb_size;
}
LOG_D(PHY,
"aa %d, bwp_start%d, rb_start %d, rb_size %d: ulsch_power %d, ulsch_noise_power %d\n",
+1 -1
View File
@@ -1774,7 +1774,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
}
bit_left = pucch_pdu->bit_len_csi_part1-((csi_part1_bytes-1)<<3);
uci_pdu->csi_part1.csi_part1_payload[i] = decodedPayload[0] & ((1<<bit_left)-1);
decodedPayload[0] >>= pucch_pdu->bit_len_csi_part1;
decodedPayload[0] = pucch_pdu->bit_len_csi_part1 < 64 ? decodedPayload[0] >> pucch_pdu->bit_len_csi_part1 : 0;
}
if (pucch_pdu->bit_len_csi_part2>0) {
@@ -88,6 +88,21 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue,
ue->measurements.nb_antennas_rx = frame_parms->nb_antennas_rx;
allocCast3D(rx_spatial_power,
int,
ue->measurements.rx_spatial_power,
NUMBER_OF_CONNECTED_gNB_MAX,
frame_parms->nb_antenna_ports_gNB,
frame_parms->nb_antennas_rx,
false);
allocCast3D(rx_spatial_power_dB,
unsigned short,
ue->measurements.rx_spatial_power_dB,
NUMBER_OF_CONNECTED_gNB_MAX,
frame_parms->nb_antenna_ports_gNB,
frame_parms->nb_antennas_rx,
false);
// signal measurements
for (gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++){
@@ -98,15 +113,14 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue,
ue->measurements.rx_power[gNB_id][aarx] = 0;
for (aatx = 0; aatx < frame_parms->nb_antenna_ports_gNB; aatx++){
const int z=signal_energy_nodc(&dl_ch_estimates[gNB_id][ch_offset], N_RB_DL * NR_NB_SC_PER_RB);
rx_spatial_power[gNB_id][aatx][aarx] = z;
ue->measurements.rx_spatial_power[gNB_id][aatx][aarx] = (signal_energy_nodc(&dl_ch_estimates[gNB_id][ch_offset], N_RB_DL*NR_NB_SC_PER_RB));
if (ue->measurements.rx_spatial_power[gNB_id][aatx][aarx]<0)
ue->measurements.rx_spatial_power[gNB_id][aatx][aarx] = 0;
ue->measurements.rx_spatial_power_dB[gNB_id][aatx][aarx] = (unsigned short) dB_fixed(ue->measurements.rx_spatial_power[gNB_id][aatx][aarx]);
ue->measurements.rx_power[gNB_id][aarx] += ue->measurements.rx_spatial_power[gNB_id][aatx][aarx];
if (rx_spatial_power[gNB_id][aatx][aarx] < 0)
rx_spatial_power[gNB_id][aatx][aarx] = 0;
rx_spatial_power_dB[gNB_id][aatx][aarx] = (unsigned short)dB_fixed(rx_spatial_power[gNB_id][aatx][aarx]);
ue->measurements.rx_power[gNB_id][aarx] += rx_spatial_power[gNB_id][aatx][aarx];
}
ue->measurements.rx_power_dB[gNB_id][aarx] = (unsigned short) dB_fixed(ue->measurements.rx_power[gNB_id][aarx]);
@@ -403,7 +403,7 @@ int generate_srs_nr(nfapi_nr_srs_pdu_t *srs_config_pdu,
LOG_I(NR_PHY,"(%d) \t%i\t%i\n", subcarrier_log, (int16_t)(r_real_amp&0xFFFF), (int16_t)(r_imag_amp&0xFFFF));
#endif
txdataF[p_index][symbol_offset+l_line_offset+subcarrier] = (r_real_amp & 0xFFFF) + ((r_imag_amp<<16)&0xFFFF0000);
*(c16_t *)&txdataF[p_index][symbol_offset + l_line_offset + subcarrier] = (c16_t){r_real_amp, r_imag_amp};
// Subcarrier increment
subcarrier += K_TC;
+74
View File
@@ -34,6 +34,7 @@
#include <assert.h>
#include "PHY/sse_intrin.h"
#include "common/utils/assertions.h"
#include "common/utils/utils.h"
#if defined(__x86_64__) || defined(__i386__)
#define simd_q15_t __m128i
@@ -94,6 +95,79 @@ extern "C" {
int64_t i;
} c64_t;
typedef struct {
int dim1;
int dim2;
int dim3;
int dim4;
uint8_t data[];
} fourDimArray_t;
static inline fourDimArray_t *allocateFourDimArray(int elmtSz, int dim1, int dim2, int dim3, int dim4)
{
int sz = elmtSz;
DevAssert(dim1 > 0);
sz *= dim1;
if (dim2) {
sz *= dim2;
if (dim3) {
sz *= dim3;
if (dim4)
sz *= dim4;
}
}
fourDimArray_t *tmp = (fourDimArray_t *)malloc16_clear(sizeof(*tmp) + sz);
AssertFatal(tmp, "no more memory\n");
*tmp = (fourDimArray_t){dim1, dim2, dim3, dim4};
return tmp;
}
#define CheckArrAllocated(workingVar, elementType, ArraY, diM1, diM2, diM3, diM4, resizeAllowed) \
if (!(ArraY)) \
ArraY = allocateFourDimArray(sizeof(elementType), diM1, diM2, diM3, diM4); \
else { \
if ((resizeAllowed) \
&& ((diM1) != (ArraY)->dim1 || (diM2) != (ArraY)->dim2 || (diM3) != (ArraY)->dim3 || (diM4) != (ArraY)->dim4)) { \
LOG_I(PHY, "resizing %s to %d/%d/%d/%d\n", #ArraY, (diM1), (diM2), (diM3), (diM4)); \
free(ArraY); \
ArraY = allocateFourDimArray(sizeof(elementType), diM1, diM2, diM3, diM4); \
} else \
DevAssert((diM1) == (ArraY)->dim1 && (diM2) == (ArraY)->dim2 && (diM3) == (ArraY)->dim3 && (diM4) == (ArraY)->dim4); \
}
#define cast1Darray(workingVar, elementType, ArraY) elementType *workingVar = (elementType *)((ArraY)->data);
#define allocCast1D(workingVar, elementType, ArraY, dim1, resizeAllowed) \
CheckArrAllocated(workingVar, elementType, ArraY, dim1, 0, 0, 0, resizeAllowed); \
cast1Darray(workingVar, elementType, ArraY);
#define cast2Darray(workingVar, elementType, ArraY) \
elementType(*workingVar)[(ArraY)->dim2] = (elementType(*)[(ArraY)->dim2])((ArraY)->data);
#define allocCast2D(workingVar, elementType, ArraY, dim1, dim2, resizeAllowed) \
CheckArrAllocated(workingVar, elementType, ArraY, dim1, dim2, 0, 0, resizeAllowed); \
cast2Darray(workingVar, elementType, ArraY);
#define cast3Darray(workingVar, elementType, ArraY) \
elementType(*workingVar)[(ArraY)->dim2][(ArraY)->dim3] = (elementType(*)[(ArraY)->dim2][(ArraY)->dim3])((ArraY)->data);
#define allocCast3D(workingVar, elementType, ArraY, dim1, dim2, dim3, resizeAllowed) \
CheckArrAllocated(workingVar, elementType, ArraY, dim1, dim2, dim3, 0, resizeAllowed); \
cast3Darray(workingVar, elementType, ArraY);
#define cast4Darray(workingVar, elementType, ArraY) \
elementType(*workingVar)[(ArraY)->dim2][(ArraY)->dim3][(ArraY)->dim4] = \
(elementType(*)[(ArraY)->dim2][(ArraY)->dim3][(ArraY)->dim4])((ArraY)->data);
#define allocCast4D(workingVar, elementType, ArraY, dim1, dim2, dim3, dim4, resizeAllowed) \
CheckArrAllocated(workingVar, elementType, ArraY, dim1, dim2, dim3, dim4, resizeAllowed); \
cast4Darray(workingVar, elementType, ArraY);
#define clearArray(ArraY, elementType) \
memset((ArraY)->data, \
0, \
sizeof(elementType) * (ArraY)->dim1 * max((ArraY)->dim2, 1) * max((ArraY)->dim3, 1) * max((ArraY)->dim4, 1))
#define squaredMod(a) ((a).r*(a).r + (a).i*(a).i)
#define csum(res, i1, i2) (res).r = (i1).r + (i2).r ; (res).i = (i1).i + (i2).i
+6 -7
View File
@@ -103,8 +103,8 @@ typedef struct {
int total_bytes_rx;
int current_Qm;
int current_RI;
int power[NB_ANTENNAS_RX];
int noise_power[NB_ANTENNAS_RX];
int power[MAX_ANT];
int noise_power[MAX_ANT];
int DTX;
int sync_pos;
} NR_gNB_SCH_STATS_t;
@@ -229,9 +229,9 @@ typedef struct {
typedef struct {
//! estimated received spatial signal power (linear)
unsigned int rx_spatial_power[NB_ANTENNAS_TX][NB_ANTENNAS_RX];
fourDimArray_t * rx_spatial_power;
//! estimated received spatial signal power (dB)
unsigned int rx_spatial_power_dB[NB_ANTENNAS_TX][NB_ANTENNAS_RX];
fourDimArray_t * rx_spatial_power_dB;
//! estimated rssi (dBm)
int rx_rssi_dBm;
//! estimated correlation (wideband linear) between spatial channels (computed in dlsch_demodulation)
@@ -546,9 +546,9 @@ typedef struct {
//! estimated avg noise power (dB)
unsigned int n0_power_tot_dB;
//! estimated avg noise power per RB per RX ant (lin)
unsigned int n0_subband_power[NB_ANTENNAS_RX][275];
fourDimArray_t *n0_subband_power;
//! estimated avg noise power per RB per RX ant (dB)
unsigned int n0_subband_power_dB[NB_ANTENNAS_RX][275];
fourDimArray_t *n0_subband_power_dB;
//! estimated avg subband noise power (dB)
unsigned int n0_subband_power_avg_dB;
//! estimated avg subband noise power per antenna (dB)
@@ -557,7 +557,6 @@ typedef struct {
int n0_subband_power_tot_dB[275];
//! estimated avg noise power per RB (dBm)
int n0_subband_power_tot_dBm[275];
/// PRACH background noise level
int prach_I0;
+2 -2
View File
@@ -151,9 +151,9 @@ typedef struct {
// UE measurements
//! estimated received spatial signal power (linear)
int rx_spatial_power[NUMBER_OF_CONNECTED_gNB_MAX][2][2];
fourDimArray_t *rx_spatial_power;
//! estimated received spatial signal power (dB)
unsigned short rx_spatial_power_dB[NUMBER_OF_CONNECTED_gNB_MAX][2][2];
fourDimArray_t *rx_spatial_power_dB;
/// estimated received signal power (sum over all TX antennas)
int rx_power[NUMBER_OF_CONNECTED_gNB_MAX][NB_ANTENNAS_RX];
+1 -1
View File
@@ -1360,7 +1360,7 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
rb<=ulsch_harq->nb_rb;
rb++) {
int rb2 = rb+ulsch_harq->first_rb;
eNB->rb_mask_ul[rb2>>5] |= (1<<(rb2&31));
eNB->rb_mask_ul[rb2>>5] |= (1L<<(rb2&31));
}
LOG_D(PHY,"[eNB %d] frame %d, subframe %d: Scheduling ULSCH Reception for UE %d \n", eNB->Mod_id, frame, subframe, i);
+2 -1
View File
@@ -631,7 +631,8 @@ void fill_ul_rb_mask(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
nfapi_nr_srs_pdu_t *srs_pdu = &srs->srs_pdu;
for(int symbol = 0; symbol<(1<<srs_pdu->num_symbols); symbol++) {
for(rb = srs_pdu->bwp_start; rb < (srs_pdu->bwp_start+srs_pdu->bwp_size); rb++) {
gNB->rb_mask_ul[gNB->frame_parms.symbols_per_slot-srs_pdu->time_start_position-1+symbol][rb>>5] |= 1<<(rb&31);
gNB->rb_mask_ul[gNB->frame_parms.symbols_per_slot - srs_pdu->time_start_position - 1 + symbol][rb >> 5] |= 1U
<< (rb & 31);
}
}
}
+126 -80
View File
@@ -341,9 +341,6 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
int slot = scheduled_response->slot;
// Note: we have to handle the thread IDs for this. To be revisited completely.
NR_UE_DLSCH_t *dlsch0 = &((nr_phy_data_t *)scheduled_response->phy_data)->dlsch[0];
NR_UE_ULSCH_t *ulsch = &((nr_phy_data_tx_t *)scheduled_response->phy_data)->ulsch;
NR_UE_PUCCH *pucch_vars = &((nr_phy_data_tx_t *)scheduled_response->phy_data)->pucch_vars;
NR_UE_CSI_IM *csiim_vars = PHY_vars_UE_g[module_id][cc_id]->csiim_vars[0];
NR_UE_CSI_RS *csirs_vars = PHY_vars_UE_g[module_id][cc_id]->csirs_vars[0];
NR_UE_PDCCH_CONFIG *phy_pdcch_config = NULL;
@@ -384,27 +381,30 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
memcpy((void*)&(csirs_vars->csirs_config_pdu), (void*)csirs_config_pdu, sizeof(fapi_nr_dl_config_csirs_pdu_rel15_t));
csirs_vars->active = true;
break;
case FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH:
case FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH: {
dlsch_config_pdu = &dl_config->dl_config_list[i].dlsch_config_pdu.dlsch_config_rel15;
NR_UE_DLSCH_t *dlsch0 = &((nr_phy_data_t *)scheduled_response->phy_data)->dlsch[0];
dlsch0->rnti_type = _RA_RNTI_;
dlsch0->dlsch_config = *dlsch_config_pdu;
configure_dlsch(dlsch0, PHY_vars_UE_g[module_id][cc_id]->dl_harq_processes[0], dlsch_config_pdu, module_id,
dl_config->dl_config_list[i].dlsch_config_pdu.rnti);
break;
case FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH:
} break;
case FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH: {
dlsch_config_pdu = &dl_config->dl_config_list[i].dlsch_config_pdu.dlsch_config_rel15;
NR_UE_DLSCH_t *dlsch0 = &((nr_phy_data_t *)scheduled_response->phy_data)->dlsch[0];
dlsch0->rnti_type = _SI_RNTI_;
dlsch0->dlsch_config = *dlsch_config_pdu;
configure_dlsch(dlsch0, PHY_vars_UE_g[module_id][cc_id]->dl_harq_processes[0], dlsch_config_pdu, module_id,
dl_config->dl_config_list[i].dlsch_config_pdu.rnti);
break;
case FAPI_NR_DL_CONFIG_TYPE_DLSCH:
} break;
case FAPI_NR_DL_CONFIG_TYPE_DLSCH: {
dlsch_config_pdu = &dl_config->dl_config_list[i].dlsch_config_pdu.dlsch_config_rel15;
NR_UE_DLSCH_t *dlsch0 = &((nr_phy_data_t *)scheduled_response->phy_data)->dlsch[0];
dlsch0->rnti_type = _C_RNTI_;
dlsch0->dlsch_config = *dlsch_config_pdu;
configure_dlsch(dlsch0, PHY_vars_UE_g[module_id][cc_id]->dl_harq_processes[0], dlsch_config_pdu, module_id,
dl_config->dl_config_list[i].dlsch_config_pdu.rnti);
break;
} break;
}
}
dl_config->number_pdus = 0;
@@ -435,90 +435,136 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
fapi_nr_ul_config_srs_pdu *srs_config_pdu;
switch (pdu_type){
case FAPI_NR_UL_CONFIG_TYPE_PUSCH: {
// pusch config pdu
pusch_config_pdu = &ul_config->ul_config_list[i].pusch_config_pdu;
current_harq_pid = pusch_config_pdu->pusch_data.harq_process_id;
NR_UL_UE_HARQ_t *harq_process_ul_ue = &PHY_vars_UE_g[module_id][cc_id]->ul_harq_processes[current_harq_pid];
NR_UE_ULSCH_t *ulsch = &((nr_phy_data_tx_t *)scheduled_response->phy_data)->ulsch;
nfapi_nr_ue_pusch_pdu_t *pusch_pdu = &ulsch->pusch_pdu;
case (FAPI_NR_UL_CONFIG_TYPE_PUSCH):
// pusch config pdu
pusch_config_pdu = &ul_config->ul_config_list[i].pusch_config_pdu;
current_harq_pid = pusch_config_pdu->pusch_data.harq_process_id;
NR_UL_UE_HARQ_t *harq_process_ul_ue = &PHY_vars_UE_g[module_id][cc_id]->ul_harq_processes[current_harq_pid];
LOG_D(PHY,
"In %s i %d: copy pusch_config_pdu nrOfLayers:%d, num_dmrs_cdm_grps_no_data:%d \n",
__FUNCTION__,
i,
pusch_config_pdu->nrOfLayers,
pusch_config_pdu->num_dmrs_cdm_grps_no_data);
nfapi_nr_ue_pusch_pdu_t *pusch_pdu = &ulsch->pusch_pdu;
memcpy(pusch_pdu, pusch_config_pdu, sizeof(nfapi_nr_ue_pusch_pdu_t));
if (scheduled_response->tx_request) {
for (int j = 0; j < scheduled_response->tx_request->number_of_pdus; j++) {
fapi_nr_tx_request_body_t *tx_req_body = &scheduled_response->tx_request->tx_request_body[j];
if ((tx_req_body->pdu_index == i) && (tx_req_body->pdu_length > 0)) {
LOG_D(PHY,
"%d.%d Copying %d bytes to harq_process_ul_ue->a (harq_pid %d)\n",
scheduled_response->frame,
slot,
tx_req_body->pdu_length,
current_harq_pid);
memcpy(harq_process_ul_ue->a, tx_req_body->pdu, tx_req_body->pdu_length);
break;
}
}
LOG_D(PHY, "In %s i %d: copy pusch_config_pdu nrOfLayers:%d, num_dmrs_cdm_grps_no_data:%d \n", __FUNCTION__, i, pusch_config_pdu->nrOfLayers,pusch_config_pdu->num_dmrs_cdm_grps_no_data);
harq_process_ul_ue->status = ACTIVE;
ul_config->ul_config_list[i].pdu_type = FAPI_NR_UL_CONFIG_TYPE_DONE; // not handle it any more
pdu_done++;
LOG_D(PHY,
"%d.%d ul A ul_config %p t %d pdu_done %d number_pdus %d\n",
scheduled_response->frame,
slot,
ul_config,
pdu_type,
pdu_done,
ul_config->number_pdus);
memcpy(pusch_pdu, pusch_config_pdu, sizeof(nfapi_nr_ue_pusch_pdu_t));
if (scheduled_response->tx_request) {
for (int j=0; j<scheduled_response->tx_request->number_of_pdus; j++) {
fapi_nr_tx_request_body_t *tx_req_body = &scheduled_response->tx_request->tx_request_body[j];
if ((tx_req_body->pdu_index == i) && (tx_req_body->pdu_length > 0)) {
LOG_D(PHY,"%d.%d Copying %d bytes to harq_process_ul_ue->a (harq_pid %d)\n",scheduled_response->frame,slot,tx_req_body->pdu_length,current_harq_pid);
memcpy(harq_process_ul_ue->a, tx_req_body->pdu, tx_req_body->pdu_length);
} else {
LOG_E(PHY, "[phy_procedures_nrUE_TX] harq_process_ul_ue is NULL !!\n");
return -1;
}
} break;
case FAPI_NR_UL_CONFIG_TYPE_PUCCH: {
NR_UE_PUCCH *pucch_vars = &((nr_phy_data_tx_t *)scheduled_response->phy_data)->pucch_vars;
found = false;
pucch_config_pdu = &ul_config->ul_config_list[i].pucch_config_pdu;
for (int j = 0; j < 2; j++) {
if (pucch_vars->active[j] == false) {
LOG_D(PHY, "%d.%d Copying pucch pdu to UE PHY\n", scheduled_response->frame, slot);
memcpy((void *)&(pucch_vars->pucch_pdu[j]), (void *)pucch_config_pdu, sizeof(fapi_nr_ul_config_pucch_pdu));
pucch_vars->active[j] = true;
found = true;
ul_config->ul_config_list[i].pdu_type = FAPI_NR_UL_CONFIG_TYPE_DONE; // not handle it any more
pdu_done++;
LOG_D(PHY,
"%d.%d ul A ul_config %p t %d pdu_done %d number_pdus %d\n",
scheduled_response->frame,
slot,
ul_config,
pdu_type,
pdu_done,
ul_config->number_pdus);
break;
}
}
if (!found)
LOG_E(PHY, "Couldn't find allocation for PUCCH PDU in PUCCH VARS\n");
} break;
harq_process_ul_ue->status = ACTIVE;
case FAPI_NR_UL_CONFIG_TYPE_PRACH:
// prach config pdu
prach_config_pdu = &ul_config->ul_config_list[i].prach_config_pdu;
memcpy((void *)&(PHY_vars_UE_g[module_id][cc_id]->prach_vars[gNB_id]->prach_pdu),
(void *)prach_config_pdu,
sizeof(fapi_nr_ul_config_prach_pdu));
PHY_vars_UE_g[module_id][cc_id]->prach_vars[gNB_id]->active = true;
ul_config->ul_config_list[i].pdu_type = FAPI_NR_UL_CONFIG_TYPE_DONE; // not handle it any more
pdu_done++;
LOG_D(PHY, "%d.%d ul A ul_config %p t %d pdu_done %d number_pdus %d\n", scheduled_response->frame, slot, ul_config, pdu_type, pdu_done, ul_config->number_pdus);
LOG_D(PHY,
"%d.%d ul A ul_config %p t %d pdu_done %d number_pdus %d\n",
scheduled_response->frame,
slot,
ul_config,
pdu_type,
pdu_done,
ul_config->number_pdus);
break;
} else {
case FAPI_NR_UL_CONFIG_TYPE_DONE:
pdu_done++; // count the no of pdu processed
LOG_D(PHY,
"%d.%d ul A ul_config %p t %d pdu_done %d number_pdus %d\n",
scheduled_response->frame,
slot,
ul_config,
pdu_type,
pdu_done,
ul_config->number_pdus);
break;
LOG_E(PHY, "[phy_procedures_nrUE_TX] harq_process_ul_ue is NULL !!\n");
return -1;
case FAPI_NR_UL_CONFIG_TYPE_SRS:
// srs config pdu
srs_config_pdu = &ul_config->ul_config_list[i].srs_config_pdu;
memcpy((void *)&(PHY_vars_UE_g[module_id][cc_id]->srs_vars[gNB_id]->srs_config_pdu),
(void *)srs_config_pdu,
sizeof(fapi_nr_ul_config_srs_pdu));
PHY_vars_UE_g[module_id][cc_id]->srs_vars[gNB_id]->active = true;
ul_config->ul_config_list[i].pdu_type = FAPI_NR_UL_CONFIG_TYPE_DONE; // not handle it any more
pdu_done++;
break;
}
break;
case (FAPI_NR_UL_CONFIG_TYPE_PUCCH):
found = false;
pucch_config_pdu = &ul_config->ul_config_list[i].pucch_config_pdu;
for(int j=0; j<2; j++) {
if(pucch_vars->active[j] == false) {
LOG_D(PHY,"%d.%d Copying pucch pdu to UE PHY\n",scheduled_response->frame,slot);
memcpy((void*)&(pucch_vars->pucch_pdu[j]), (void*)pucch_config_pdu, sizeof(fapi_nr_ul_config_pucch_pdu));
pucch_vars->active[j] = true;
found = true;
ul_config->ul_config_list[i].pdu_type = FAPI_NR_UL_CONFIG_TYPE_DONE; // not handle it any more
pdu_done++;
LOG_D(PHY, "%d.%d ul A ul_config %p t %d pdu_done %d number_pdus %d\n", scheduled_response->frame, slot, ul_config, pdu_type, pdu_done, ul_config->number_pdus);
break;
}
}
if (!found)
LOG_E(PHY, "Couldn't find allocation for PUCCH PDU in PUCCH VARS\n");
break;
case (FAPI_NR_UL_CONFIG_TYPE_PRACH):
// prach config pdu
prach_config_pdu = &ul_config->ul_config_list[i].prach_config_pdu;
memcpy((void*)&(PHY_vars_UE_g[module_id][cc_id]->prach_vars[gNB_id]->prach_pdu), (void*)prach_config_pdu, sizeof(fapi_nr_ul_config_prach_pdu));
PHY_vars_UE_g[module_id][cc_id]->prach_vars[gNB_id]->active = true;
ul_config->ul_config_list[i].pdu_type = FAPI_NR_UL_CONFIG_TYPE_DONE; // not handle it any more
pdu_done++;
LOG_D(PHY, "%d.%d ul A ul_config %p t %d pdu_done %d number_pdus %d\n", scheduled_response->frame, slot, ul_config, pdu_type, pdu_done, ul_config->number_pdus);
break;
case (FAPI_NR_UL_CONFIG_TYPE_DONE):
pdu_done++; // count the no of pdu processed
LOG_D(PHY, "%d.%d ul A ul_config %p t %d pdu_done %d number_pdus %d\n", scheduled_response->frame, slot, ul_config, pdu_type, pdu_done, ul_config->number_pdus);
break;
case (FAPI_NR_UL_CONFIG_TYPE_SRS):
// srs config pdu
srs_config_pdu = &ul_config->ul_config_list[i].srs_config_pdu;
memcpy((void*)&(PHY_vars_UE_g[module_id][cc_id]->srs_vars[gNB_id]->srs_config_pdu), (void*)srs_config_pdu, sizeof(fapi_nr_ul_config_srs_pdu));
PHY_vars_UE_g[module_id][cc_id]->srs_vars[gNB_id]->active = true;
ul_config->ul_config_list[i].pdu_type = FAPI_NR_UL_CONFIG_TYPE_DONE; // not handle it any more
pdu_done++;
break;
default:
ul_config->ul_config_list[i].pdu_type = FAPI_NR_UL_CONFIG_TYPE_DONE; // not handle it any more
pdu_done++; // count the no of pdu processed
LOG_D(PHY, "%d.%d ul A ul_config %p t %d pdu_done %d number_pdus %d\n", scheduled_response->frame, slot, ul_config, pdu_type, pdu_done, ul_config->number_pdus);
break;
default:
ul_config->ul_config_list[i].pdu_type = FAPI_NR_UL_CONFIG_TYPE_DONE; // not handle it any more
pdu_done++; // count the no of pdu processed
LOG_D(PHY,
"%d.%d ul A ul_config %p t %d pdu_done %d number_pdus %d\n",
scheduled_response->frame,
slot,
ul_config,
pdu_type,
pdu_done,
ul_config->number_pdus);
break;
}
}
+1 -1
View File
@@ -544,7 +544,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue,
if (!(NR_MAX_NB_LAYERS>4)) {
NR_UE_DLSCH_t *dlsch0 = &dlsch[0];
int harq_pid = dlsch0->dlsch_config.harq_process_nbr;
NR_DL_UE_HARQ_t *dlsch0_harq = ue->dl_harq_processes[harq_pid];
NR_DL_UE_HARQ_t *dlsch0_harq = &ue->dl_harq_processes[0][harq_pid];
uint16_t BWPStart = dlsch0->dlsch_config.BWPStart;
uint16_t pdsch_start_rb = dlsch0->dlsch_config.start_rb;
uint16_t pdsch_nb_rb = dlsch0->dlsch_config.number_rbs;
+1 -3
View File
@@ -2080,9 +2080,7 @@ int main(int argc, char **argv) {
squareRoot(&UE->dlsch_demodulation_stats),
median(table_rx_demod), q1(table_rx_demod), q3(table_rx_demod));
//fprintf(time_meas_fd,"DEC;\n");
fprintf(time_meas_fd,"%f;%f;%f;%f\n",
squareRoot(&UE->dlsch_decoding_stats[subframe]),
median(table_rx_dec), q1(table_rx_dec), q3(table_rx_dec));
fprintf(time_meas_fd, "%f;%f;%f;%f\n", squareRoot(&UE->dlsch_decoding_stats[UE->current_thread_id[subframe]]), median(table_rx_dec), q1(table_rx_dec), q3(table_rx_dec));
printf("[passed] effective rate : %f (%2.1f%%,%f)): log and break \n",rate*effective_rate, 100*effective_rate, rate );
test_passed = 1;
break;
+2 -3
View File
@@ -53,8 +53,7 @@
#include "executables/lte-softmodem.h"
#include "common/ran_context.h"
#include "PHY/LTE_ESTIMATION/lte_estimation.h"
#include "openair1/PHY/LTE_TRANSPORT/dlsch_tbs.h"
#include "openair1/PHY/LTE_TRANSPORT/dlsch_tbs_full.h"
const char *__asan_default_options()
{
/* don't do leak checking in ulsim, not finished yet */
@@ -806,7 +805,7 @@ int main(int argc, char **argv) {
if (cqi_flag == 1) coded_bits_per_codeword-=UE->ulsch[0]->O;
rate = (double)dlsch_tbs25[get_I_TBS(mcs)][nb_rb-1]/(coded_bits_per_codeword);
rate = (double)TBStable[get_I_TBS(mcs)][nb_rb - 1] / (coded_bits_per_codeword);
printf("Rate = %f (mod %d), coded bits %u\n",rate,get_Qm_ul(mcs),coded_bits_per_codeword);
for (ch_realization=0; ch_realization<n_ch_rlz; ch_realization++) {
+5 -9
View File
@@ -831,6 +831,7 @@ int main(int argc, char **argv)
PHY_vars_UE_g[0][0] = UE;
memcpy(&UE->frame_parms,frame_parms,sizeof(NR_DL_FRAME_PARMS));
UE->frame_parms.nb_antennas_rx = n_rx;
UE->frame_parms.nb_antenna_ports_gNB = n_tx;
UE->max_ldpc_iterations = max_ldpc_iterations;
if (run_initial_sync==1)
@@ -1372,16 +1373,11 @@ int main(int argc, char **argv)
void update_ptrs_config(NR_CellGroupConfig_t *secondaryCellGroup, uint16_t *rbSize, uint8_t *mcsIndex, int8_t *ptrs_arg)
{
NR_BWP_Downlink_t *bwp=secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[0];
int *ptrsFreqDenst = calloc(2, sizeof(long));
ptrsFreqDenst[0]= 25;
ptrsFreqDenst[1]= 115;
int *ptrsTimeDenst = calloc(3, sizeof(long));
ptrsTimeDenst[0]= 2;
ptrsTimeDenst[1]= 4;
ptrsTimeDenst[2]= 10;
long ptrsFreqDenst[] = {25, 115};
long ptrsTimeDenst[] = {2, 4, 10};
int epre_Ratio = 0;
int reOffset = 0;
long epre_Ratio = 0;
long reOffset = 0;
if(ptrs_arg[0] ==0) {
ptrsTimeDenst[2]= *mcsIndex -1;
+1 -1
View File
@@ -401,7 +401,7 @@ int main(int argc, char **argv)
srand(time(NULL)); // Initialization, should only be called once.
actual_payload = rand(); // Returns a pseudo-random integer between 0 and RAND_MAX.
}
actual_payload &= ((1<<nr_bit)-1);
actual_payload &= nr_bit < 64 ? (1UL << nr_bit) - 1: 0xffffffffffffffff;
printf("Transmitted payload is %ld, do_DTX = %d\n",actual_payload,do_DTX);
+1 -1
View File
@@ -873,7 +873,7 @@ int main(int argc, char **argv)
if (input_fd != NULL || n_trials == 1) max_rounds=1;
if(1<<ptrs_time_density >= nb_symb_sch)
if (enable_ptrs && 1 << ptrs_time_density >= nb_symb_sch)
pdu_bit_map &= ~PUSCH_PDU_BITMAP_PUSCH_PTRS; // disable PUSCH PTRS
printf("\n");
+2 -2
View File
@@ -190,7 +190,7 @@ void tableNor(unsigned long seed)
return;
}
double __attribute__ ((no_sanitize_address)) gaussZiggurat(double mean, double variance)
double __attribute__ ((no_sanitize("address", "undefined"))) gaussZiggurat(double mean, double variance)
{
if (!tableNordDone) {
// let's make reasonnable constant tables
@@ -200,7 +200,7 @@ double __attribute__ ((no_sanitize_address)) gaussZiggurat(double mean, double v
}
hz = SHR3;
iz = hz & 127;
return abs(hz) < kn[iz] ? hz * wn[iz] : nfix();
return hz != INT32_MIN && abs(hz) < kn[iz] ? hz * wn[iz] : nfix();
}
#ifdef MAIN
@@ -2764,8 +2764,8 @@ uint8_t get_L_ptrs(uint8_t mcs1, uint8_t mcs2, uint8_t mcs3, uint8_t I_mcs, uint
*
*********************************************************************/
uint8_t get_K_ptrs(uint16_t nrb0, uint16_t nrb1, uint16_t N_RB) {
uint8_t get_K_ptrs(uint32_t nrb0, uint32_t nrb1, uint32_t N_RB)
{
if (N_RB < nrb0) {
LOG_D(PHY,"PUSH PT-RS is not present.\n");
return -1;
@@ -176,7 +176,7 @@ uint8_t get_l0_ul(uint8_t mapping_type, uint8_t dmrs_typeA_position);
int32_t get_l_prime(uint8_t duration_in_symbols, uint8_t mapping_type, pusch_dmrs_AdditionalPosition_t additional_pos, pusch_maxLength_t pusch_maxLength, uint8_t start_symbolt, uint8_t dmrs_typeA_position);
uint8_t get_L_ptrs(uint8_t mcs1, uint8_t mcs2, uint8_t mcs3, uint8_t I_mcs, uint8_t mcs_table);
uint8_t get_K_ptrs(uint16_t nrb0, uint16_t nrb1, uint16_t N_RB);
uint8_t get_K_ptrs(uint32_t nrb0, uint32_t nrb1, uint32_t N_RB);
uint32_t nr_compute_tbs(uint16_t Qm,
uint16_t R,
@@ -2609,6 +2609,7 @@ uint8_t get_ssb_rsrp_payload(NR_UE_MAC_INST_t *mac,
int ssbri_bits = ceil(log2(nb_ssb));
int ssb_rsrp[2][nb_meas]; // the array contains index and RSRP of each SSB to be reported (nb_meas highest RSRPs)
memset(ssb_rsrp, 0, sizeof(ssb_rsrp));
//TODO replace the following 2 lines with a function to order the nb_meas highest SSB RSRPs
for (int i=0; i<nb_ssb; i++) {
+1 -1
View File
@@ -151,7 +151,7 @@ void nr_rlc_pdu_encoder_init(nr_rlc_pdu_encoder_t *encoder,
{
encoder->byte = 0;
encoder->bit = 0;
encoder->buffer = buffer;
encoder->buffer = (unsigned char *)buffer;
encoder->size = size;
}
+1 -1
View File
@@ -71,7 +71,7 @@ int nr_rlc_pdu_decoder_get_bits(nr_rlc_pdu_decoder_t *decoder, int count);
typedef struct {
int byte; /* next byte to encode */
int bit; /* next bit in next byte to encode */
char *buffer;
unsigned char *buffer;
int size;
} nr_rlc_pdu_encoder_t;
+1 -1
View File
@@ -121,7 +121,7 @@ void nr_rrc_trigger(protocol_ctxt_t *ctxt, int CC_id, int frame, int subframe);
\ *ptrsMcs Pointer to L_ptrs MCS related parameters
\ *epre_Ratio Pointer to ep_ratio
\ *reOffset Pointer to RE Offset Value */
void rrc_config_dl_ptrs_params(NR_BWP_Downlink_t *bwp, int *ptrsNrb, int *ptrsMcs, int *epre_Ratio, int * reOffset);
void rrc_config_dl_ptrs_params(NR_BWP_Downlink_t *bwp, long *ptrsNrb, long *ptrsMcs, long *epre_Ratio, long *reOffset);
void nr_rrc_mac_remove_ue(rnti_t rntiP);
void nr_rrc_mac_update_cellgroup(rnti_t rntiMaybeUEid, NR_CellGroupConfig_t *cgc);
+21 -18
View File
@@ -77,36 +77,39 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon
}
/* Function to set or overwrite PTRS DL RRC parameters */
void rrc_config_dl_ptrs_params(NR_BWP_Downlink_t *bwp, int *ptrsNrb, int *ptrsMcs, int *epre_Ratio, int * reOffset)
void rrc_config_dl_ptrs_params(NR_BWP_Downlink_t *bwp, long *ptrsNrb, long *ptrsMcs, long *epre_Ratio, long *reOffset)
{
int i=0;
NR_DMRS_DownlinkConfig_t *tmp = bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup;
// struct NR_SetupRelease_PTRS_DownlinkConfig *tmp=bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS;
/* check for memory allocation */
if(bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS == NULL) {
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS=calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS));
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->present = NR_SetupRelease_PTRS_DownlinkConfig_PR_setup;
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup= calloc(1, sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup));
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity));
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity = calloc(1, sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity));
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->epre_Ratio = calloc(1,sizeof(long));
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->resourceElementOffset = calloc(1,sizeof(long));
if (tmp->phaseTrackingRS == NULL) {
asn1cCalloc(tmp->phaseTrackingRS, TrackingRS);
TrackingRS->present = NR_SetupRelease_PTRS_DownlinkConfig_PR_setup;
asn1cCalloc(TrackingRS->choice.setup, setup);
asn1cCalloc(setup->frequencyDensity, freqD);
/* Fill the given values */
for(i = 0; i < 2; i++) {
asn1cSeqAdd(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity->list,&ptrsNrb[i]);
asn1cSequenceAdd(freqD->list, long, nbr);
*nbr = ptrsNrb[i];
}
asn1cCalloc(setup->timeDensity, timeD);
for(i = 0; i < 3; i++) {
asn1cSeqAdd(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list,&ptrsMcs[i]);
asn1cSequenceAdd(timeD->list, long, mcs);
*mcs = ptrsMcs[i];
}
}// if memory exist then over write the old values
else {
asn1cCallocOne(setup->epre_Ratio, epre_Ratio[0]);
asn1cCallocOne(setup->resourceElementOffset, reOffset[0]);
} else {
NR_PTRS_DownlinkConfig_t *TrackingRS = tmp->phaseTrackingRS->choice.setup;
for(i = 0; i < 2; i++) {
*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->frequencyDensity->list.array[i] = ptrsNrb[i];
*TrackingRS->frequencyDensity->list.array[i] = ptrsNrb[i];
}
for(i = 0; i < 3; i++) {
*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->timeDensity->list.array[i] = ptrsMcs[i];
*TrackingRS->timeDensity->list.array[i] = ptrsMcs[i];
}
*TrackingRS->epre_Ratio = epre_Ratio[0];
*TrackingRS->resourceElementOffset = reOffset[0];
}
*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->epre_Ratio = *epre_Ratio;
*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS->choice.setup->resourceElementOffset = *reOffset;
}
#endif
@@ -55,9 +55,11 @@ int encode_fgs_payload_container(FGSPayloadContainer *paycontainer, uint8_t iei,
encoded += encode_result;
}
if(iei > 0){
*(uint16_t*) (buffer+1) = htons(encoded - 3);
uint16_t tmp = htons(encoded - 3);
memcpy(buffer + 1, &tmp, sizeof(tmp));
} else {
*(uint16_t*) (buffer) = htons(encoded - 2);
uint16_t tmp = htons(encoded - 2);
memcpy(buffer, &tmp, sizeof(tmp));
}
return encoded;
@@ -35,14 +35,18 @@ void capture_pdu_session_establishment_accept_msg(uint8_t *buffer, uint32_t msg_
pdu_session_establishment_accept_msg_t psea_msg;
sec_nas_hdr.epd = *(buffer + (offset++));
sec_nas_hdr.sht = *(buffer + (offset++));
sec_nas_hdr.mac = htonl(*(uint32_t *)(buffer + offset));
uint32_t tmp;
memcpy(&tmp, buffer + offset, sizeof(tmp));
sec_nas_hdr.mac = htonl(tmp);
offset+=sizeof(sec_nas_hdr.mac);
sec_nas_hdr.sqn = *(buffer + (offset++));
sec_nas_msg.epd = *(buffer + (offset++));
sec_nas_msg.sht = *(buffer + (offset++));
sec_nas_msg.msg_type = *(buffer + (offset++));
sec_nas_msg.payload_type = *(buffer + (offset++));
sec_nas_msg.payload_len = htons(*(uint16_t *)(buffer + offset));
uint16_t tmp16;
memcpy(&tmp16, buffer + offset, sizeof(tmp16));
sec_nas_msg.payload_len = htons(tmp16);
offset+=sizeof(sec_nas_msg.payload_len);
/* Mandatory Presence IEs */
psea_msg.epd = *(buffer + (offset++));
@@ -51,12 +55,14 @@ void capture_pdu_session_establishment_accept_msg(uint8_t *buffer, uint32_t msg_
psea_msg.msg_type = *(buffer + (offset++));
psea_msg.pdu_type = *(buffer + offset) & 0x0f;
psea_msg.ssc_mode = (*(buffer + (offset++)) & 0xf0) >> 4;
psea_msg.qos_rules.length = htons(*(uint16_t *)(buffer + offset));
memcpy(&tmp16, buffer + offset, sizeof(tmp16));
psea_msg.qos_rules.length = htons(tmp16);
offset+=sizeof(psea_msg.qos_rules.length);
/* Supports the capture of only one QoS Rule, it should be changed for multiple QoS Rules */
qos_rule_t qos_rule;
qos_rule.id = *(buffer + (offset++));
qos_rule.length = htons(*(uint16_t *)(buffer + offset));
memcpy(&tmp16, buffer + offset, sizeof(tmp16));
qos_rule.length = htons(tmp16);
offset+=sizeof(qos_rule.length);
qos_rule.oc = (*(buffer + offset) & 0xE0) >> 5;
qos_rule.dqr = (*(buffer + offset) & 0x10) >> 4;
@@ -76,7 +76,8 @@ int encode_fgc_nas_message_container(FGCNasMessageContainer *nasmessagecontainer
if ((encode_result = encode_octet_string(&nasmessagecontainer->nasmessagecontainercontents, buffer + encoded, len - encoded)) < 0) {
return encode_result;
} else {
*(uint16_t*) (buffer+1) = htons(encoded + encode_result - 3);
uint16_t tmp = htons(encoded + encode_result - 3);
memcpy(buffer + 1, &tmp, sizeof(tmp));
encoded += encode_result;
}
+7 -4
View File
@@ -53,8 +53,9 @@ int decode_5gs_mobile_identity(FGSMobileIdentity *fgsmobileidentity, uint8_t iei
CHECK_IEI_DECODER(iei, *buffer);
decoded++;
}
ielen = *(uint16_t*)(buffer + decoded); /* length is two bytes */
uint16_t tmp;
memcpy(&tmp, buffer + decoded, sizeof(tmp));
ielen = (uint8_t)tmp;
decoded += 2;
CHECK_LENGTH_DECODER(len - decoded, ielen);
@@ -106,9 +107,11 @@ int encode_5gs_mobile_identity(FGSMobileIdentity *fgsmobileidentity, uint8_t iei
}
if(iei > 0){
*(uint16_t*) (buffer+1) = htons(encoded + encoded_rc - 3);
uint16_t tmp = htons(encoded + encoded_rc - 3);
memcpy(buffer + 1, &tmp, sizeof(tmp));
} else {
*(uint16_t*) buffer = htons(encoded + encoded_rc - 2);
uint16_t tmp = htons(encoded + encoded_rc - 2);
memcpy(buffer, &tmp, sizeof(tmp));
}
return (encoded + encoded_rc);
+7 -3
View File
@@ -41,9 +41,13 @@
vALUE = ntohl(*(uint32_t*)(bUFFER)) >> 8; \
sIZE += sizeof(uint8_t) + sizeof(uint16_t)
#define DECODE_U32(bUFFER, vALUE, sIZE) \
vALUE = ntohl(*(uint32_t*)(bUFFER)); \
sIZE += sizeof(uint32_t)
#define DECODE_U32(bUFFER, vALUE, sIZE) \
{ \
uint32_t v; \
memcpy(&v, bUFFER, sizeof(v)); \
vALUE = ntohl(v); \
} \
sIZE += sizeof(uint32_t)
#if (BYTE_ORDER == LITTLE_ENDIAN)
# define DECODE_LENGTH_U16(bUFFER, vALUE, sIZE) \
+6 -3
View File
@@ -36,9 +36,12 @@
*(uint32_t*)(buffer) = htonl(value); \
size += sizeof(uint8_t) + sizeof(uint16_t)
#define ENCODE_U32(buffer, value, size) \
*(uint32_t*)(buffer) = htonl(value); \
size += sizeof(uint32_t)
#define ENCODE_U32(buffer, value, size) \
{ \
uint32_t tmp = htonl(value); \
memcpy(buffer, &tmp, sizeof(tmp)); \
} \
size += sizeof(uint32_t)
#define IES_ENCODE_U8(buffer, encoded, value) \
ENCODE_U8(buffer + encoded, value, encoded)
+3 -1
View File
@@ -883,7 +883,9 @@ uint8_t get_msg_type(uint8_t *pdu_buffer, uint32_t length) {
msg_type = ((mm_msg_header_t *)(pdu_buffer + offset))->message_type;
if (msg_type == FGS_DOWNLINK_NAS_TRANSPORT) {
msg_type = ((dl_nas_transport_t *)(pdu_buffer+ offset))->sm_nas_msg_header.message_type;
dl_nas_transport_t tmp;
memcpy(&tmp, pdu_buffer + offset, sizeof(tmp));
msg_type = tmp.sm_nas_msg_header.message_type;
}
}
} else { // plain 5GS NAS message
+39
View File
@@ -0,0 +1,39 @@
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
#---------------------------------------------------------------------
kind: BuildConfig
apiVersion: build.openshift.io/v1
metadata:
name: "oai-clang"
spec:
runPolicy: "Serial"
nodeSelector:
kubernetes.io/hostname: theseus
source:
type: "Binary"
strategy:
dockerStrategy:
dockerfilePath: "docker/Dockerfile.clang.rhel8.2"
output:
to:
kind: "ImageStreamTag"
name: "oai-clang:latest"
+30
View File
@@ -0,0 +1,30 @@
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
#---------------------------------------------------------------------
#
apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
name: oai-clang
namespace: oaicicd-ran
spec:
lookupPolicy:
local: true