Merge branch 'CSI-SA' into aw2s-n41
Conflicts: openair1/PHY/NR_TRANSPORT/pucch_rx.c openair2/LAYER2/NR_MAC_gNB/config.c
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
#LDPC coder/decoder implementation
|
||||
# LDPC coder/decoder implementation
|
||||
The LDPC coder and decoder are implemented in a shared library, dynamically loaded at run-time using the [oai shared library loader](file://../../../../common/utils/DOC/loader.md). The code loading the LDPC library is in [nrLDPC_load.c](file://../nrLDPC_load.c), in function `load_nrLDPClib`, which must be called at init time.
|
||||
|
||||
## Selecting the LDPC library at run time
|
||||
|
||||
By default the function `int load_nrLDPClib(void)` looks for `libldpc.so`, this default behavior can be changed using the oai loader configuration options in the configuration file or from the command line as shown below:
|
||||
|
||||
>loading `libldpc_optim8seg.so` instead of `libldpc.so`
|
||||
#### Examples of ldpc shared lib selection when running nr softmodem's:
|
||||
|
||||
loading `libldpc_optim8seg.so` instead of `libldpc.so`:
|
||||
|
||||
```
|
||||
./nr-softmodem -O libconfig:gnb.band78.tm1.106PRB.usrpx300.conf:dbgl5 --loader.ldpc.shlibversion _optim8seg
|
||||
@@ -18,9 +20,160 @@ By default the function `int load_nrLDPClib(void)` looks for `libldpc.so`, this
|
||||
........................
|
||||
```
|
||||
|
||||
Today, this mechanism is not available in the `ldpctest` phy simulator which doesn't initialize the [configuration module](file://../../../../common/config/DOC/config.md). loads `libldpc.so` and `libldpc_orig.so` to compare the performance of the two implementations.
|
||||
loading `libldpc_cl.so` instead of `libldpc.so`:
|
||||
|
||||
###LDPC libraries
|
||||
Libraries implementing the LDPC algorithms must be named `libldpc<_version>.so`, they must implement two functions: `nrLDPC_decod` and `nrLDPC_encod`. The prototypes for these functions is defined in [nrLDPC_defs.h](file://nrLDPC_defs.h).
|
||||
`make ldpc_cl`
|
||||
|
||||
`cp ../../../openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_kernels_CL.cl`
|
||||
|
||||
`./nr-softmodem -O libconfig:gnb.band78.sa.fr1.106PRB.usrpb210.conf:dbgl5 --rfsim --rfsimulator.serveraddr server --sa --log_config.gtpu_log_level info --loader.ldpc.shlibversion _cl`
|
||||
|
||||
``` [LOADER] library libldpc_cl.so successfully loaded
|
||||
------------------------------------------------
|
||||
[HW] Platform 0, OpenCL profile FULL_PROFILE
|
||||
[HW] Platform 0, OpenCL version OpenCL 2.1 LINUX
|
||||
[HW] Device 0 is available
|
||||
[HW] Device 0, type 2 = 0x00000002: cpu
|
||||
[HW] Device 0, number of Compute Units: 8
|
||||
[HW] Device 0, max Work Items dimension: 3
|
||||
[HW] Device 0, max Work Items size for dimension: 0 8192
|
||||
[HW] Device 0, max Work Items size for dimension: 1 8192
|
||||
[HW] Device 0, max Work Items size for dimension: 2 8192
|
||||
[New Thread 0x7fffcc258700 (LWP 3945123)]
|
||||
[New Thread 0x7fffc3e57700 (LWP 3945124)]
|
||||
[New Thread 0x7fffcbe57700 (LWP 3945125)]
|
||||
[New Thread 0x7fffcba56700 (LWP 3945126)]
|
||||
[New Thread 0x7fffcb254700 (LWP 3945128)]
|
||||
[New Thread 0x7fffcb655700 (LWP 3945127)]
|
||||
[New Thread 0x7fffcae53700 (LWP 3945129)]
|
||||
[HW] Platform 1, OpenCL profile FULL_PROFILE
|
||||
[HW] Platform 1, OpenCL version OpenCL 2.0 beignet 1.3
|
||||
[New Thread 0x7fffc965a700 (LWP 3945130)]
|
||||
[Thread 0x7fffc965a700 (LWP 3945130) exited]
|
||||
[HW] Device 0 is available
|
||||
[HW] Device 0, type 4 = 0x00000004: gpu
|
||||
[HW] Device 0, number of Compute Units: 20
|
||||
[HW] Device 0, max Work Items dimension: 3
|
||||
[HW] Device 0, max Work Items size for dimension: 0 512
|
||||
[HW] Device 0, max Work Items size for dimension: 1 512
|
||||
[HW] Device 0, max Work Items size for dimension: 2 512
|
||||
-----------------------------------------------------------------
|
||||
```
|
||||
|
||||
`./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --sa -O libconfig:/usr/local/oai/conf/nrue_sim.conf:dbgl5 --nokrnmod --loader.ldpc.shlibversion _cl --log_config.hw_log_level info`
|
||||
|
||||
```[CONFIG] shlibversion set to _cl from command line
|
||||
............................................................
|
||||
[CONFIG] loader.ldpc 1 options set from command line
|
||||
[LOADER] library libldpc_cl.so successfully loaded
|
||||
[HW] Platform 0, OpenCL profile FULL_PROFILE
|
||||
[HW] Platform 0, OpenCL version OpenCL 2.1 LINUX
|
||||
[HW] Device 0 is available
|
||||
[HW] Device 0, type 2 = 0x00000002: cpu
|
||||
[HW] Device 0, number of Compute Units: 8
|
||||
[HW] Device 0, max Work Items dimension: 3
|
||||
[HW] Device 0, max Work Items size for dimension: 0 8192
|
||||
[HW] Device 0, max Work Items size for dimension: 1 8192
|
||||
[HW] Device 0, max Work Items size for dimension: 2 8192
|
||||
[New Thread 0x7fffecccc700 (LWP 3945413)]
|
||||
[New Thread 0x7fffec8cb700 (LWP 3945415)]
|
||||
[New Thread 0x7fffec4ca700 (LWP 3945414)]
|
||||
[New Thread 0x7fffdf7fd700 (LWP 3945417)]
|
||||
[New Thread 0x7fffdfbfe700 (LWP 3945418)]
|
||||
[New Thread 0x7fffdffff700 (LWP 3945416)]
|
||||
[New Thread 0x7fffd73fc700 (LWP 3945419)]
|
||||
[HW] Platform 1, OpenCL profile FULL_PROFILE
|
||||
[HW] Platform 1, OpenCL version OpenCL 2.0 beignet 1.3
|
||||
[New Thread 0x7fffde105700 (LWP 3945420)]
|
||||
[Thread 0x7fffde105700 (LWP 3945420) exited]
|
||||
[HW] Device 0 is available
|
||||
[HW] Device 0, type 4 = 0x00000004: gpu
|
||||
[HW] Device 0, number of Compute Units: 20
|
||||
[HW] Device 0, max Work Items dimension: 3
|
||||
[HW] Device 0, max Work Items size for dimension: 0 512
|
||||
[HW] Device 0, max Work Items size for dimension: 1 512
|
||||
[HW] Device 0, max Work Items size for dimension: 2 512
|
||||
------------------------------------------------------------
|
||||
```
|
||||
```
|
||||
|
||||
A mechanism to select ldpc implementation is also available in the `ldpctest` phy simulator via the `-v`option, which can be used to specify the version of the ldpc shared library to be used.
|
||||
|
||||
#### Examples of ldpc shared lib selection when running ldpctest:
|
||||
|
||||
Loading libldpc_cuda.so, the cuda implementation of the ldpc decoder:
|
||||
|
||||
```$ ./ldpctest -v _cuda
|
||||
Initializing random number generator, seed 0
|
||||
block length 8448:
|
||||
n_trials 1:
|
||||
SNR0 -2.000000:
|
||||
[CONFIG] get parameters from cmdline , debug flags: 0x00400000
|
||||
[CONFIG] log_config: 2/3 parameters successfully set
|
||||
[CONFIG] log_config: 53/53 parameters successfully set
|
||||
[CONFIG] log_config: 53/53 parameters successfully set
|
||||
[CONFIG] log_config: 16/16 parameters successfully set
|
||||
[CONFIG] log_config: 16/16 parameters successfully set
|
||||
log init done
|
||||
[CONFIG] loader: 2/2 parameters successfully set
|
||||
[CONFIG] loader.ldpc: 1/2 parameters successfully set
|
||||
[LOADER] library libldpc_cuda.so successfully loaded
|
||||
...................................
|
||||
```
|
||||
```
|
||||
|
||||
Loading libldpc_cl.so, the opencl implementation of the ldpc decoder:
|
||||
|
||||
`make ldpc_cl`
|
||||
|
||||
`cp ../../../openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_kernels_CL.cl`
|
||||
|
||||
`./ldpctest -v _cl`
|
||||
|
||||
```$ ./ldpctest -v _cl
|
||||
Initializing random number generator, seed 0
|
||||
block length 8448:
|
||||
n_trials 1:
|
||||
SNR0 -2.000000:
|
||||
[CONFIG] get parameters from cmdline , debug flags: 0x00400000
|
||||
[CONFIG] log_config: 2/3 parameters successfully set
|
||||
[CONFIG] log_config: 53/53 parameters successfully set
|
||||
[CONFIG] log_config: 53/53 parameters successfully set
|
||||
[CONFIG] log_config: 16/16 parameters successfully set
|
||||
[CONFIG] log_config: 16/16 parameters successfully set
|
||||
log init done
|
||||
[CONFIG] loader: 2/2 parameters successfully set
|
||||
[CONFIG] loader.ldpc: 1/2 parameters successfully set
|
||||
[LOADER] library libldpc_cl.so successfully loaded
|
||||
[HW] Platform 0, OpenCL profile FULL_PROFILE
|
||||
[HW] Platform 0, OpenCL version OpenCL 2.1 LINUX
|
||||
[HW] Device 0 is available
|
||||
[HW] Device 0, type 2 = 0x00000002: cpu
|
||||
[HW] Device 0, number of Compute Units: 8
|
||||
[HW] Device 0, max Work Items dimension: 3
|
||||
[HW] Device 0, max Work Items size for dimension: 0 8192
|
||||
[HW] Device 0, max Work Items size for dimension: 1 8192
|
||||
[HW] Device 0, max Work Items size for dimension: 2 8192
|
||||
[HW] Platform 1, OpenCL profile FULL_PROFILE
|
||||
[HW] Platform 1, OpenCL version OpenCL 2.0 beignet 1.3
|
||||
[HW] Device 0 is available
|
||||
[HW] Device 0, type 4 = 0x00000004: gpu
|
||||
[HW] Device 0, number of Compute Units: 20
|
||||
[HW] Device 0, max Work Items dimension: 3
|
||||
[HW] Device 0, max Work Items size for dimension: 0 512
|
||||
[HW] Device 0, max Work Items size for dimension: 1 512
|
||||
[HW] Device 0, max Work Items size for dimension: 2 512
|
||||
................................
|
||||
```
|
||||
```
|
||||
|
||||
|
||||
|
||||
### LDPC libraries
|
||||
Libraries implementing the LDPC algorithms must be named `libldpc<_version>.so`, they must implement three functions: `nrLDPC_initcall` `nrLDPC_decod` and `nrLDPC_encod`. The prototypes for these functions is defined in [nrLDPC_defs.h](file://nrLDPC_defs.h).
|
||||
|
||||
`libldpc_cuda.so`has been tested with the `ldpctest` executable, usage from the softmodem's has to be tested.
|
||||
|
||||
`libldpc_cl`is under development.
|
||||
|
||||
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
|
||||
|
||||
@@ -101,8 +101,8 @@ int test_ldpc(short No_iteration,
|
||||
unsigned int *crc_misses,
|
||||
time_stats_t *time_optim,
|
||||
time_stats_t *time_decoder,
|
||||
n_iter_stats_t *dec_iter,
|
||||
short run_cuda)
|
||||
n_iter_stats_t *dec_iter
|
||||
)
|
||||
{
|
||||
//clock initiate
|
||||
//time_stats_t time,time_optim,tinput,tprep,tparity,toutput, time_decoder;
|
||||
@@ -393,28 +393,13 @@ int test_ldpc(short No_iteration,
|
||||
decParams.R=code_rate_vec[R_ind];//13;
|
||||
decParams.numMaxIter=No_iteration;
|
||||
decParams.outMode = nrLDPC_outMode_BIT;
|
||||
decParams.block_length=block_length;
|
||||
//decParams.outMode =nrLDPC_outMode_LLRINT8;
|
||||
#ifdef CUDA_FLAG
|
||||
set_compact_BG(Zc,BG);
|
||||
init_LLR_DMA_for_CUDA(&decParams, (int8_t*)channel_output_fixed[j], (int8_t*)estimated_output[j], block_length);
|
||||
#endif
|
||||
nrLDPC_initcall(&decParams, (int8_t*)channel_output_fixed[j], (int8_t*)estimated_output[j]);
|
||||
for(j=0;j<n_segments;j++) {
|
||||
start_meas(time_decoder);
|
||||
#ifdef CUDA_FLAG
|
||||
if(run_cuda){
|
||||
n_iter = nrLDPC_decoder_LYC(&decParams, (int8_t*)channel_output_fixed[j], (int8_t*)estimated_output[j], block_length, time_decoder);
|
||||
}
|
||||
else{
|
||||
// decode the sequence
|
||||
// decoder supports BG2, Z=128 & 256
|
||||
//esimated_output=ldpc_decoder(channel_output_fixed, block_length, No_iteration, (double)((float)nom_rate/(float)denom_rate));
|
||||
///nrLDPC_decoder(&decParams, channel_output_fixed, estimated_output, NULL);
|
||||
n_iter = nrLDPC_decoder(&decParams, (int8_t*)channel_output_fixed[j], (int8_t*)estimated_output[j], p_nrLDPC_procBuf, p_decoder_profiler);
|
||||
}
|
||||
#else
|
||||
n_iter = nrLDPC_decoder(&decParams, (int8_t*)channel_output_fixed[j], (int8_t*)estimated_output[j], p_nrLDPC_procBuf, p_decoder_profiler);
|
||||
#endif
|
||||
stop_meas(time_decoder);
|
||||
stop_meas(time_decoder);
|
||||
}
|
||||
|
||||
//for (i=(Kb+nrows) * Zc-5;i<(Kb+nrows) * Zc;i++)
|
||||
@@ -514,17 +499,14 @@ int test_ldpc(short No_iteration,
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef CUDA_FLAG
|
||||
warmup_for_GPU();
|
||||
#endif
|
||||
|
||||
unsigned int errors, errors_bit, crc_misses;
|
||||
double errors_bit_uncoded;
|
||||
short block_length=8448; // decoder supports length: 1201 -> 1280, 2401 -> 2560
|
||||
|
||||
char *ldpc_version=NULL; /* version of the ldpc decoder library to use (XXX suffix to use when loading libldpc_XXX.so */
|
||||
short No_iteration=5;
|
||||
int n_segments=1;
|
||||
//double rate=0.333;
|
||||
short run_cuda = 0;
|
||||
|
||||
int nom_rate=1;
|
||||
int denom_rate=3;
|
||||
@@ -544,7 +526,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
short BG=0,Zc,Kb=0;
|
||||
|
||||
while ((c = getopt (argc, argv, "q:r:s:S:l:G:n:d:i:t:u:h")) != -1)
|
||||
while ((c = getopt (argc, argv, "q:r:s:S:l:G:n:d:i:t:u:hv:")) != -1)
|
||||
switch (c)
|
||||
{
|
||||
case 'q':
|
||||
@@ -564,7 +546,7 @@ int main(int argc, char *argv[])
|
||||
break;
|
||||
|
||||
case 'G':
|
||||
run_cuda = atoi(optarg);
|
||||
ldpc_version="_cuda";
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
@@ -590,9 +572,11 @@ int main(int argc, char *argv[])
|
||||
case 'u':
|
||||
test_uncoded = atoi(optarg);
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
ldpc_version=strdup(optarg);
|
||||
break;
|
||||
case 'h':
|
||||
default:
|
||||
default:
|
||||
printf("CURRENTLY SUPPORTED CODE RATES: \n");
|
||||
printf("BG1 (blocklength > 3840): 1/3, 2/3, 22/25 (8/9) \n");
|
||||
printf("BG2 (blocklength <= 3840): 1/5, 1/3, 2/3 \n\n");
|
||||
@@ -609,6 +593,7 @@ int main(int argc, char *argv[])
|
||||
printf("-t SNR simulation step, Default: 0.1\n");
|
||||
printf("-i Max decoder iterations, Default: 5\n");
|
||||
printf("-u Set SNR per coded bit, Default: 0\n");
|
||||
printf("-v XXX Set ldpc shared library version. libldpc_XXX.so will be used \n");
|
||||
exit(1);
|
||||
break;
|
||||
}
|
||||
@@ -619,7 +604,10 @@ int main(int argc, char *argv[])
|
||||
printf("SNR0 %f: \n", SNR0);
|
||||
|
||||
|
||||
load_nrLDPClib();
|
||||
if (ldpc_version != NULL)
|
||||
load_nrLDPClib(ldpc_version);
|
||||
else
|
||||
load_nrLDPClib(NULL);
|
||||
load_nrLDPClib_ref("_orig", &encoder_orig);
|
||||
//for (block_length=8;block_length<=MAX_BLOCK_LENGTH;block_length+=8)
|
||||
|
||||
@@ -691,8 +679,7 @@ int main(int argc, char *argv[])
|
||||
&crc_misses,
|
||||
time_optim,
|
||||
time_decoder,
|
||||
dec_iter,
|
||||
run_cuda);
|
||||
dec_iter);
|
||||
|
||||
printf("SNR %f, BLER %f (%u/%d)\n", SNR, (float)decoded_errors[i]/(float)n_trials, decoded_errors[i], n_trials);
|
||||
printf("SNR %f, BER %f (%u/%d)\n", SNR, (float)errors_bit/(float)n_trials/(float)block_length/(double)n_segments, decoded_errors[i], n_trials);
|
||||
|
||||
@@ -30,14 +30,6 @@
|
||||
|
||||
#include <stdint.h> // for uint8/16/32_t
|
||||
|
||||
/* check if this ifndef is required for NB-IoT ?!
|
||||
//#ifndef NO_OPENAIR1
|
||||
//#include "PHY/defs_NB_IoT.h"
|
||||
//#else
|
||||
//#include "PHY/TOOLS/time_meas.h"
|
||||
//#endif
|
||||
*/
|
||||
|
||||
#define CRC24_A_NB_IoT 0
|
||||
#define CRC24_B_NB_IoT 1
|
||||
#define CRC16_NB_IoT 2
|
||||
|
||||
@@ -46,7 +46,8 @@
|
||||
#endif
|
||||
|
||||
static inline uint32_t nrLDPC_decoder_core(int8_t* p_llr, int8_t* p_out, t_nrLDPC_procBuf* p_procBuf, uint32_t numLLR, t_nrLDPC_lut* p_lut, t_nrLDPC_dec_params* p_decParams, t_nrLDPC_time_stats* p_profiler);
|
||||
|
||||
void nrLDPC_initcall(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out) {
|
||||
}
|
||||
int32_t nrLDPC_decod(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out, t_nrLDPC_procBuf* p_procBuf, t_nrLDPC_time_stats* p_profiler)
|
||||
{
|
||||
uint32_t numLLR;
|
||||
|
||||
@@ -0,0 +1,436 @@
|
||||
/*
|
||||
* 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.0 (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
|
||||
*/
|
||||
/*! \file nrLDPC_decoder_CL.c
|
||||
* \brief ldpc decoder, openCL implementaion
|
||||
* \author Francois TABURET
|
||||
* \date 2021
|
||||
* \version 1.0
|
||||
* \note initial implem - translation of cuda version
|
||||
*/
|
||||
/* uses HW component id for log messages ( --log_config.hw_log_level <warning| info|debug|trace>) */
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <cuda_runtime.h>
|
||||
#include <CL/opencl.h>
|
||||
#include "PHY/CODING/nrLDPC_decoder/nrLDPC_types.h"
|
||||
#include "PHY/CODING/nrLDPC_decoder/nrLDPCdecoder_defs.h"
|
||||
#include "assertions.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
|
||||
#define MAX_ITERATION 2
|
||||
#define MC 1
|
||||
|
||||
#define MAX_OCLDEV 10
|
||||
#define MAX_OCLRUNTIME 5
|
||||
|
||||
|
||||
#define CLSETKERNELARG(A,B,C,D) \
|
||||
rt=clSetKernelArg(A,B,C,D) ;\
|
||||
AssertFatal(rt == CL_SUCCESS, "Error %d setting kernel argument index %d\n" , (int)rt, B);
|
||||
|
||||
typedef struct{
|
||||
char x;
|
||||
char y;
|
||||
short value;
|
||||
} h_element;
|
||||
#include "../nrLDPC_decoder_LYC/bgs/BG1_compact_in_C.h"
|
||||
|
||||
typedef struct{
|
||||
cl_uint max_CU;
|
||||
cl_uint max_WID;
|
||||
size_t *max_WIS;
|
||||
} ocldev_t;
|
||||
|
||||
typedef struct {
|
||||
cl_kernel cnp_kernel_1st;
|
||||
cl_kernel cnp_kernel;
|
||||
cl_kernel vnp_kernel_normal;
|
||||
cl_kernel pack_decoded_bit;
|
||||
} oclkernels_t;
|
||||
|
||||
typedef struct{
|
||||
cl_uint num_devices;
|
||||
cl_device_id devices[MAX_OCLDEV];
|
||||
ocldev_t ocldev[MAX_OCLDEV];
|
||||
cl_context context;
|
||||
cl_program program;
|
||||
cl_mem dev_h_compact1;
|
||||
cl_mem dev_h_compact2;
|
||||
cl_mem dev_const_llr;
|
||||
cl_mem dev_llr;
|
||||
cl_mem dev_dt;
|
||||
cl_mem dev_tmp;
|
||||
oclkernels_t kernels[MAX_OCLDEV];
|
||||
cl_command_queue queue[MAX_OCLDEV];
|
||||
} oclruntime_t;
|
||||
|
||||
typedef struct{
|
||||
oclruntime_t runtime[MAX_OCLRUNTIME];
|
||||
} ocl_t;
|
||||
|
||||
|
||||
|
||||
ocl_t ocl;
|
||||
|
||||
|
||||
void set_compact_BG(int Zc,short BG){
|
||||
cl_uint rt;
|
||||
int row,col;
|
||||
if(BG == 1){
|
||||
row = 46;
|
||||
col = 68;
|
||||
}
|
||||
else{
|
||||
row = 42;
|
||||
col = 52;
|
||||
}
|
||||
int compact_row = 30;
|
||||
int compact_col = 19;
|
||||
if(BG==2){compact_row = 10, compact_col = 23;}
|
||||
int memorySize_h_compact1 = row * compact_col * sizeof(h_element);
|
||||
int memorySize_h_compact2 = compact_row * col * sizeof(h_element);
|
||||
int lift_index = 0;
|
||||
short lift_set[][9] = {
|
||||
{2,4,8,16,32,64,128,256},
|
||||
{3,6,12,24,48,96,192,384},
|
||||
{5,10,20,40,80,160,320},
|
||||
{7,14,28,56,112,224},
|
||||
{9,18,36,72,144,288},
|
||||
{11,22,44,88,176,352},
|
||||
{13,26,52,104,208},
|
||||
{15,30,60,120,240},
|
||||
{0}
|
||||
};
|
||||
|
||||
for(int i = 0; lift_set[i][0] != 0; i++){
|
||||
for(int j = 0; lift_set[i][j] != 0; j++){
|
||||
if(Zc == lift_set[i][j]){
|
||||
lift_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("\nZc = %d BG = %d\n",Zc,BG);
|
||||
ocl.runtime[0].dev_h_compact1 = clCreateBuffer(ocl.runtime[0].context, CL_MEM_READ_ONLY|CL_MEM_HOST_WRITE_ONLY, memorySize_h_compact1, NULL, (cl_int *)&rt);
|
||||
AssertFatal(rt == CL_SUCCESS, "Error %d creating buffer dev_h_compact1 for platform %i \n" , (int)rt, 0);
|
||||
ocl.runtime[0].dev_h_compact2 = clCreateBuffer(ocl.runtime[0].context, CL_MEM_READ_ONLY|CL_MEM_HOST_WRITE_ONLY, memorySize_h_compact2, NULL, (cl_int *)&rt);
|
||||
AssertFatal(rt == CL_SUCCESS, "Error %d creating buffer dev_h_compact2 for platform %i \n" , (int)rt, 0);
|
||||
h_element *h1;
|
||||
h_element *h2;
|
||||
switch(lift_index){
|
||||
case 0:
|
||||
h1 = host_h_compact1_I0;
|
||||
h2 = host_h_compact2_I0;
|
||||
break;
|
||||
case 1:
|
||||
h1 = host_h_compact1_I1;
|
||||
h2 = host_h_compact2_I1;
|
||||
break;
|
||||
case 2:
|
||||
h1 = host_h_compact1_I2;
|
||||
h2 = host_h_compact2_I2;
|
||||
break;
|
||||
case 3:
|
||||
h1 = host_h_compact1_I3;
|
||||
h2 = host_h_compact2_I3;
|
||||
break;
|
||||
case 4:
|
||||
h1 = host_h_compact1_I4;
|
||||
h2 = host_h_compact2_I4;
|
||||
break;
|
||||
case 5:
|
||||
h1 = host_h_compact1_I5;
|
||||
h2 = host_h_compact2_I5;
|
||||
break;
|
||||
case 6:
|
||||
h1 = host_h_compact1_I6;
|
||||
h2 = host_h_compact2_I6;
|
||||
break;
|
||||
case 7:
|
||||
h1 = host_h_compact1_I7;
|
||||
h2 = host_h_compact2_I7;
|
||||
break;
|
||||
default:
|
||||
AssertFatal(0, "Invalid lift_index value %i\n" , lift_index);
|
||||
break;
|
||||
}
|
||||
rt = clEnqueueWriteBuffer(ocl.runtime[0].queue[0], ocl.runtime[0].dev_h_compact1, CL_TRUE, 0,memorySize_h_compact1, h1, 0, NULL, NULL);
|
||||
AssertFatal(rt == CL_SUCCESS, "Error %d moving h_compact1 memory to pltf %i dev %i\n" , (int)rt, 0,0);
|
||||
rt = clEnqueueWriteBuffer(ocl.runtime[0].queue[0], ocl.runtime[0].dev_h_compact2, CL_TRUE, 0,memorySize_h_compact2, h2, 0, NULL, NULL);
|
||||
AssertFatal(rt == CL_SUCCESS, "Error %d moving h_compact2 memory to pltf %i dev %i\n" , (int)rt, 0,0);
|
||||
// return 0;
|
||||
}
|
||||
void cl_error_callback(const char* errinfo, const void* private_info, size_t cb, void* user_data) {
|
||||
oclruntime_t *runtime = (oclruntime_t *)user_data;
|
||||
LOG_E(HW,"OpenCL accelerator error %s\n", errinfo );
|
||||
}
|
||||
|
||||
char *clutil_getstrdev(int intdev) {
|
||||
static char retstring[255]="";
|
||||
char *retptr=retstring;
|
||||
retptr+=sprintf(retptr,"0x%08x: ",(uint32_t)intdev);
|
||||
if (intdev & CL_DEVICE_TYPE_CPU)
|
||||
retptr+=sprintf(retptr,"%s","cpu ");
|
||||
if (intdev & CL_DEVICE_TYPE_GPU)
|
||||
retptr+=sprintf(retptr,"%s","gpu ");
|
||||
if (intdev & CL_DEVICE_TYPE_ACCELERATOR)
|
||||
retptr+=sprintf(retptr,"%s","acc ");
|
||||
return retstring;
|
||||
}
|
||||
|
||||
void get_CompilErr(cl_program program, int pltf) {
|
||||
|
||||
// Determine the size of the log
|
||||
size_t log_size;
|
||||
for(int i=0; i<ocl.runtime[pltf].num_devices;i++) {
|
||||
clGetProgramBuildInfo(program, ocl.runtime[pltf].devices[i], CL_PROGRAM_BUILD_LOG, 0, NULL, &log_size);
|
||||
// Allocate memory for the log
|
||||
char *log = (char *) malloc(log_size);
|
||||
// Get the log
|
||||
clGetProgramBuildInfo(program, ocl.runtime[pltf].devices[i], CL_PROGRAM_BUILD_LOG, log_size, log, NULL);
|
||||
// Print the log
|
||||
printf("%s\n", log);
|
||||
free(log);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
size_t load_source(char **source_str) {
|
||||
int MAX_SOURCE_SIZE=(500*132);
|
||||
FILE *fp;
|
||||
size_t source_size;
|
||||
|
||||
fp = fopen("nrLDPC_decoder_kernels_CL.cl", "r");
|
||||
AssertFatal(fp,"failed to open cl source: %s\n",strerror(errno));
|
||||
|
||||
*source_str = (char*)malloc(MAX_SOURCE_SIZE);
|
||||
source_size = fread( *source_str, 1, MAX_SOURCE_SIZE, fp);
|
||||
fclose( fp );
|
||||
return source_size;
|
||||
}
|
||||
|
||||
/* from here: entry points in decoder shared lib */
|
||||
int ldpc_autoinit(void) { // called by the library loader
|
||||
cl_platform_id platforms[10];
|
||||
cl_uint num_platforms_found;
|
||||
int context_ok=0;
|
||||
cl_uint rt = clGetPlatformIDs( sizeof(platforms)/sizeof(cl_platform_id), platforms, &num_platforms_found );
|
||||
AssertFatal(rt == CL_SUCCESS, "clGetPlatformIDs error %d\n" , (int)rt);
|
||||
AssertFatal( num_platforms_found>0 , "clGetPlatformIDs: no cl compatible platform found\n");
|
||||
for (int i=0 ; i<(int)num_platforms_found ; i++) {
|
||||
char stringval[255];
|
||||
rt = clGetPlatformInfo(platforms[i],CL_PLATFORM_PROFILE, sizeof(stringval),stringval,NULL);
|
||||
AssertFatal(rt == CL_SUCCESS, "clGetPlatformInfo PROFILE error %d\n" , (int)rt);
|
||||
LOG_I(HW,"Platform %i, OpenCL profile %s\n", i,stringval );
|
||||
rt = clGetPlatformInfo(platforms[i],CL_PLATFORM_VERSION, sizeof(stringval),stringval,NULL);
|
||||
AssertFatal(rt == CL_SUCCESS, "clGetPlatformInfo VERSION error %d\n" , (int)rt);
|
||||
LOG_I(HW,"Platform %i, OpenCL version %s\n", i,stringval );
|
||||
rt = clGetDeviceIDs(platforms[i],CL_DEVICE_TYPE_ALL, sizeof(ocl.runtime[i].devices)/sizeof(cl_device_id),ocl.runtime[i].devices,&(ocl.runtime[i].num_devices));
|
||||
AssertFatal(rt == CL_SUCCESS, "clGetDeviceIDs error %d\n" , (int)rt);
|
||||
int devok=0;
|
||||
for (int j=0; j<ocl.runtime[i].num_devices; j++) {
|
||||
cl_bool abool;
|
||||
rt = clGetDeviceInfo(ocl.runtime[i].devices[j],CL_DEVICE_AVAILABLE, sizeof(abool),&abool,NULL);
|
||||
AssertFatal(rt == CL_SUCCESS, "clGetDeviceInfo DEVICE_AVAILABLE error %d\n" , (int)rt);
|
||||
LOG_I(HW,"Device %i is %s available\n", j, (abool==CL_TRUE?"":"not"));
|
||||
cl_device_type devtype;
|
||||
rt = clGetDeviceInfo(ocl.runtime[i].devices[j],CL_DEVICE_TYPE, sizeof(cl_device_type),&devtype,NULL);
|
||||
AssertFatal(rt == CL_SUCCESS, "clGetDeviceInfo DEVICE_TYPE error %d\n" , (int)rt);
|
||||
LOG_I(HW,"Device %i, type %d = %s\n", j,(int)devtype, clutil_getstrdev(devtype));
|
||||
rt = clGetDeviceInfo(ocl.runtime[i].devices[j],CL_DEVICE_MAX_COMPUTE_UNITS,sizeof(ocl.runtime[i].ocldev[j].max_CU),&(ocl.runtime[i].ocldev[j].max_CU),NULL);
|
||||
AssertFatal(rt == CL_SUCCESS, "clGetDeviceInfo MAX_COMPUTE_UNITS error %d\n" , (int)rt);
|
||||
LOG_I(HW,"Device %i, number of Compute Units: %d\n", j,ocl.runtime[i].ocldev[j].max_CU);
|
||||
rt = clGetDeviceInfo(ocl.runtime[i].devices[j],CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS,sizeof(ocl.runtime[i].ocldev[j].max_WID),&(ocl.runtime[i].ocldev[j].max_WID),NULL);
|
||||
AssertFatal(rt == CL_SUCCESS, "clGetDeviceInfo MAX_WORK_ITEM_DIMENSIONS error %d\n" , (int)rt);
|
||||
LOG_I(HW,"Device %i, max Work Items dimension: %d\n", j,ocl.runtime[i].ocldev[j].max_WID);
|
||||
ocl.runtime[i].ocldev[j].max_WIS = (size_t *)malloc(ocl.runtime[i].ocldev[j].max_WID * sizeof(size_t));
|
||||
rt = clGetDeviceInfo(ocl.runtime[i].devices[j],CL_DEVICE_MAX_WORK_ITEM_SIZES,sizeof(ocl.runtime[i].ocldev[j].max_WID)*sizeof(size_t),ocl.runtime[i].ocldev[j].max_WIS,NULL);
|
||||
AssertFatal(rt == CL_SUCCESS, "clGetDeviceInfo MAX_WORK_ITEM_SIZES error %d\n" , (int)rt);
|
||||
for(int k=0; k<ocl.runtime[i].ocldev[j].max_WID;k++)
|
||||
LOG_I(HW,"Device %i, max Work Items size for dimension: %d %u\n", j,k,(uint32_t)ocl.runtime[i].ocldev[j].max_WIS[k]);
|
||||
devok++;
|
||||
}
|
||||
if (devok >0) {
|
||||
ocl.runtime[i].context = clCreateContext(NULL, ocl.runtime[i].num_devices, ocl.runtime[i].devices, cl_error_callback, &(ocl.runtime[i]), (cl_int *)&rt);
|
||||
AssertFatal(rt == CL_SUCCESS, "Error %d creating context for platform %i\n" , (int)rt, i);
|
||||
for(int dev=0; dev<ocl.runtime[i].num_devices; dev++) {
|
||||
ocl.runtime[i].queue[dev] = clCreateCommandQueueWithProperties(ocl.runtime[i].context,ocl.runtime[i].devices[dev] , 0, (cl_int *)&rt);
|
||||
AssertFatal(rt == CL_SUCCESS, "Error %d creating command queue for platform %i device %i\n" , (int)rt, i,dev);
|
||||
}
|
||||
ocl.runtime[i].dev_const_llr = clCreateBuffer(ocl.runtime[i].context, CL_MEM_READ_ONLY|CL_MEM_HOST_WRITE_ONLY, 68*384, NULL, (cl_int *)&rt);
|
||||
AssertFatal(rt == CL_SUCCESS, "Error %d creating buffer dev_const_llr for platform %i \n" , (int)rt, i);
|
||||
ocl.runtime[i].dev_llr = clCreateBuffer(ocl.runtime[i].context, CL_MEM_READ_WRITE|CL_MEM_HOST_WRITE_ONLY, 68*384, NULL, (cl_int *)&rt);
|
||||
AssertFatal(rt == CL_SUCCESS, "Error %d creating buffer dev_llr for platform %i \n" , (int)rt, i);
|
||||
ocl.runtime[i].dev_dt = clCreateBuffer(ocl.runtime[i].context, CL_MEM_READ_WRITE|CL_MEM_HOST_NO_ACCESS, 46*68*384, NULL, (cl_int *)&rt);
|
||||
AssertFatal(rt == CL_SUCCESS, "Error %d creating buffer dev_dt for platform %i \n" , (int)rt, i);
|
||||
ocl.runtime[i].dev_tmp = clCreateBuffer(ocl.runtime[i].context, CL_MEM_READ_ONLY|CL_MEM_HOST_WRITE_ONLY, 68*384, NULL, (cl_int *)&rt);
|
||||
AssertFatal(rt == CL_SUCCESS, "Error %d creating buffer dev_tmp for platform %i \n" , (int)rt, i);
|
||||
char *source_str;
|
||||
size_t source_size=load_source(&source_str);
|
||||
cl_program program = clCreateProgramWithSource(ocl.runtime[i].context, 1,
|
||||
(const char **)&source_str, (const size_t *)&source_size, (cl_int *)&rt);
|
||||
AssertFatal(rt == CL_SUCCESS, "Error %d creating program for platform %i \n" , (int)rt, i);
|
||||
rt = clBuildProgram(program, ocl.runtime[i].num_devices,ocl.runtime[i].devices, NULL, NULL, NULL);
|
||||
if (rt == CL_BUILD_PROGRAM_FAILURE) {
|
||||
get_CompilErr(program,i);
|
||||
}
|
||||
AssertFatal(rt == CL_SUCCESS, "Error %d buildding program for platform %i \n" , rt, i);
|
||||
|
||||
for(int dev=0; dev<ocl.runtime[i].num_devices; dev++) {
|
||||
ocl.runtime[i].kernels[dev].cnp_kernel_1st = clCreateKernel(program, "ldpc_cnp_kernel_1st_iter", (cl_int *)&rt);
|
||||
AssertFatal(rt == CL_SUCCESS, "Error %d creating kernel %s platform %i, dev %i\n" , (int)rt,"ldpc_cnp_kernel_1st_iter", i,dev);
|
||||
ocl.runtime[i].kernels[dev].cnp_kernel = clCreateKernel(program, "ldpc_cnp_kernel", (cl_int *)&rt);
|
||||
AssertFatal(rt == CL_SUCCESS, "Error %d creating kernel %s platform %i, dev %i\n" , (int)rt,"ldpc_cnp_kernel", i,dev);
|
||||
ocl.runtime[i].kernels[dev].vnp_kernel_normal = clCreateKernel(program, "ldpc_vnp_kernel_normal", (cl_int *)&rt);
|
||||
AssertFatal(rt == CL_SUCCESS, "Error %d creating kernel %s platform %i, dev %i\n" , (int)rt,"ldpc_vnp_kernel_normal", i,dev);
|
||||
ocl.runtime[i].kernels[dev].pack_decoded_bit = clCreateKernel(program, "pack_decoded_bit", (cl_int *)&rt);
|
||||
AssertFatal(rt == CL_SUCCESS, "Error %d creating kernel %s platform %i, dev %i\n" , (int)rt,"pack_decoded_bit", i,dev);
|
||||
}
|
||||
context_ok++;
|
||||
}
|
||||
devok=0;
|
||||
}
|
||||
AssertFatal(context_ok>0, "No openCL device available to accelerate ldpc\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void nrLDPC_initcall(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out) {
|
||||
set_compact_BG(p_decParams->Z,p_decParams->BG);
|
||||
// init_LLR_DMA(p_decParams, p_llr, p_out);
|
||||
}
|
||||
|
||||
|
||||
int32_t nrLDPC_decod(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out,t_nrLDPC_procBuf* p_procBuf, t_nrLDPC_time_stats *time_decoder)
|
||||
{
|
||||
uint16_t Zc = p_decParams->Z;
|
||||
uint8_t BG = p_decParams->BG;
|
||||
// uint8_t numMaxIter = p_decParams->numMaxIter;
|
||||
int block_length = p_decParams->block_length;
|
||||
// e_nrLDPC_outMode outMode = p_decParams->outMode;
|
||||
uint8_t row,col;
|
||||
if(BG == 1){
|
||||
row = 46;
|
||||
col = 68;
|
||||
}
|
||||
else{
|
||||
row = 42;
|
||||
col = 52;
|
||||
}
|
||||
|
||||
// alloc memory
|
||||
// unsigned char *hard_decision = (unsigned char*)p_out;
|
||||
// gpu
|
||||
int memorySize_llr = col * Zc * sizeof(char) * MC;
|
||||
// cudaCheck( cudaMemcpyToSymbol(dev_const_llr, p_llr, memorySize_llr_cuda) );
|
||||
// cudaCheck( cudaMemcpyToSymbol(dev_llr, p_llr, memorySize_llr_cuda) );
|
||||
int rt = clEnqueueWriteBuffer(ocl.runtime[0].queue[0], ocl.runtime[0].dev_const_llr, CL_TRUE, 0,
|
||||
memorySize_llr, p_llr, 0, NULL, NULL);
|
||||
AssertFatal(rt == CL_SUCCESS, "Error %d moving p_llr data to read only memory in pltf %i dev %i\n" , (int)rt, 0,0);
|
||||
rt = clEnqueueWriteBuffer(ocl.runtime[0].queue[0], ocl.runtime[0].dev_llr, CL_TRUE, 0,
|
||||
memorySize_llr, p_llr, 0, NULL, NULL);
|
||||
AssertFatal(rt == CL_SUCCESS, "Error %d moving p_llr data to read-write memory in pltf %i dev %i\n" , (int)rt, 0,0);
|
||||
// Define CUDA kernel dimension
|
||||
// int blockSizeX = Zc;
|
||||
// dim3 dimGridKernel1(row, MC, 1); // dim of the thread blocks
|
||||
// dim3 dimBlockKernel1(blockSizeX, 1, 1);
|
||||
|
||||
// dim3 dimGridKernel2(col, MC, 1);
|
||||
// dim3 dimBlockKernel2(blockSizeX, 1, 1);
|
||||
// cudaDeviceSynchronize();
|
||||
|
||||
// lauch kernel
|
||||
size_t global_item_sizek0[2] = {row*Zc,MC}; // Process the entire lists
|
||||
size_t global_item_sizek1[2] = {col*Zc,MC}; // Process the entire lists
|
||||
size_t local_item_sizek[2] = {128,1}; // Divide work items into groups of 128
|
||||
|
||||
for(int ii = 0; ii < MAX_ITERATION; ii++){
|
||||
// first kernel
|
||||
if(ii == 0){
|
||||
// ldpc_cnp_kernel_1st_iter
|
||||
// <<<dimGridKernel1, dimBlockKernel1>>>
|
||||
// ( BG, row, col, Zc);
|
||||
CLSETKERNELARG(ocl.runtime[0].kernels[0].cnp_kernel_1st, 0, sizeof(cl_mem), (void *)&(ocl.runtime[0].dev_llr));
|
||||
CLSETKERNELARG(ocl.runtime[0].kernels[0].cnp_kernel_1st, 1, sizeof(cl_mem), (void *)&(ocl.runtime[0].dev_dt));
|
||||
CLSETKERNELARG(ocl.runtime[0].kernels[0].cnp_kernel_1st, 2, sizeof(cl_mem), (void *)&(ocl.runtime[0].dev_h_compact1));
|
||||
CLSETKERNELARG(ocl.runtime[0].kernels[0].cnp_kernel_1st, 3, sizeof(int), (void *)&(BG));
|
||||
CLSETKERNELARG(ocl.runtime[0].kernels[0].cnp_kernel_1st, 4, sizeof(int), (void *)&(row));
|
||||
CLSETKERNELARG(ocl.runtime[0].kernels[0].cnp_kernel_1st, 5, sizeof(int), (void *)&(col));
|
||||
CLSETKERNELARG(ocl.runtime[0].kernels[0].cnp_kernel_1st, 6, sizeof(int), (void *)&(Zc));
|
||||
rt = clEnqueueNDRangeKernel(ocl.runtime[0].queue[0], ocl.runtime[0].kernels[0].cnp_kernel_1st, 2, NULL,
|
||||
global_item_sizek0, local_item_sizek, 0, NULL, NULL);
|
||||
AssertFatal(rt == CL_SUCCESS, "Error %d enqueing cnp_kernel_1st \n" , (int)rt);
|
||||
}else{
|
||||
// ldpc_cnp_kernel
|
||||
// <<<dimGridKernel1, dimBlockKernel1>>>
|
||||
// ( BG, row, col, Zc);
|
||||
CLSETKERNELARG(ocl.runtime[0].kernels[0].cnp_kernel, 0, sizeof(cl_mem), (void *)&(ocl.runtime[0].dev_llr));
|
||||
CLSETKERNELARG(ocl.runtime[0].kernels[0].cnp_kernel, 1, sizeof(cl_mem), (void *)&(ocl.runtime[0].dev_dt));
|
||||
CLSETKERNELARG(ocl.runtime[0].kernels[0].cnp_kernel, 2, sizeof(cl_mem), (void *)&(ocl.runtime[0].dev_h_compact1));
|
||||
CLSETKERNELARG(ocl.runtime[0].kernels[0].cnp_kernel, 3, sizeof(int), (void *)&(BG));
|
||||
CLSETKERNELARG(ocl.runtime[0].kernels[0].cnp_kernel, 4, sizeof(int), (void *)&(row));
|
||||
CLSETKERNELARG(ocl.runtime[0].kernels[0].cnp_kernel, 5, sizeof(int), (void *)&(col));
|
||||
CLSETKERNELARG(ocl.runtime[0].kernels[0].cnp_kernel, 6, sizeof(int), (void *)&(Zc));
|
||||
rt = clEnqueueNDRangeKernel(ocl.runtime[0].queue[0], ocl.runtime[0].kernels[0].cnp_kernel, 2, NULL,
|
||||
global_item_sizek0, local_item_sizek, 0, NULL, NULL);
|
||||
AssertFatal(rt == CL_SUCCESS, "Error %d enqueing cnp_kernel\n" , (int)rt);
|
||||
}
|
||||
// second kernel
|
||||
// ldpc_vnp_kernel_normal
|
||||
// <<<dimGridKernel2, dimBlockKernel2>>>
|
||||
// // (dev_llr, dev_const_llr,BG, row, col, Zc);
|
||||
// (BG, row, col, Zc);
|
||||
CLSETKERNELARG(ocl.runtime[0].kernels[0].vnp_kernel_normal, 0, sizeof(cl_mem), (void *)&(ocl.runtime[0].dev_llr));
|
||||
CLSETKERNELARG(ocl.runtime[0].kernels[0].vnp_kernel_normal, 1, sizeof(cl_mem), (void *)&(ocl.runtime[0].dev_dt));
|
||||
CLSETKERNELARG(ocl.runtime[0].kernels[0].vnp_kernel_normal, 2, sizeof(cl_mem), (void *)&(ocl.runtime[0].dev_const_llr));
|
||||
CLSETKERNELARG(ocl.runtime[0].kernels[0].vnp_kernel_normal, 3, sizeof(cl_mem), (void *)&(ocl.runtime[0].dev_h_compact2));
|
||||
CLSETKERNELARG(ocl.runtime[0].kernels[0].vnp_kernel_normal, 4, sizeof(int), (void *)&(BG));
|
||||
CLSETKERNELARG(ocl.runtime[0].kernels[0].vnp_kernel_normal, 5, sizeof(int), (void *)&(row));
|
||||
CLSETKERNELARG(ocl.runtime[0].kernels[0].vnp_kernel_normal, 6, sizeof(int), (void *)&(col));
|
||||
CLSETKERNELARG(ocl.runtime[0].kernels[0].vnp_kernel_normal, 7, sizeof(int), (void *)&(Zc));
|
||||
rt = clEnqueueNDRangeKernel(ocl.runtime[0].queue[0], ocl.runtime[0].kernels[0].vnp_kernel_normal, 2, NULL,
|
||||
global_item_sizek1, local_item_sizek, 0, NULL, NULL);
|
||||
AssertFatal(rt == CL_SUCCESS, "Error %d enqueing vnp_kernel_normal \n" , (int)rt);
|
||||
}
|
||||
|
||||
// int pack = (block_length/128)+1;
|
||||
// dim3 pack_block(pack, MC, 1);
|
||||
// pack_decoded_bit<<<pack_block,128>>>( col, Zc);
|
||||
CLSETKERNELARG(ocl.runtime[0].kernels[0].pack_decoded_bit, 0, sizeof(cl_mem), (void *)&(ocl.runtime[0].dev_llr));
|
||||
CLSETKERNELARG(ocl.runtime[0].kernels[0].pack_decoded_bit, 1, sizeof(cl_mem), (void *)&(ocl.runtime[0].dev_tmp));
|
||||
CLSETKERNELARG(ocl.runtime[0].kernels[0].pack_decoded_bit, 2, sizeof(int), (void *)&(col));
|
||||
CLSETKERNELARG(ocl.runtime[0].kernels[0].pack_decoded_bit, 3, sizeof(int), (void *)&(Zc));
|
||||
|
||||
// Execute the OpenCL kernel on the list
|
||||
size_t global_item_size[2] = {block_length,MC}; // Process the entire lists
|
||||
size_t local_item_size[2] = {128,1}; // Divide work items into groups of 128
|
||||
rt = clEnqueueNDRangeKernel(ocl.runtime[0].queue[0], ocl.runtime[0].kernels[0].pack_decoded_bit, 2, NULL,
|
||||
global_item_size, local_item_size, 0, NULL, NULL);
|
||||
AssertFatal(rt == CL_SUCCESS, "Error %d enqueing pack_decoded_bit \n" , (int)rt);
|
||||
// cudaCheck( cudaMemcpyFromSymbol((void*)hard_decision, (const void*)dev_tmp, (block_length/8)*sizeof(unsigned char)) );
|
||||
// cudaDeviceSynchronize();
|
||||
|
||||
rt = clEnqueueReadBuffer(ocl.runtime[0].queue[0], ocl.runtime[0].dev_tmp, CL_TRUE, 0,
|
||||
(block_length/8)*sizeof(unsigned char) , p_llr, 0, NULL, NULL);
|
||||
AssertFatal(rt == CL_SUCCESS, "Error %d moving p_llr data to pltf %i dev %i\n" , (int)rt, 0,0);
|
||||
return MAX_ITERATION;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,302 @@
|
||||
/*
|
||||
* 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.0 (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
|
||||
*/
|
||||
|
||||
/*! \file PHY/CODING/nrLDPC_decoder_kernels_CL.cl
|
||||
* \brief kernel functions for ldpc decoder accelerated via openCL
|
||||
* \author Francois TABURET
|
||||
* \date 2021
|
||||
* \version 1.0
|
||||
* \company Nokia BellLabs France
|
||||
* \email: francois.taburet@nokia-bell-labs.com
|
||||
* \note initial implem - translation of cuda version
|
||||
* \warning
|
||||
*/
|
||||
#define define MAX_ITERATION 2
|
||||
#define MC 1
|
||||
|
||||
#define INT32_MAX 2147483647
|
||||
|
||||
typedef struct{
|
||||
char x;
|
||||
char y;
|
||||
short value;
|
||||
} h_element;
|
||||
|
||||
//__global char dev_dt [46*68*384];
|
||||
//__local char *dev_t;
|
||||
//__global char dev_llr[68*384];
|
||||
//__global unsigned char dev_tmp[68*384];
|
||||
|
||||
|
||||
|
||||
|
||||
//__constant h_element dev_h_compact1[46*19] = {}; // used in kernel 1
|
||||
//__constant h_element dev_h_compact2[68*30] = {}; // used in kernel 2
|
||||
|
||||
// __device__ __constantant__ h_element dev_h_compact1[46*19]; // used in kernel 1
|
||||
// __device__ __constantant__ h_element dev_h_compact2[68*30]; // used in kernel 2
|
||||
|
||||
// row and col element count
|
||||
__constant char h_ele_row_bg1_count[46] = {
|
||||
19, 19, 19, 19, 3, 8, 9, 7, 10, 9,
|
||||
7, 8, 7, 6, 7, 7, 6, 6, 6, 6,
|
||||
6, 6, 5, 5, 6, 5, 5, 4, 5, 5,
|
||||
5, 5, 5, 5, 5, 5, 5, 4, 5, 5,
|
||||
4, 5, 4, 5, 5, 4};
|
||||
__constant char h_ele_col_bg1_count[68] = {
|
||||
30, 28, 7, 11, 9, 4, 8, 12, 8, 7,
|
||||
12, 10, 12, 11, 10, 7, 10, 10, 13, 7,
|
||||
8, 11, 12, 5, 6, 6, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1};
|
||||
__constant char h_ele_row_bg2_count[42] = {
|
||||
8, 10, 8, 10, 4, 6, 6, 6, 4, 5,
|
||||
5, 5, 4, 5, 5, 4, 5, 5, 4, 4,
|
||||
4, 4, 3, 4, 4, 3, 5, 3, 4, 3,
|
||||
5, 3, 4, 4, 4, 4, 4, 3, 4, 4,
|
||||
4, 4};
|
||||
__constant char h_ele_col_bg2_count[52] = {
|
||||
22, 23, 10, 5, 5, 14, 7, 13, 6, 8,
|
||||
9, 16, 9, 12, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1};
|
||||
|
||||
|
||||
|
||||
// Kernel 1
|
||||
__kernel void ldpc_cnp_kernel_1st_iter( __global char * dev_llr, __global char * dev_dt, __local h_element *dev_h_compact1, int BG, int row, int col, int Zc)
|
||||
{
|
||||
// int iMCW = blockIdx.y; // codeword id
|
||||
// int iBlkRow = blockIdx.x; // block row in h_base
|
||||
// int iSubRow = threadIdx.x; // row index in sub_block of h_base
|
||||
// if(blockIdx.x == 0 && threadIdx.x == 1) printf("cnp %d\n", threadIdx.x);
|
||||
int iMCW = get_group_id(1); // codeword id
|
||||
int iBlkRow = get_group_id(0); // block row in h_base
|
||||
int iBlkCol; // block col in h_base
|
||||
int iSubRow = get_local_id(0);; // row index in sub_block of h_base
|
||||
int iCol; // overall col index in h_base
|
||||
int offsetR;
|
||||
int shift_t;
|
||||
|
||||
// For 2-min algorithm.
|
||||
int Q_sign = 0;
|
||||
int sq;
|
||||
int Q, Q_abs;
|
||||
int R_temp;
|
||||
|
||||
int sign = 1;
|
||||
int rmin1 = INT32_MAX;
|
||||
int rmin2 = INT32_MAX;
|
||||
char idx_min = 0;
|
||||
|
||||
h_element h_element_t;
|
||||
int s = (BG==1)? h_ele_row_bg1_count[iBlkRow]:h_ele_row_bg2_count[iBlkRow];
|
||||
offsetR = (iMCW * row*col*Zc) + iBlkRow * Zc + iSubRow; // row*col*Zc = size of dev_dt
|
||||
// if(blockIdx.x == 0 && threadIdx.x == 1) printf("s: %d, offset %d\n", s, offsetR);
|
||||
// The 1st recursion
|
||||
for(int i = 0; i < s; i++) // loop through all the ZxZ sub-blocks in a row
|
||||
{
|
||||
h_element_t = dev_h_compact1[i*row+iBlkRow]; // compact_col == row
|
||||
|
||||
iBlkCol = h_element_t.y;
|
||||
shift_t = h_element_t.value;
|
||||
|
||||
shift_t = (iSubRow + shift_t) % Zc;
|
||||
iCol = (iMCW * col*Zc) + iBlkCol * Zc + shift_t; // col*Zc = size of llr
|
||||
Q = dev_llr[iCol];
|
||||
Q_abs = (Q>0)? Q : -Q;
|
||||
sq = Q < 0;
|
||||
// if(blockIdx.x == 0 && threadIdx.x == 1) printf("i %d, icol %d, Q: %d\n", i, iCol, Q);
|
||||
// quick version
|
||||
sign = sign * (1 - sq * 2);
|
||||
Q_sign |= sq << i;
|
||||
|
||||
if (Q_abs < rmin1){
|
||||
rmin2 = rmin1;
|
||||
rmin1 = Q_abs;
|
||||
idx_min = i;
|
||||
} else if (Q_abs < rmin2){
|
||||
rmin2 = Q_abs;
|
||||
}
|
||||
}
|
||||
|
||||
// if(blockIdx.x == 0 && threadIdx.x == 1)printf("min1 %d, min2 %d, min1_idx %d\n", rmin1, rmin2, idx_min);
|
||||
|
||||
// The 2nd recursion
|
||||
for(int i = 0; i < s; i++){
|
||||
// v0: Best performance so far. 0.75f is the value of alpha.
|
||||
sq = 1 - 2 * ((Q_sign >> i) & 0x01);
|
||||
R_temp = 0.75f * sign * sq * (i != idx_min ? rmin1 : rmin2);
|
||||
// write results to global memory
|
||||
h_element_t = dev_h_compact1[i*row+iBlkRow];
|
||||
int addr_temp = offsetR + h_element_t.y * row * Zc;
|
||||
dev_dt[addr_temp] = R_temp;
|
||||
// if(blockIdx.x == 0 && threadIdx.x == 1)printf("R_temp %d, temp_addr %d\n", R_temp, addr_temp);
|
||||
}
|
||||
}
|
||||
|
||||
// Kernel_1
|
||||
__kernel void ldpc_cnp_kernel( __global char * dev_llr, __global char * dev_dt, __local h_element *dev_h_compact1, int BG, int row, int col, int Zc)
|
||||
{
|
||||
// if(blockIdx.x == 0 && threadIdx.x == 1) printf("cnp\n");
|
||||
// int iMCW = blockIdx.y;
|
||||
// int iBlkRow = blockIdx.x; // block row in h_base // block col in h_base
|
||||
// int iSubRow = threadIdx.x; // row index in sub_block of h_base
|
||||
int iMCW = get_group_id(1);
|
||||
int iBlkRow = get_group_id(0); // block row in h_base
|
||||
int iBlkCol; // block col in h_base
|
||||
int iSubRow = get_local_id(0);; // row index in sub_block of h_base
|
||||
int iCol; // overall col index in h_base
|
||||
int offsetR;
|
||||
int shift_t;
|
||||
|
||||
// For 2-min algorithm.
|
||||
int Q_sign = 0;
|
||||
int sq;
|
||||
int Q, Q_abs;
|
||||
int R_temp;
|
||||
|
||||
int sign = 1;
|
||||
int rmin1 = INT32_MAX;
|
||||
int rmin2 = INT32_MAX;
|
||||
char idx_min = 0;
|
||||
|
||||
h_element h_element_t;
|
||||
int s = (BG==1)? h_ele_row_bg1_count[iBlkRow]: h_ele_row_bg2_count[iBlkRow];
|
||||
offsetR = (iMCW *row*col*Zc) + iBlkRow * Zc + iSubRow; // row * col * Zc = size of dev_dt
|
||||
// if(blockIdx.x == 0 && threadIdx.x == 1) printf("s: %d, offset %d\n", s, offsetR);
|
||||
// The 1st recursion
|
||||
for(int i = 0; i < s; i++) // loop through all the ZxZ sub-blocks in a row
|
||||
{
|
||||
h_element_t = dev_h_compact1[i*row+iBlkRow];
|
||||
|
||||
iBlkCol = h_element_t.y;
|
||||
shift_t = h_element_t.value;
|
||||
shift_t = (iSubRow + shift_t) % Zc;
|
||||
iCol = iBlkCol * Zc + shift_t;
|
||||
|
||||
R_temp = dev_dt[offsetR + iBlkCol * row * Zc];
|
||||
|
||||
Q = dev_llr[iMCW * (col*Zc) + iCol] - R_temp;
|
||||
Q_abs = (Q>0)? Q : -Q;
|
||||
// if(blockIdx.x == 0 && threadIdx.x == 1) printf("i %d, icol %d, Q: %d\n", i, iCol, Q);
|
||||
sq = Q < 0;
|
||||
sign = sign * (1 - sq * 2);
|
||||
Q_sign |= sq << i;
|
||||
|
||||
if (Q_abs < rmin1){
|
||||
rmin2 = rmin1;
|
||||
rmin1 = Q_abs;
|
||||
idx_min = i;
|
||||
} else if (Q_abs < rmin2){
|
||||
rmin2 = Q_abs;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// if(blockIdx.x == 0 && threadIdx.x == 1)printf("min1 %d, min2 %d, min1_idx %d\n", rmin1, rmin2, idx_min);
|
||||
|
||||
// The 2nd recursion
|
||||
for(int i = 0; i < s; i ++){
|
||||
sq = 1 - 2 * ((Q_sign >> i) & 0x01);
|
||||
R_temp = 0.75f * sign * sq * (i != idx_min ? rmin1 : rmin2);
|
||||
|
||||
|
||||
// write results to global memory
|
||||
h_element_t = dev_h_compact1[i*row+iBlkRow];
|
||||
int addr_temp = h_element_t.y * row * Zc + offsetR;
|
||||
dev_dt[addr_temp] = R_temp;
|
||||
// if(blockIdx.x == 0 && threadIdx.x == 1)printf("R_temp %d, temp_addr %d\n", R_temp, addr_temp);
|
||||
}
|
||||
}
|
||||
|
||||
// Kernel 2: VNP processing
|
||||
__kernel void
|
||||
ldpc_vnp_kernel_normal(__global char * dev_llr, __global char * dev_dt, __global char * dev_const_llr, __local h_element *dev_h_compact2, int BG, int row, int col, int Zc)
|
||||
{
|
||||
// int iMCW = blockIdx.y;
|
||||
// int iBlkCol = blockIdx.x;
|
||||
// int iSubCol = threadIdx.x;
|
||||
int iMCW = get_group_id(1);
|
||||
int iBlkCol = get_group_id(0);
|
||||
int iBlkRow;
|
||||
int iSubCol = get_local_id(0);
|
||||
int iRow;
|
||||
int iCol;
|
||||
|
||||
int shift_t, sf;
|
||||
int APP;
|
||||
|
||||
h_element h_element_t;
|
||||
|
||||
// update all the llr values
|
||||
iCol = iBlkCol * Zc + iSubCol;
|
||||
APP = dev_const_llr[iMCW *col*Zc + iCol];
|
||||
int offsetDt = iMCW *row*col*Zc + iBlkCol * row * Zc;
|
||||
int s = (BG==1)? h_ele_col_bg1_count[iBlkCol]:h_ele_col_bg2_count[iBlkCol];
|
||||
|
||||
for(int i = 0; i < s; i++)
|
||||
{
|
||||
h_element_t = dev_h_compact2[i*col+iBlkCol];
|
||||
|
||||
shift_t = h_element_t.value%Zc;
|
||||
iBlkRow = h_element_t.x;
|
||||
|
||||
sf = iSubCol - shift_t;
|
||||
sf = (sf + Zc) % Zc;
|
||||
|
||||
iRow = iBlkRow * Zc + sf;
|
||||
APP = APP + dev_dt[offsetDt + iRow];
|
||||
}
|
||||
if(APP > SCHAR_MAX) APP = SCHAR_MAX;
|
||||
if(APP < SCHAR_MIN) APP = SCHAR_MIN;
|
||||
// write back to device global memory
|
||||
dev_llr[iMCW *col*Zc + iCol] = APP;
|
||||
}
|
||||
|
||||
|
||||
__kernel void pack_decoded_bit(__global unsigned char * dev_llr, __global unsigned char * dev_tmp, int col, int Zc)
|
||||
{
|
||||
// int iMCW = blockIdx.y;
|
||||
// int btid = threadIdx.x;
|
||||
unsigned char tmp[128];
|
||||
int iMCW = get_group_id(1);
|
||||
int btid = get_local_id(0);
|
||||
int tid = iMCW * col*Zc + get_group_id(0)*128 + btid;
|
||||
tmp[btid] = 0;
|
||||
|
||||
if(dev_llr[tid] < 0){
|
||||
tmp[btid] = 1 << (7-(btid&7));
|
||||
}
|
||||
// __syncthreads();
|
||||
|
||||
if(btid < 16){
|
||||
dev_tmp[iMCW * col*Zc + get_group_id(0)*16+btid] = 0;
|
||||
for(int i = 0; i < 8; i++){
|
||||
dev_tmp[iMCW * col*Zc + get_group_id(0)*16+btid] += tmp[btid*8+i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include <stdlib.h>
|
||||
#include "nrLDPC_types.h"
|
||||
|
||||
#ifndef malloc32_clear
|
||||
/**
|
||||
\brief Allocates 32 byte aligned memory and initializes to zero
|
||||
\param size Input size in bytes
|
||||
@@ -46,7 +45,6 @@ static inline void* malloc32_clear(size_t size)
|
||||
memset(ptr, 0, size);
|
||||
return ptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
\brief Allocates and initializes the internal decoder processing buffers
|
||||
|
||||
@@ -70,6 +70,7 @@ typedef struct nrLDPC_dec_params {
|
||||
uint16_t Z; /**< Lifting size */
|
||||
uint8_t R; /**< Decoding rate: Format 15,13,... for code rates 1/5, 1/3,... */
|
||||
uint8_t numMaxIter; /**< Maximum number of iterations */
|
||||
int block_length;
|
||||
e_nrLDPC_outMode outMode; /**< Output format */
|
||||
} t_nrLDPC_dec_params;
|
||||
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <cuda_runtime.h>
|
||||
#include <cuda.h>
|
||||
#include "PHY/CODING/nrLDPC_decoder/nrLDPC_types.h"
|
||||
#include "PHY/CODING/nrLDPC_decoder/nrLDPCdecoder_defs.h"
|
||||
|
||||
#include "assertions.h"
|
||||
#include "bgs/BG1_I0"
|
||||
#include "bgs/BG1_I1"
|
||||
#include "bgs/BG1_I2"
|
||||
@@ -462,10 +462,11 @@ void read_BG(int BG, int *h, int row, int col)
|
||||
}
|
||||
|
||||
extern "C"
|
||||
void init_LLR_DMA_for_CUDA(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out, int block_length){
|
||||
void init_LLR_DMA(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out){
|
||||
|
||||
uint16_t Zc = p_decParams->Z;
|
||||
uint8_t BG = p_decParams->BG;
|
||||
int block_length = p_decParams->block_length;
|
||||
uint8_t row,col;
|
||||
if(BG == 1){
|
||||
row = 46;
|
||||
@@ -483,14 +484,60 @@ void init_LLR_DMA_for_CUDA(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8
|
||||
|
||||
}
|
||||
|
||||
using namespace std ;
|
||||
|
||||
/* from here: entry points in decoder shared lib */
|
||||
extern "C"
|
||||
int32_t nrLDPC_decoder_LYC(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out, int block_length, time_stats_t *time_decoder)
|
||||
int ldpc_autoinit(void) { // called by the library loader
|
||||
/*int devices = 0;
|
||||
|
||||
cudaError_t err = cudaGetDeviceCount(&devices);
|
||||
AssertFatal(devices>0,"\nNo cuda GPU found\n\n");
|
||||
|
||||
const int kb = 1024;
|
||||
const int mb = kb * kb;
|
||||
wcout << "NBody.GPU" << endl << "=========" << endl << endl;
|
||||
|
||||
wcout << "CUDA version: v" << CUDART_VERSION << endl;
|
||||
|
||||
|
||||
wcout << "CUDA Devices: " << endl << endl;
|
||||
|
||||
for(int i = 0; i < devices; ++i)
|
||||
{
|
||||
cudaDeviceProp props;
|
||||
cudaGetDeviceProperties(&props, i);
|
||||
wcout << i << ": " << props.name << ": " << props.major << "." << props.minor << endl;
|
||||
wcout << " Global memory: " << props.totalGlobalMem / mb << "mb" << endl;
|
||||
wcout << " Shared memory: " << props.sharedMemPerBlock / kb << "kb" << endl;
|
||||
wcout << " Constant memory: " << props.totalConstMem / kb << "kb" << endl;
|
||||
wcout << " Block registers: " << props.regsPerBlock << endl << endl;
|
||||
|
||||
wcout << " Warp size: " << props.warpSize << endl;
|
||||
wcout << " Threads per block: " << props.maxThreadsPerBlock << endl;
|
||||
wcout << " Max block dimensions: [ " << props.maxThreadsDim[0] << ", " << props.maxThreadsDim[1] << ", " << props.maxThreadsDim[2] << " ]" << endl;
|
||||
wcout << " Max grid dimensions: [ " << props.maxGridSize[0] << ", " << props.maxGridSize[1] << ", " << props.maxGridSize[2] << " ]" << endl;
|
||||
wcout << endl;
|
||||
}
|
||||
*/
|
||||
warmup_for_GPU();
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
void nrLDPC_initcall(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out) {
|
||||
set_compact_BG(p_decParams->Z,p_decParams->BG);
|
||||
init_LLR_DMA(p_decParams, p_llr, p_out);
|
||||
}
|
||||
|
||||
|
||||
extern "C"
|
||||
int32_t nrLDPC_decod(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out,t_nrLDPC_procBuf* p_procBuf, t_nrLDPC_time_stats *time_decoder)
|
||||
{
|
||||
|
||||
|
||||
uint16_t Zc = p_decParams->Z;
|
||||
uint8_t BG = p_decParams->BG;
|
||||
uint8_t numMaxIter = p_decParams->numMaxIter;
|
||||
int block_length = p_decParams->block_length;
|
||||
e_nrLDPC_outMode outMode = p_decParams->outMode;
|
||||
cudaError_t cudaStatus;
|
||||
uint8_t row,col;
|
||||
|
||||
@@ -45,6 +45,7 @@ typedef struct {
|
||||
time_stats_t *toutput;
|
||||
}encoder_implemparams_t;
|
||||
#define INIT0_LDPCIMPLEMPARAMS {0,0,0,NULL,NULL,NULL,NULL}
|
||||
typedef void(*nrLDPC_initcallfunc_t)(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_out);
|
||||
typedef int(*nrLDPC_encoderfunc_t)(unsigned char **,unsigned char **,int,int,short, short, encoder_implemparams_t*);
|
||||
//============================================================================================================================
|
||||
// decoder interface
|
||||
@@ -56,4 +57,4 @@ typedef int(*nrLDPC_encoderfunc_t)(unsigned char **,unsigned char **,int,int,sho
|
||||
\param p_profiler LDPC profiler statistics
|
||||
*/
|
||||
typedef int32_t(*nrLDPC_decoderfunc_t)(t_nrLDPC_dec_params* , int8_t*, int8_t* , t_nrLDPC_procBuf* , t_nrLDPC_time_stats* );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -23,13 +23,16 @@
|
||||
#ifdef LDPC_LOADER
|
||||
nrLDPC_decoderfunc_t nrLDPC_decoder;
|
||||
nrLDPC_encoderfunc_t nrLDPC_encoder;
|
||||
nrLDPC_initcallfunc_t nrLDPC_initcall;
|
||||
#else
|
||||
/* functions to load the LDPC shared lib, implemented in openair1/PHY/CODING/nrLDPC_load.c */
|
||||
extern int load_nrLDPClib(void) ;
|
||||
extern int load_nrLDPClib(char *version) ;
|
||||
extern int load_nrLDPClib_ref(char *libversion, nrLDPC_encoderfunc_t * nrLDPC_encoder_ptr); // for ldpctest
|
||||
/* ldpc coder/decoder functions, as loaded by load_nrLDPClib(). */
|
||||
extern nrLDPC_initcallfunc_t nrLDPC_initcall;
|
||||
|
||||
extern nrLDPC_decoderfunc_t nrLDPC_decoder;
|
||||
extern nrLDPC_encoderfunc_t nrLDPC_encoder;
|
||||
// inline functions:
|
||||
#include "openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_init_mem.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -42,22 +42,32 @@
|
||||
|
||||
|
||||
/* function description array, to be used when loading the encoding/decoding shared lib */
|
||||
static loader_shlibfunc_t shlib_fdesc[2];
|
||||
static loader_shlibfunc_t shlib_fdesc[3];
|
||||
|
||||
char *arg[64]={"ldpctest","-O","cmdlineonly::dbgl0"};
|
||||
/* arguments used when called from phy simulators exec's which do not use the config module */
|
||||
/* arg is used to initialize the config module so that the loader works as expected */
|
||||
char *arg[64]={"ldpctest","-O","cmdlineonly::dbgl0",NULL,NULL};
|
||||
|
||||
int load_nrLDPClib(void) {
|
||||
int load_nrLDPClib(char *version) {
|
||||
char *ptr = (char*)config_get_if();
|
||||
char libname[64]="ldpc";
|
||||
|
||||
if ( ptr==NULL ) {// phy simulators, config module possibly not loaded
|
||||
load_configmodule(3,(char **)arg,CONFIG_ENABLECMDLINEONLY) ;
|
||||
load_configmodule(0,(char **)NULL,CONFIG_ENABLECMDLINEONLY) ;
|
||||
logInit();
|
||||
}
|
||||
shlib_fdesc[0].fname = "nrLDPC_decod";
|
||||
shlib_fdesc[1].fname = "nrLDPC_encod";
|
||||
int ret=load_module_shlib("ldpc",shlib_fdesc,sizeof(shlib_fdesc)/sizeof(loader_shlibfunc_t),NULL);
|
||||
shlib_fdesc[2].fname = "nrLDPC_initcall";
|
||||
int ret;
|
||||
if (version)
|
||||
ret=load_module_version_shlib(libname,version,shlib_fdesc,sizeof(shlib_fdesc)/sizeof(loader_shlibfunc_t),NULL);
|
||||
else
|
||||
ret=load_module_shlib(libname,shlib_fdesc,sizeof(shlib_fdesc)/sizeof(loader_shlibfunc_t),NULL);
|
||||
AssertFatal( (ret >= 0),"Error loading ldpc decoder");
|
||||
nrLDPC_decoder = (nrLDPC_decoderfunc_t)shlib_fdesc[0].fptr;
|
||||
nrLDPC_encoder = (nrLDPC_encoderfunc_t)shlib_fdesc[1].fptr;
|
||||
nrLDPC_initcall = (nrLDPC_initcallfunc_t)shlib_fdesc[2].fptr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -65,10 +75,8 @@ int load_nrLDPClib_ref(char *libversion, nrLDPC_encoderfunc_t * nrLDPC_encoder_p
|
||||
loader_shlibfunc_t shlib_encoder_fdesc;
|
||||
|
||||
shlib_encoder_fdesc.fname = "nrLDPC_encod";
|
||||
char libpath[64];
|
||||
sprintf(libpath,"ldpc%s",libversion);
|
||||
int ret=load_module_shlib(libpath,&shlib_encoder_fdesc,1,NULL);
|
||||
AssertFatal( (ret >= 0),"Error loading ldpc encoder %s\n",libpath);
|
||||
int ret=load_module_version_shlib("ldpc",libversion,&shlib_encoder_fdesc,1,NULL);
|
||||
AssertFatal( (ret >= 0),"Error loading ldpc encoder %s\n",(libversion==NULL)?"":libversion);
|
||||
*nrLDPC_encoder_ptr = (nrLDPC_encoderfunc_t)shlib_encoder_fdesc.fptr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ static inline void polar_rate_matching(const t_nrPolar_params *polarParams,void
|
||||
AssertFatal(polarParams->encoderLength<=512,"Need to handle groupsize(%d)<8 and N(%d)>512\n",polarParams->groupsize,polarParams->encoderLength);
|
||||
uint128_t *out128=(uint128_t*)out;
|
||||
uint128_t *in128=(uint128_t*)in;
|
||||
for (int i=0;i<=polarParams->encoderLength>>7;i++)
|
||||
for (int i=0;i<polarParams->encoderLength>>7;i++)
|
||||
out128[i]=0;
|
||||
uint128_t tmp0;
|
||||
#ifdef DEBUG_POLAR_ENCODER
|
||||
|
||||
@@ -388,7 +388,7 @@ int nr_rate_matching_ldpc(uint8_t Ilbrm,
|
||||
uint32_t Ncb,ind,k=0,Nref,N;
|
||||
|
||||
if (C==0) {
|
||||
printf("nr_rate_matching: invalid parameters (C %d\n",C);
|
||||
LOG_E(PHY,"nr_rate_matching: invalid parameters (C %d\n",C);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -407,16 +407,15 @@ int nr_rate_matching_ldpc(uint8_t Ilbrm,
|
||||
#ifdef RM_DEBUG
|
||||
printf("nr_rate_matching_ldpc: E %d, F %d, Foffset %d, k0 %d, Ncb %d, rvidx %d\n", E, F, Foffset,ind, Ncb, rvidx);
|
||||
#endif
|
||||
AssertFatal(Foffset <= E,
|
||||
"Foffset %d > E %d "
|
||||
"(Ilbrm %d, Tbslbrm %d, Z %d, BG %d, C %d)\n",
|
||||
Foffset, E,
|
||||
Ilbrm, Tbslbrm, Z, BG, C);
|
||||
AssertFatal(Foffset <= Ncb,
|
||||
"Foffset %d > Ncb %d "
|
||||
"(Ilbrm %d, Tbslbrm %d, Z %d, BG %d, C %d)\n",
|
||||
Foffset, Ncb,
|
||||
Ilbrm, Tbslbrm, Z, BG, C);
|
||||
|
||||
if (Foffset > E) {
|
||||
LOG_E(PHY,"nr_rate_matching: invalid parameters (Foffset %d > E %d)\n",Foffset,E);
|
||||
return -1;
|
||||
}
|
||||
if (Foffset > Ncb) {
|
||||
LOG_E(PHY,"nr_rate_matching: invalid parameters (Foffset %d > Ncb %d)\n",Foffset,Ncb);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ind >= Foffset && ind < (F+Foffset)) ind = F+Foffset;
|
||||
|
||||
@@ -478,7 +477,7 @@ int nr_rate_matching_ldpc_rx(uint8_t Ilbrm,
|
||||
#endif
|
||||
|
||||
if (C==0) {
|
||||
printf("nr_rate_matching: invalid parameters (C %d\n",C);
|
||||
LOG_E(PHY,"nr_rate_matching: invalid parameters (C %d\n",C);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -493,8 +492,14 @@ int nr_rate_matching_ldpc_rx(uint8_t Ilbrm,
|
||||
}
|
||||
|
||||
ind = (index_k0[BG-1][rvidx]*Ncb/N)*Z;
|
||||
AssertFatal(Foffset <= E,"Foffset %d > E %d\n",Foffset,E);
|
||||
AssertFatal(Foffset <= Ncb,"Foffset %d > Ncb %d\n",Foffset,Ncb);
|
||||
if (Foffset > E) {
|
||||
LOG_E(PHY,"nr_rate_matching: invalid parameters (Foffset %d > E %d)\n",Foffset,E);
|
||||
return -1;
|
||||
}
|
||||
if (Foffset > Ncb) {
|
||||
LOG_E(PHY,"nr_rate_matching: invalid parameters (Foffset %d > Ncb %d)\n",Foffset,Ncb);
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef RM_DEBUG
|
||||
printf("nr_rate_matching_ldpc_rx: Clear %d, E %d, k0 %d, Ncb %d, rvidx %d\n", clear, E, ind, Ncb, rvidx);
|
||||
|
||||
+21
-28
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "executables/nr-softmodem-common.h"
|
||||
#include "common/utils/nr/nr_common.h"
|
||||
#include "common/ran_context.h"
|
||||
#include "PHY/defs_gNB.h"
|
||||
#include "PHY/phy_extern.h"
|
||||
#include "PHY/NR_REFSIG/nr_refsig.h"
|
||||
@@ -35,7 +36,6 @@
|
||||
#include "MBSFN-SubframeConfigList.h"*/
|
||||
#include "openair1/PHY/defs_RU.h"
|
||||
#include "openair1/PHY/CODING/nrLDPC_extern.h"
|
||||
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
#include "assertions.h"
|
||||
#include <math.h>
|
||||
|
||||
@@ -108,7 +108,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
||||
crcTableInit();
|
||||
init_scrambling_luts();
|
||||
init_pucch2_luts();
|
||||
load_nrLDPClib();
|
||||
load_nrLDPClib(NULL);
|
||||
// PBCH DMRS gold sequences generation
|
||||
nr_init_pbch_dmrs(gNB);
|
||||
//PDCCH DMRS init
|
||||
@@ -124,7 +124,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
||||
|
||||
for (int symb=0; symb<fp->symbols_per_slot; symb++) {
|
||||
pdcch_dmrs[slot][symb] = (uint32_t *)malloc16(NR_MAX_PDCCH_DMRS_INIT_LENGTH_DWORD*sizeof(uint32_t));
|
||||
LOG_I(PHY,"pdcch_dmrs[%d][%d] %p\n",slot,symb,pdcch_dmrs[slot][symb]);
|
||||
LOG_D(PHY,"pdcch_dmrs[%d][%d] %p\n",slot,symb,pdcch_dmrs[slot][symb]);
|
||||
AssertFatal(pdcch_dmrs[slot][symb]!=NULL, "NR init: pdcch_dmrs for slot %d symbol %d - malloc failed\n", slot, symb);
|
||||
}
|
||||
}
|
||||
@@ -519,45 +519,38 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) {
|
||||
LOG_I(PHY,"gNB %d configured\n",Mod_id);
|
||||
}
|
||||
|
||||
|
||||
void init_nr_transport(PHY_VARS_gNB *gNB) {
|
||||
int i;
|
||||
int j;
|
||||
void init_DLSCH_struct(PHY_VARS_gNB *gNB, processingData_L1tx_t *msg) {
|
||||
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
|
||||
nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config;
|
||||
LOG_I(PHY, "Initialise nr transport\n");
|
||||
uint16_t grid_size = cfg->carrier_config.dl_grid_size[fp->numerology_index].value;
|
||||
msg->num_pdsch_slot = 0;
|
||||
|
||||
for (int i=0; i<gNB->number_of_nr_dlsch_max; i++) {
|
||||
LOG_I(PHY,"Allocating Transport Channel Buffers for DLSCH %d/%d\n",i,gNB->number_of_nr_dlsch_max);
|
||||
for (int j=0; j<2; j++) {
|
||||
msg->dlsch[i][j] = new_gNB_dlsch(fp,1,16,NSOFT,0,grid_size);
|
||||
AssertFatal(msg->dlsch[i][j]!=NULL,"Can't initialize dlsch %d \n", i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void init_nr_transport(PHY_VARS_gNB *gNB) {
|
||||
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
|
||||
LOG_I(PHY, "Initialise nr transport\n");
|
||||
|
||||
memset(gNB->num_pdsch_rnti, 0, sizeof(uint16_t)*80);
|
||||
|
||||
for (i=0; i <NUMBER_OF_NR_PDCCH_MAX; i++) {
|
||||
LOG_I(PHY,"Initializing PDCCH list for PDCCH %d/%d\n",i,NUMBER_OF_NR_PDCCH_MAX);
|
||||
gNB->pdcch_pdu[i].frame=-1;
|
||||
LOG_I(PHY,"Initializing UL PDCCH list for UL PDCCH %d/%d\n",i,NUMBER_OF_NR_PDCCH_MAX);
|
||||
gNB->ul_pdcch_pdu[i].frame=-1;
|
||||
}
|
||||
|
||||
for (i=0; i<NUMBER_OF_NR_PUCCH_MAX; i++) {
|
||||
for (int i=0; i<NUMBER_OF_NR_PUCCH_MAX; i++) {
|
||||
LOG_I(PHY,"Allocating Transport Channel Buffers for PUCCH %d/%d\n",i,NUMBER_OF_NR_PUCCH_MAX);
|
||||
gNB->pucch[i] = new_gNB_pucch();
|
||||
AssertFatal(gNB->pucch[i]!=NULL,"Can't initialize pucch %d \n", i);
|
||||
}
|
||||
|
||||
for (i=0; i<gNB->number_of_nr_dlsch_max; i++) {
|
||||
|
||||
LOG_I(PHY,"Allocating Transport Channel Buffers for DLSCH %d/%d\n",i,gNB->number_of_nr_dlsch_max);
|
||||
|
||||
for (j=0; j<2; j++) {
|
||||
gNB->dlsch[i][j] = new_gNB_dlsch(fp,1,16,NSOFT,0,grid_size);
|
||||
AssertFatal(gNB->dlsch[i][j]!=NULL,"Can't initialize dlsch %d \n", i);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<gNB->number_of_nr_ulsch_max; i++) {
|
||||
for (int i=0; i<gNB->number_of_nr_ulsch_max; i++) {
|
||||
|
||||
LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH %d/%d\n",i,gNB->number_of_nr_ulsch_max);
|
||||
|
||||
for (j=0; j<2; j++) {
|
||||
for (int j=0; j<2; j++) {
|
||||
// ULSCH for data
|
||||
gNB->ulsch[i][j] = new_gNB_ulsch(MAX_LDPC_ITERATIONS, fp->N_RB_UL, 0);
|
||||
|
||||
|
||||
@@ -124,32 +124,32 @@ int nr_phy_init_RU(RU_t *ru) {
|
||||
ru->num_gNB,NUMBER_OF_gNB_MAX);
|
||||
|
||||
LOG_I(PHY,"[INIT] %s() ru->num_gNB:%d \n", __FUNCTION__, ru->num_gNB);
|
||||
|
||||
if (ru->do_precoding == 1) {
|
||||
if (ru->do_precoding == 1) {
|
||||
int beam_count = 0;
|
||||
if (ru->nb_tx>1) {//Enable beamforming when nb_tx > 1
|
||||
|
||||
for (p=0;p<ru->nb_log_antennas;p++) {
|
||||
//if ((fp->L_ssb >> (63-p)) & 0x01)//64 bit-map with the MSB @2⁶³ corresponds to SSB ssb_index 0
|
||||
beam_count++;
|
||||
}
|
||||
AssertFatal(ru->nb_bfw==(beam_count*ru->nb_tx),"Number of beam weights from config file is %d while the expected number is %d",ru->nb_bfw,(beam_count*ru->nb_tx));
|
||||
|
||||
for (i=0; i<ru->num_gNB; i++) {
|
||||
int l_ind = 0;
|
||||
for (p=0;p<ru->nb_log_antennas;p++) {
|
||||
for (i=0; i<ru->num_gNB; i++) {
|
||||
int l_ind = 0;
|
||||
for (p=0;p<ru->nb_log_antennas;p++) {
|
||||
//if ((fp->L_ssb >> (63-p)) & 0x01) {
|
||||
ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*));
|
||||
for (j=0; j<ru->nb_tx; j++) {
|
||||
ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t));
|
||||
AssertFatal(ru->bw_list[i],"ru->bw_list[%d] is null\n",i);
|
||||
for (re=0; re<fp->ofdm_symbol_size; re++)
|
||||
ru->beam_weights[i][p][j][re] = ru->bw_list[i][l_ind];
|
||||
//printf("Beam Weight %08x for beam %d and tx %d\n",ru->bw_list[i][l_ind],p,j);
|
||||
l_ind++;
|
||||
} // for j
|
||||
ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*));
|
||||
for (j=0; j<ru->nb_tx; j++) {
|
||||
ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t));
|
||||
AssertFatal(ru->bw_list[i],"ru->bw_list[%d] is null\n",i);
|
||||
for (re=0; re<fp->ofdm_symbol_size; re++)
|
||||
ru->beam_weights[i][p][j][re] = ru->bw_list[i][l_ind];
|
||||
//printf("Beam Weight %08x for beam %d and tx %d\n",ru->bw_list[i][l_ind],p,j);
|
||||
l_ind++;
|
||||
} // for j
|
||||
//}
|
||||
} // for p
|
||||
} //for i
|
||||
} // for p
|
||||
} //for i
|
||||
}
|
||||
|
||||
ru->common.beam_id = (uint8_t**)malloc16_clear(ru->nb_tx*sizeof(uint8_t*));
|
||||
|
||||
@@ -22,12 +22,63 @@
|
||||
#include "phy_init.h"
|
||||
#include "common/utils/nr/nr_common.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
|
||||
/// Subcarrier spacings in Hz indexed by numerology index
|
||||
uint32_t nr_subcarrier_spacing[MAX_NUM_SUBCARRIER_SPACING] = {15e3, 30e3, 60e3, 120e3, 240e3};
|
||||
uint16_t nr_slots_per_subframe[MAX_NUM_SUBCARRIER_SPACING] = {1, 2, 4, 8, 16};
|
||||
|
||||
// Table 5.4.3.3-1 38-101
|
||||
int nr_ssb_table[48][3] = {
|
||||
{1, 15, nr_ssb_type_A},
|
||||
{2, 15, nr_ssb_type_A},
|
||||
{3, 15, nr_ssb_type_A},
|
||||
{5, 15, nr_ssb_type_A},
|
||||
{5, 30, nr_ssb_type_B},
|
||||
{7, 15, nr_ssb_type_A},
|
||||
{8, 15, nr_ssb_type_A},
|
||||
{12, 15, nr_ssb_type_A},
|
||||
{14, 15, nr_ssb_type_A},
|
||||
{18, 15, nr_ssb_type_A},
|
||||
{20, 15, nr_ssb_type_A},
|
||||
{25, 15, nr_ssb_type_A},
|
||||
{26, 15, nr_ssb_type_A},
|
||||
{28, 15, nr_ssb_type_A},
|
||||
{29, 15, nr_ssb_type_A},
|
||||
{30, 15, nr_ssb_type_A},
|
||||
{34, 15, nr_ssb_type_A},
|
||||
{34, 30, nr_ssb_type_C},
|
||||
{38, 15, nr_ssb_type_A},
|
||||
{38, 30, nr_ssb_type_C},
|
||||
{39, 15, nr_ssb_type_A},
|
||||
{39, 30, nr_ssb_type_C},
|
||||
{40, 30, nr_ssb_type_C},
|
||||
{41, 15, nr_ssb_type_A},
|
||||
{41, 30, nr_ssb_type_C},
|
||||
{46, 30, nr_ssb_type_C},
|
||||
{48, 30, nr_ssb_type_C},
|
||||
{50, 30, nr_ssb_type_C},
|
||||
{51, 15, nr_ssb_type_A},
|
||||
{53, 15, nr_ssb_type_A},
|
||||
{65, 15, nr_ssb_type_A},
|
||||
{66, 15, nr_ssb_type_A},
|
||||
{66, 30, nr_ssb_type_B},
|
||||
{70, 15, nr_ssb_type_A},
|
||||
{71, 15, nr_ssb_type_A},
|
||||
{74, 15, nr_ssb_type_A},
|
||||
{75, 15, nr_ssb_type_A},
|
||||
{76, 15, nr_ssb_type_A},
|
||||
{77, 30, nr_ssb_type_C},
|
||||
{78, 30, nr_ssb_type_C},
|
||||
{79, 30, nr_ssb_type_C},
|
||||
{90, 15, nr_ssb_type_A},
|
||||
{90, 30, nr_ssb_type_C},
|
||||
{91, 15, nr_ssb_type_A},
|
||||
{92, 15, nr_ssb_type_A},
|
||||
{93, 15, nr_ssb_type_A},
|
||||
{94, 15, nr_ssb_type_A},
|
||||
{96, 30, nr_ssb_type_C}
|
||||
};
|
||||
|
||||
|
||||
void set_Lmax(NR_DL_FRAME_PARMS *fp) {
|
||||
// definition of Lmax according to ts 38.213 section 4.1
|
||||
@@ -86,27 +137,28 @@ int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp,uint8_t i_ssb) {
|
||||
|
||||
void set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu, int N_RB_DL)
|
||||
{
|
||||
int idx = 0;
|
||||
switch(mu) {
|
||||
|
||||
case NR_MU_0: //15kHz scs
|
||||
fp->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_0];
|
||||
fp->slots_per_subframe = nr_slots_per_subframe[NR_MU_0];
|
||||
fp->ssb_type = nr_ssb_type_A;
|
||||
while(nr_ssb_table[idx][0]!=fp->nr_band)
|
||||
idx++;
|
||||
AssertFatal(nr_ssb_table[idx][1]==15,"SCS %d not applicable to band %d\n",
|
||||
fp->subcarrier_spacing,fp->nr_band);
|
||||
break;
|
||||
|
||||
case NR_MU_1: //30kHz scs
|
||||
fp->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_1];
|
||||
fp->slots_per_subframe = nr_slots_per_subframe[NR_MU_1];
|
||||
|
||||
// selection of SS block pattern according to TS 38101-1 Table 5.4.3.3-1 for SCS 30kHz
|
||||
if (fp->nr_band == 5 || fp->nr_band == 66)
|
||||
fp->ssb_type = nr_ssb_type_B;
|
||||
else{
|
||||
if (fp->nr_band == 41 || fp->nr_band == 38 || ( fp->nr_band > 76 && fp->nr_band < 80) )
|
||||
fp->ssb_type = nr_ssb_type_C;
|
||||
else
|
||||
AssertFatal(1==0,"NR Operating Band n%d not available for SS block SCS with mu=%d\n", fp->nr_band, mu);
|
||||
while(nr_ssb_table[idx][0]!=fp->nr_band ||
|
||||
nr_ssb_table[idx][1]!=30) {
|
||||
AssertFatal(nr_ssb_table[idx][0]<=fp->nr_band,"SCS %d not applicable to band %d\n",
|
||||
fp->subcarrier_spacing,fp->nr_band);
|
||||
idx++;
|
||||
}
|
||||
fp->ssb_type = nr_ssb_table[idx][2];
|
||||
break;
|
||||
|
||||
case NR_MU_2: //60kHz scs
|
||||
|
||||
@@ -409,6 +409,7 @@ void init_nr_transport(PHY_VARS_gNB *gNB);
|
||||
void init_dfts(void);
|
||||
|
||||
void fill_subframe_mask(PHY_VARS_eNB *eNB);
|
||||
void init_DLSCH_struct(PHY_VARS_gNB *gNB, processingData_L1tx_t *msg);
|
||||
|
||||
/** @} */
|
||||
#endif
|
||||
|
||||
@@ -50,8 +50,6 @@
|
||||
//#define DEBUG_DCI_DECODING 1
|
||||
//#define DEBUG_PHY
|
||||
|
||||
//#undef ALL_AGGREGATION
|
||||
|
||||
//extern uint16_t phich_reg[MAX_NUM_PHICH_GROUPS][3];
|
||||
//extern uint16_t pcfich_reg[4];
|
||||
|
||||
|
||||
@@ -32,11 +32,8 @@
|
||||
#ifndef __DCI_NB_IOT_H__
|
||||
#define __DCI_NB_IOT_H__
|
||||
|
||||
//#ifndef USER_MODE
|
||||
//#include "PHY/types.h"
|
||||
//#else
|
||||
#include <stdint.h>
|
||||
//#endif
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
||||
@@ -1125,7 +1125,7 @@ void send_IF5(RU_t *ru, openair0_timestamp proc_timestamp, int tti, uint8_t *seq
|
||||
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_IF0, 1 );
|
||||
clock_gettime( CLOCK_MONOTONIC, &start_comp);
|
||||
ru->ifdevice.trx_write_func2(&ru->ifdevice,
|
||||
(proc_timestamp + packet_id*spp_eth-500)*(30720/spsf),
|
||||
(proc_timestamp + packet_id*spp_eth-600)*(30720/spsf),
|
||||
(void*)txp[aid],
|
||||
spp_eth,
|
||||
aid,
|
||||
|
||||
@@ -36,10 +36,8 @@
|
||||
#include "PHY/extern.h"
|
||||
#include "SCHED/extern.h"
|
||||
|
||||
#ifdef OPENAIR2
|
||||
#include "openair2/LAYER2/MAC/proto.h"
|
||||
#include "openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
|
||||
#endif
|
||||
|
||||
extern int mac_get_rrc_status(uint8_t Mod_id,uint8_t eNB_flag,uint8_t index);
|
||||
|
||||
@@ -434,10 +432,8 @@ int dump_ue_stats(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,char *buffer, int length
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef OPENAIR2
|
||||
RRC_status = mac_UE_get_rrc_status(ue->Mod_id, 0);
|
||||
len += sprintf(&buffer[len],"[UE PROC] RRC status = %d\n",RRC_status);
|
||||
#endif
|
||||
len += sprintf(&buffer[len], "[UE PROC] Transmission Mode %d \n",ue->transmission_mode[eNB]);
|
||||
len += sprintf(&buffer[len], "[UE PROC] PBCH err conseq %d, PBCH error total %d, PBCH FER %d\n",
|
||||
ue->pbch_vars[eNB]->pdu_errors_conseq,
|
||||
|
||||
@@ -321,4 +321,4 @@ HLC_subband_cqi_mcs_CBA_20MHz_NB_IoT;
|
||||
#define MAX_ACK_PAYLOAD_NB_IoT 18
|
||||
#define MAX_RI_PAYLOAD_NB_IoT 6
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -50,9 +50,6 @@
|
||||
//#define DEBUG_DCI_DECODING 1
|
||||
//#define DEBUG_PHY
|
||||
|
||||
//#undef ALL_AGGREGATION
|
||||
|
||||
|
||||
uint16_t extract_crc(uint8_t *dci,uint8_t dci_len)
|
||||
{
|
||||
|
||||
@@ -2802,7 +2799,6 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
|
||||
if (dci_cnt>old_dci_cnt)
|
||||
return(dci_cnt);
|
||||
|
||||
//#ifdef ALL_AGGREGATION
|
||||
// Now check UE_SPEC format 1 search spaces at aggregation 8
|
||||
old_dci_cnt=dci_cnt;
|
||||
dci_decoding_procedure0(pdcch_vars,0,mode,subframe,
|
||||
@@ -2836,7 +2832,6 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
|
||||
if (dci_cnt>old_dci_cnt)
|
||||
return(dci_cnt);
|
||||
|
||||
//#endif //ALL_AGGREGATION
|
||||
} else if (tmode == 3) {
|
||||
|
||||
|
||||
@@ -2946,7 +2941,6 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
|
||||
if (dci_cnt>old_dci_cnt)
|
||||
return(dci_cnt);
|
||||
|
||||
//#ifdef ALL_AGGREGATION
|
||||
// Now check UE_SPEC format 2_2A search spaces at aggregation 8
|
||||
LOG_D(PHY," Now check UE_SPEC format 2_2A search spaces at aggregation 8 dci length: %d[bits] %d[bytes]\n",format2A_size_bits,format2A_size_bytes);
|
||||
old_dci_cnt=dci_cnt;
|
||||
@@ -3082,7 +3076,6 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
|
||||
if (dci_cnt>old_dci_cnt)
|
||||
return(dci_cnt);
|
||||
|
||||
//#ifdef ALL_AGGREGATION
|
||||
// Now check UE_SPEC format 2_2A search spaces at aggregation 8
|
||||
old_dci_cnt=dci_cnt;
|
||||
dci_decoding_procedure0(pdcch_vars,0,mode,
|
||||
@@ -3214,7 +3207,6 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
|
||||
if (dci_cnt>old_dci_cnt)
|
||||
return(dci_cnt);
|
||||
|
||||
//#ifdef ALL_AGGREGATION
|
||||
|
||||
// Now check UE_SPEC format 1E_2A_M10PRB search spaces at aggregation 8
|
||||
old_dci_cnt=dci_cnt;
|
||||
@@ -3249,7 +3241,6 @@ uint16_t dci_decoding_procedure(PHY_VARS_UE *ue,
|
||||
if (dci_cnt>old_dci_cnt)
|
||||
return(dci_cnt);
|
||||
|
||||
//#endif //ALL_AGGREGATION
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,6 @@
|
||||
#include <cblas.h>
|
||||
#include "linear_preprocessing_rec.h"
|
||||
|
||||
#define NOCYGWIN_STATIC
|
||||
//#define DEBUG_MMSE
|
||||
|
||||
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
|
||||
//#define DEBUG_ULSCH_MODULATION
|
||||
|
||||
#ifndef OFDMA_ULSCH
|
||||
void dft_lte(int32_t *z,int32_t *d, int32_t Msc_PUSCH, uint8_t Nsymb)
|
||||
{
|
||||
|
||||
@@ -371,7 +370,6 @@ void dft_lte(int32_t *z,int32_t *d, int32_t Msc_PUSCH, uint8_t Nsymb)
|
||||
// printf("\n");
|
||||
}
|
||||
|
||||
#endif
|
||||
void ulsch_modulation(int32_t **txdataF,
|
||||
short amp,
|
||||
uint32_t frame,
|
||||
@@ -690,57 +688,10 @@ void ulsch_modulation(int32_t **txdataF,
|
||||
|
||||
// Transform Precoding
|
||||
|
||||
#ifdef OFDMA_ULSCH
|
||||
|
||||
for (i=0; i<ulsch_Msymb; i++) {
|
||||
ulsch->z[i] = ulsch->d[i];
|
||||
}
|
||||
|
||||
#else
|
||||
dft_lte(ulsch->z,ulsch->d,Msc_PUSCH,ulsch->Nsymb_pusch);
|
||||
#endif
|
||||
|
||||
DevAssert(txdataF);
|
||||
|
||||
#ifdef OFDMA_ULSCH
|
||||
re_offset0 = frame_parms->first_carrier_offset + (ulsch->harq_processes[harq_pid]->first_rb*12);
|
||||
|
||||
if (re_offset0>frame_parms->ofdm_symbol_size) {
|
||||
re_offset0 -= frame_parms->ofdm_symbol_size;
|
||||
// re_offset0++;
|
||||
}
|
||||
|
||||
// printf("re_offset0 %d\n",re_offset0);
|
||||
|
||||
|
||||
for (j=0,l=0; l<(nsymb-ulsch->srs_active); l++) {
|
||||
re_offset = re_offset0;
|
||||
symbol_offset = (int)frame_parms->ofdm_symbol_size*(l+(subframe*nsymb));
|
||||
#ifdef DEBUG_ULSCH_MODULATION
|
||||
printf("symbol %d (subframe %d): symbol_offset %d\n",l,subframe,symbol_offset);
|
||||
#endif
|
||||
txptr = &txdataF[0][symbol_offset];
|
||||
|
||||
if (((frame_parms->Ncp == 0) && ((l==3) || (l==10)))||
|
||||
((frame_parms->Ncp == 1) && ((l==2) || (l==8)))) {
|
||||
}
|
||||
// Skip reference symbols
|
||||
else {
|
||||
|
||||
// printf("copying %d REs\n",Msc_PUSCH);
|
||||
for (i=0; i<Msc_PUSCH; i++,j++) {
|
||||
#ifdef DEBUG_ULSCH_MODULATION
|
||||
printf("re_offset %d (%p): %d,%d\n", re_offset,&ulsch->z[j],((int16_t*)&ulsch->z[j])[0],((int16_t*)&ulsch->z[j])[1]);
|
||||
#endif
|
||||
txptr[re_offset++] = ulsch->z[j];
|
||||
|
||||
if (re_offset==frame_parms->ofdm_symbol_size)
|
||||
re_offset = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# else // OFDMA_ULSCH = 0
|
||||
re_offset0 = frame_parms->first_carrier_offset + (ulsch->harq_processes[harq_pid]->first_rb*12);
|
||||
|
||||
if (re_offset0>frame_parms->ofdm_symbol_size) {
|
||||
@@ -777,8 +728,5 @@ void ulsch_modulation(int32_t **txdataF,
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_MODULATION, VCD_FUNCTION_OUT);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -129,18 +129,14 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
|
||||
rxdata_ptr = (int16_t *)tmp_dft_in;
|
||||
}
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(&ue->rx_dft_stats);
|
||||
#endif
|
||||
|
||||
dft(dftsize,
|
||||
rxdata_ptr,
|
||||
(int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],
|
||||
1);
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(&ue->rx_dft_stats);
|
||||
#endif
|
||||
|
||||
int symb_offset = (Ns%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot;
|
||||
int32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation[0])[symbol+symb_offset];
|
||||
@@ -249,18 +245,14 @@ int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue,
|
||||
|
||||
}
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(&ue->rx_dft_stats);
|
||||
#endif
|
||||
|
||||
dft(dftsize,
|
||||
rxdata_ptr,
|
||||
(int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],
|
||||
1);
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(&ue->rx_dft_stats);
|
||||
#endif
|
||||
|
||||
int symb_offset = (Ns%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot;
|
||||
int32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation[0])[symbol + symb_offset];
|
||||
@@ -370,9 +362,9 @@ void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms,
|
||||
|
||||
int16_t *shift_rot = frame_parms->timeshift_symbol_rotation;
|
||||
|
||||
multadd_cpx_vector((int16_t *)&rxdataF[frame_parms->ofdm_symbol_size*symbol],
|
||||
multadd_cpx_vector((int16_t *)&rxdataF[soffset+(frame_parms->ofdm_symbol_size*symbol)],
|
||||
shift_rot,
|
||||
(int16_t *)&rxdataF[frame_parms->ofdm_symbol_size*symbol],
|
||||
(int16_t *)&rxdataF[soffset+(frame_parms->ofdm_symbol_size*symbol)],
|
||||
1,
|
||||
length,
|
||||
15);
|
||||
|
||||
@@ -73,8 +73,9 @@ void dump_nr_I0_stats(FILE *fd,PHY_VARS_gNB *gNB) {
|
||||
|
||||
int min_I0=1000,max_I0=0;
|
||||
int amin=0,amax=0;
|
||||
fprintf(fd,"Blacklisted PRBs %d/%d\n",gNB->num_ulprbbl,gNB->frame_parms.N_RB_UL);
|
||||
for (int i=0; i<gNB->frame_parms.N_RB_UL; i++) {
|
||||
if (i==(gNB->frame_parms.N_RB_UL>>1) - 1) i+=2;
|
||||
if (gNB->ulprbbl[i] > 0) continue;
|
||||
|
||||
if (gNB->measurements.n0_subband_power_tot_dB[i]<min_I0) {min_I0 = gNB->measurements.n0_subband_power_tot_dB[i]; amin=i;}
|
||||
|
||||
@@ -82,7 +83,8 @@ void dump_nr_I0_stats(FILE *fd,PHY_VARS_gNB *gNB) {
|
||||
}
|
||||
|
||||
for (int i=0; i<gNB->frame_parms.N_RB_UL; i++) {
|
||||
fprintf(fd,"%2d.",gNB->measurements.n0_subband_power_tot_dB[i]-gNB->measurements.n0_subband_power_avg_dB);
|
||||
if (gNB->ulprbbl[i] ==0) fprintf(fd,"%2d.",gNB->measurements.n0_subband_power_tot_dB[i]-gNB->measurements.n0_subband_power_avg_dB);
|
||||
else fprintf(fd," X.");
|
||||
if (i%25 == 24) fprintf(fd,"\n");
|
||||
}
|
||||
fprintf(fd,"\n");
|
||||
@@ -112,7 +114,7 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb
|
||||
for (int s=first_symb;s<(first_symb+num_symb);s++) {
|
||||
for (rb=0; rb<frame_parms->N_RB_UL; rb++) {
|
||||
|
||||
if (s==first_symb) {
|
||||
if (s==first_symb /*&& ((gNB->rb_mask_ul[s][rb>>5]&(1<<(rb&31))) == 0)*/) {
|
||||
nb_symb[rb]=0;
|
||||
for (int aarx=0; aarx<frame_parms->nb_antennas_rx;aarx++)
|
||||
measurements->n0_subband_power[aarx][rb]=0;
|
||||
|
||||
@@ -66,7 +66,7 @@ void nr_init_pdcch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid)
|
||||
|
||||
reset = 1;
|
||||
x2 = ((1<<17) * (fp->symbols_per_slot*slot+symb+1) * ((Nid<<1)+1) + (Nid<<1));
|
||||
LOG_I(PHY,"PDCCH DMRS slot %d, symb %d, Nid %d, x2 %x\n",slot,symb,Nid,x2);
|
||||
LOG_D(PHY,"PDCCH DMRS slot %d, symb %d, Nid %d, x2 %x\n",slot,symb,Nid,x2);
|
||||
for (uint32_t n=0; n<NR_MAX_PDCCH_DMRS_INIT_LENGTH_DWORD; n++) {
|
||||
pdcch_dmrs[slot][symb][n] = lte_gold_generic(&x1, &x2, reset);
|
||||
reset = 0;
|
||||
@@ -92,7 +92,7 @@ void nr_init_pdsch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid)
|
||||
for (uint8_t symb=0; symb<fp->symbols_per_slot; symb++) {
|
||||
reset = 1;
|
||||
x2 = ((1<<17) * (fp->symbols_per_slot*slot+symb+1) * ((N_n_scid[n_scid]<<1)+1) +((N_n_scid[n_scid]<<1)+n_scid));
|
||||
LOG_I(PHY,"PDSCH DMRS slot %d, symb %d x2 %x, N_n_scid %d,n_scid %d\n",slot,symb,x2,N_n_scid[n_scid],n_scid);
|
||||
LOG_D(PHY,"PDSCH DMRS slot %d, symb %d x2 %x, N_n_scid %d,n_scid %d\n",slot,symb,x2,N_n_scid[n_scid],n_scid);
|
||||
for (uint32_t n=0; n<NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD; n++) {
|
||||
pdsch_dmrs[slot][symb][0][n] = lte_gold_generic(&x1, &x2, reset);
|
||||
reset = 0;
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "nr_dlsch.h"
|
||||
#include "nr_sch_dmrs.h"
|
||||
#include "PHY/MODULATION/nr_modulation.h"
|
||||
#include "common/utils/nr/nr_common.h"
|
||||
|
||||
//#define DEBUG_PDCCH_DMRS
|
||||
//#define DEBUG_DCI
|
||||
@@ -97,13 +98,16 @@ void nr_generate_dci(PHY_VARS_gNB *gNB,
|
||||
cset_start_symb = pdcch_pdu_rel15->StartSymbolIndex;
|
||||
cset_nsymb = pdcch_pdu_rel15->DurationSymbols;
|
||||
dci_idx = 0;
|
||||
LOG_D(PHY, "pdcch: Coreset rb_offset %d, nb_rb %d BWP Start %d\n",rb_offset,n_rb,pdcch_pdu_rel15->BWPStart);
|
||||
LOG_D(PHY, "pdcch: Coreset starting subcarrier %d on symbol %d (%d symbols)\n", cset_start_sc, cset_start_symb, cset_nsymb);
|
||||
if (dci_pdu->RNTI != 0xFFFF) {
|
||||
LOG_D(PHY, "pdcch: Coreset rb_offset %d, nb_rb %d BWP Start %d\n",rb_offset,n_rb,pdcch_pdu_rel15->BWPStart);
|
||||
LOG_D(PHY, "pdcch: Coreset starting subcarrier %d on symbol %d (%d symbols)\n", cset_start_sc, cset_start_symb, cset_nsymb);
|
||||
}
|
||||
// DMRS length is per OFDM symbol
|
||||
uint32_t dmrs_length = n_rb*6; //2(QPSK)*3(per RB)*6(REG per CCE)
|
||||
uint32_t encoded_length = dci_pdu->AggregationLevel*108; //2(QPSK)*9(per RB)*6(REG per CCE)
|
||||
if (dci_pdu->RNTI!=0xFFFF) LOG_D(PHY, "DL_DCI : rb_offset %d, nb_rb %d, DMRS length per symbol %d\t DCI encoded length %d (precoder_granularity %d,reg_mapping %d),Scrambling_Id %d,ScramblingRNTI %x,PayloadSizeBits %d\n",
|
||||
rb_offset, n_rb,dmrs_length, encoded_length,pdcch_pdu_rel15->precoderGranularity,pdcch_pdu_rel15->CceRegMappingType,
|
||||
if (dci_pdu->RNTI != 0xFFFF)
|
||||
LOG_D(PHY, "DL_DCI : rb_offset %d, nb_rb %d, DMRS length per symbol %d\t DCI encoded length %d (precoder_granularity %d,reg_mapping %d),Scrambling_Id %d,ScramblingRNTI %x,PayloadSizeBits %d\n",
|
||||
rb_offset, n_rb,dmrs_length, encoded_length,pdcch_pdu_rel15->precoderGranularity,pdcch_pdu_rel15->CceRegMappingType,
|
||||
dci_pdu->ScramblingId,dci_pdu->ScramblingRNTI,dci_pdu->PayloadSizeBits);
|
||||
dmrs_length += rb_offset*6; // To accommodate more DMRS symbols in case of rb offset
|
||||
|
||||
@@ -113,7 +117,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB,
|
||||
nr_modulation(gold_pdcch_dmrs[symb], dmrs_length, DMRS_MOD_ORDER, mod_dmrs[symb]); //Qm = 2 as DMRS is QPSK modulated
|
||||
|
||||
#ifdef DEBUG_PDCCH_DMRS
|
||||
if(dci_pdu->RNTI!=0xFFFF) {
|
||||
if(dci_pdu->RNTI!=0xFFFF) {
|
||||
for (int i=0; i<dmrs_length>>1; i++)
|
||||
printf("symb %d i %d %p gold seq 0x%08x mod_dmrs %d %d\n", symb, i,
|
||||
&gold_pdcch_dmrs[symb][i>>5],gold_pdcch_dmrs[symb][i>>5], mod_dmrs[symb][i<<1], mod_dmrs[symb][(i<<1)+1] );
|
||||
@@ -134,8 +138,8 @@ void nr_generate_dci(PHY_VARS_gNB *gNB,
|
||||
dci_pdu->AggregationLevel,
|
||||
0,NULL);
|
||||
polar_encoder_fast((uint64_t*)dci_pdu->Payload, (void*)encoder_output, n_RNTI,1,currentPtr);
|
||||
#ifdef DEBUG_CHANNEL_CODING
|
||||
printf("polar rnti %x,length %d, L %d\n",n_RNTI, dci_pdu->PayloadSizeBits,pdcch_pdu_rel15->dci_pdu.AggregationLevel[d]);
|
||||
#if DEBUG_CHANNEL_CODING
|
||||
printf("polar rnti %x,length %d, L %d\n",n_RNTI, dci_pdu->PayloadSizeBits,dci_pdu->AggregationLevel);
|
||||
printf("DCI PDU: [0]->0x%lx \t [1]->0x%lx\n",
|
||||
((uint64_t*)dci_pdu->Payload)[0], ((uint64_t*)dci_pdu->Payload)[1]);
|
||||
printf("Encoded Payload (length:%d dwords):\n", encoded_length>>5);
|
||||
@@ -213,7 +217,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB,
|
||||
(amp * mod_dmrs[l][(dmrs_idx << 1) + 1]) >> 15;
|
||||
|
||||
#ifdef DEBUG_PDCCH_DMRS
|
||||
if (dci_pdu->RNTI!=0xFFFF) LOG_D(PHY,"PDCCH DMRS %d: l %d position %d => (%d,%d)\n",dmrs_idx,l,k,((int16_t *)txdataF)[(l*frame_parms->ofdm_symbol_size + k)<<1],
|
||||
LOG_D(PHY,"PDCCH DMRS %d: l %d position %d => (%d,%d)\n",dmrs_idx,l,k,((int16_t *)txdataF)[(l*frame_parms->ofdm_symbol_size + k)<<1],
|
||||
((int16_t *)txdataF)[((l*frame_parms->ofdm_symbol_size + k)<<1)+1]);
|
||||
#endif
|
||||
|
||||
@@ -225,7 +229,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB,
|
||||
((int16_t *) txdataF)[((l * frame_parms->ofdm_symbol_size + k) << 1) + 1] =
|
||||
(amp * mod_dci[(dci_idx << 1) + 1]) >> 15;
|
||||
#ifdef DEBUG_DCI
|
||||
if (dci_pdu->RNTI!=0xFFFF) LOG_D(PHY,"PDCCH: l %d position %d => (%d,%d)\n",l,k,((int16_t *)txdataF)[(l*frame_parms->ofdm_symbol_size + k)<<1],
|
||||
LOG_D(PHY,"PDCCH: l %d position %d => (%d,%d)\n",l,k,((int16_t *)txdataF)[(l*frame_parms->ofdm_symbol_size + k)<<1],
|
||||
((int16_t *)txdataF)[((l*frame_parms->ofdm_symbol_size + k)<<1)+1]);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -59,6 +59,4 @@ void nr_fill_ul_dci(PHY_VARS_gNB *gNB,
|
||||
|
||||
void nr_fill_cce_list(PHY_VARS_gNB *gNB, uint8_t m,nfapi_nr_dl_tti_pdcch_pdu_rel15_t *);
|
||||
|
||||
void get_coreset_rballoc(uint8_t *FreqDomainResource,int *n_rb,int *rb_offset);
|
||||
|
||||
#endif //__PHY_NR_TRANSPORT_DCI__H
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
*/
|
||||
|
||||
#include "nr_dci.h"
|
||||
#include "common/utils/nr/nr_common.h"
|
||||
|
||||
//#define DEBUG_FILL_DCI
|
||||
|
||||
@@ -202,107 +203,3 @@ void nr_fill_cce_list(PHY_VARS_gNB *gNB, uint8_t m, nfapi_nr_dl_tti_pdcch_pdu_r
|
||||
ret |= ((field>>i)&1)<<(size-i-1);
|
||||
return ret;
|
||||
}*/
|
||||
int16_t find_nr_pdcch(int frame,int slot, PHY_VARS_gNB *gNB,find_type_t type) {
|
||||
|
||||
uint16_t i;
|
||||
int16_t first_free_index=-1;
|
||||
|
||||
AssertFatal(gNB!=NULL,"gNB is null\n");
|
||||
for (i=0; i<NUMBER_OF_NR_PDCCH_MAX; i++) {
|
||||
LOG_D(PHY,"searching for frame.slot %d.%d : pdcch_index %d frame.slot %d.%d, first_free_index %d\n", frame,slot,i,gNB->pdcch_pdu[i].frame,gNB->pdcch_pdu[i].slot,first_free_index);
|
||||
if ((gNB->pdcch_pdu[i].frame == frame) &&
|
||||
(gNB->pdcch_pdu[i].slot==slot)) return i;
|
||||
else if ( gNB->pdcch_pdu[i].frame==-1 && first_free_index==-1) first_free_index=i;
|
||||
}
|
||||
if (type == SEARCH_EXIST) return -1;
|
||||
|
||||
return first_free_index;
|
||||
}
|
||||
|
||||
|
||||
void nr_fill_dci(PHY_VARS_gNB *gNB,
|
||||
int frame,
|
||||
int slot,
|
||||
nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu) {
|
||||
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = &pdcch_pdu->pdcch_pdu_rel15;
|
||||
NR_gNB_DLSCH_t *dlsch;
|
||||
|
||||
int pdcch_id = find_nr_pdcch(frame,slot,gNB,SEARCH_EXIST_OR_FREE);
|
||||
AssertFatal(pdcch_id>=0 && pdcch_id<NUMBER_OF_NR_PDCCH_MAX,"Cannot find space for PDCCH, exiting\n");
|
||||
memcpy((void*)&gNB->pdcch_pdu[pdcch_id].pdcch_pdu,(void*)pdcch_pdu,sizeof(*pdcch_pdu));
|
||||
gNB->pdcch_pdu[pdcch_id].frame = frame;
|
||||
gNB->pdcch_pdu[pdcch_id].slot = slot;
|
||||
|
||||
for (int i=0;i<pdcch_pdu_rel15->numDlDci;i++) {
|
||||
|
||||
//uint64_t *dci_pdu = (uint64_t*)pdcch_pdu_rel15->dci_pdu[i].Payload;
|
||||
|
||||
int dlsch_id = find_nr_dlsch(pdcch_pdu_rel15->dci_pdu[i].RNTI,gNB,SEARCH_EXIST_OR_FREE);
|
||||
if( (dlsch_id<0) || (dlsch_id>=gNB->number_of_nr_dlsch_max) ){
|
||||
LOG_E(PHY,"illegal dlsch_id found!!! rnti %04x dlsch_id %d\n",(unsigned int)pdcch_pdu_rel15->dci_pdu[i].RNTI,dlsch_id);
|
||||
return;
|
||||
}
|
||||
|
||||
dlsch = gNB->dlsch[dlsch_id][0];
|
||||
int harq_pid = 0;
|
||||
|
||||
dlsch->slot_tx[slot] = 1;
|
||||
dlsch->harq_ids[frame % 2][slot] = 0;
|
||||
AssertFatal(harq_pid < 8 && harq_pid >= 0,
|
||||
"illegal harq_pid %d\n",harq_pid);
|
||||
|
||||
dlsch->harq_mask |= (1<<harq_pid);
|
||||
dlsch->rnti = pdcch_pdu_rel15->dci_pdu[i].RNTI;
|
||||
|
||||
// nr_fill_cce_list(gNB,0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
int16_t find_nr_ul_dci(int frame,int slot, PHY_VARS_gNB *gNB,find_type_t type) {
|
||||
|
||||
uint16_t i;
|
||||
int16_t first_free_index=-1;
|
||||
|
||||
AssertFatal(gNB!=NULL,"gNB is null\n");
|
||||
for (i=0; i<NUMBER_OF_NR_PDCCH_MAX; i++) {
|
||||
LOG_D(PHY,"searching for frame.slot %d.%d : ul_pdcch_index %d frame.slot %d.%d, first_free_index %d\n", frame,slot,i,gNB->ul_pdcch_pdu[i].frame,gNB->ul_pdcch_pdu[i].slot,first_free_index);
|
||||
if ((gNB->ul_pdcch_pdu[i].frame == frame) &&
|
||||
(gNB->ul_pdcch_pdu[i].slot==slot)) return i;
|
||||
else if (gNB->ul_pdcch_pdu[i].frame==-1 && first_free_index==-1) first_free_index=i;
|
||||
}
|
||||
if (type == SEARCH_EXIST) return -1;
|
||||
|
||||
return first_free_index;
|
||||
}
|
||||
|
||||
|
||||
void nr_fill_ul_dci(PHY_VARS_gNB *gNB,
|
||||
int frame,
|
||||
int slot,
|
||||
nfapi_nr_ul_dci_request_pdus_t *pdcch_pdu) {
|
||||
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15 = &pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15;
|
||||
|
||||
int pdcch_id = find_nr_ul_dci(frame,slot,gNB,SEARCH_EXIST_OR_FREE);
|
||||
AssertFatal(pdcch_id>=0 && pdcch_id<NUMBER_OF_NR_PDCCH_MAX,"Cannot find space for UL PDCCH, exiting\n");
|
||||
memcpy((void*)&gNB->ul_pdcch_pdu[pdcch_id].pdcch_pdu,(void*)pdcch_pdu,sizeof(*pdcch_pdu));
|
||||
gNB->ul_pdcch_pdu[pdcch_id].frame = frame;
|
||||
gNB->ul_pdcch_pdu[pdcch_id].slot = slot;
|
||||
|
||||
for (int i=0;i<pdcch_pdu_rel15->numDlDci;i++) {
|
||||
|
||||
//uint64_t *dci_pdu = (uint64_t*)pdcch_pdu_rel15->dci_pdu[i].Payload;
|
||||
|
||||
// if there's no DL DCI then generate CCE list
|
||||
// nr_fill_cce_list(gNB,0);
|
||||
/*
|
||||
LOG_D(PHY, "DCI PDU: [0]->0x%lx \t [1]->0x%lx \n",dci_pdu[0], dci_pdu[1]);
|
||||
LOG_D(PHY, "DCI type %d payload (size %d) generated on candidate %d\n", dci_alloc->pdcch_params.dci_format, dci_alloc->size, cand_idx);
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/*! \file PHY/NR_TRANSPORT/nr_dci_tools_common.c
|
||||
* \brief
|
||||
* \author
|
||||
* \date 2018
|
||||
* \version 0.1
|
||||
* \company Eurecom
|
||||
* \email:
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
|
||||
#include "nr_dci.h"
|
||||
|
||||
//#define DEBUG_FILL_DCI
|
||||
|
||||
#include "nr_dlsch.h"
|
||||
|
||||
|
||||
void get_coreset_rballoc(uint8_t *FreqDomainResource,int *n_rb,int *rb_offset) {
|
||||
|
||||
uint8_t count=0, start=0, start_set=0;
|
||||
|
||||
uint64_t bitmap = (((uint64_t)FreqDomainResource[0])<<37)|
|
||||
(((uint64_t)FreqDomainResource[1])<<29)|
|
||||
(((uint64_t)FreqDomainResource[2])<<21)|
|
||||
(((uint64_t)FreqDomainResource[3])<<13)|
|
||||
(((uint64_t)FreqDomainResource[4])<<5)|
|
||||
(((uint64_t)FreqDomainResource[5])>>3);
|
||||
|
||||
for (int i=0; i<45; i++)
|
||||
if ((bitmap>>(44-i))&1) {
|
||||
count++;
|
||||
if (!start_set) {
|
||||
start = i;
|
||||
start_set = 1;
|
||||
}
|
||||
}
|
||||
*rb_offset = 6*start;
|
||||
*n_rb = 6*count;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include "PHY/NR_REFSIG/dmrs_nr.h"
|
||||
#include "PHY/NR_REFSIG/ptrs_nr.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
#include "common/utils/nr/nr_common.h"
|
||||
|
||||
//#define DEBUG_DLSCH
|
||||
//#define DEBUG_DLSCH_MAPPING
|
||||
@@ -111,10 +111,11 @@ void nr_pdsch_codeword_scrambling_optim(uint8_t *in,
|
||||
}
|
||||
|
||||
|
||||
uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
|
||||
int frame,
|
||||
int slot) {
|
||||
void nr_generate_pdsch(processingData_L1tx_t *msgTx,
|
||||
int frame,
|
||||
int slot) {
|
||||
|
||||
PHY_VARS_gNB *gNB = msgTx->gNB;
|
||||
NR_gNB_DLSCH_t *dlsch;
|
||||
uint32_t ***pdsch_dmrs = gNB->nr_gold_pdsch_dmrs[slot];
|
||||
int32_t** txdataF = gNB->common_vars.txdataF;
|
||||
@@ -132,9 +133,8 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
|
||||
time_stats_t *dlsch_interleaving_stats=&gNB->dlsch_interleaving_stats;
|
||||
time_stats_t *dlsch_segmentation_stats=&gNB->dlsch_segmentation_stats;
|
||||
|
||||
for (int dlsch_id=0;dlsch_id<gNB->number_of_nr_dlsch_max;dlsch_id++) {
|
||||
dlsch = gNB->dlsch[dlsch_id][0];
|
||||
if (dlsch->slot_tx[slot] == 0) continue;
|
||||
for (int dlsch_id=0; dlsch_id<msgTx->num_pdsch_slot; dlsch_id++) {
|
||||
dlsch = msgTx->dlsch[dlsch_id][0];
|
||||
|
||||
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
|
||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &harq->pdsch_pdu.pdsch_pdu_rel15;
|
||||
@@ -183,11 +183,12 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
|
||||
/// CRC, coding, interleaving and rate matching
|
||||
AssertFatal(harq->pdu!=NULL,"harq->pdu is null\n");
|
||||
start_meas(dlsch_encoding_stats);
|
||||
nr_dlsch_encoding(gNB,
|
||||
harq->pdu, frame, slot, dlsch, frame_parms,tinput,tprep,tparity,toutput,
|
||||
dlsch_rate_matching_stats,
|
||||
dlsch_interleaving_stats,
|
||||
dlsch_segmentation_stats);
|
||||
if (nr_dlsch_encoding(gNB,
|
||||
harq->pdu, frame, slot, dlsch, frame_parms,tinput,tprep,tparity,toutput,
|
||||
dlsch_rate_matching_stats,
|
||||
dlsch_interleaving_stats,
|
||||
dlsch_segmentation_stats) == -1)
|
||||
return;
|
||||
stop_meas(dlsch_encoding_stats);
|
||||
#ifdef DEBUG_DLSCH
|
||||
printf("PDSCH encoding:\nPayload:\n");
|
||||
@@ -281,20 +282,21 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
|
||||
start_sc, rel15->StartSymbolIndex, rel15->rbSize, nb_re,rel15->nrOfLayers);
|
||||
#endif
|
||||
|
||||
for (int ap=0; ap<rel15->nrOfLayers; ap++) {
|
||||
for (int nl=0; nl<rel15->nrOfLayers; nl++) {
|
||||
|
||||
// DMRS params for this ap
|
||||
get_Wt(Wt, ap, dmrs_Type);
|
||||
get_Wf(Wf, ap, dmrs_Type);
|
||||
delta = get_delta(ap, dmrs_Type);
|
||||
l_prime = 0; // single symbol ap 0
|
||||
int dmrs_port = get_dmrs_port(nl,rel15->dmrsPorts);
|
||||
// DMRS params for this dmrs port
|
||||
get_Wt(Wt, dmrs_port, dmrs_Type);
|
||||
get_Wf(Wf, dmrs_port, dmrs_Type);
|
||||
delta = get_delta(dmrs_port, dmrs_Type);
|
||||
l_prime = 0; // single symbol nl 0
|
||||
l0 = get_l0(rel15->dlDmrsSymbPos);
|
||||
l_overline = l0;
|
||||
|
||||
#ifdef DEBUG_DLSCH_MAPPING
|
||||
uint8_t dmrs_symbol = l0+l_prime;
|
||||
printf("DMRS Type %d params for ap %d: Wt %d %d \t Wf %d %d \t delta %d \t l_prime %d \t l0 %d\tDMRS symbol %d\n",
|
||||
1+dmrs_Type,ap, Wt[0], Wt[1], Wf[0], Wf[1], delta, l_prime, l0, dmrs_symbol);
|
||||
printf("DMRS Type %d params for nl %d: Wt %d %d \t Wf %d %d \t delta %d \t l_prime %d \t l0 %d\tDMRS symbol %d\n",
|
||||
1+dmrs_Type,nl, Wt[0], Wt[1], Wf[0], Wf[1], delta, l_prime, l0, dmrs_symbol);
|
||||
#endif
|
||||
|
||||
uint16_t m=0, dmrs_idx=0;
|
||||
@@ -368,7 +370,7 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
|
||||
if(ptrs_symbol){
|
||||
is_ptrs_re = is_ptrs_subcarrier(k,
|
||||
rel15->rnti,
|
||||
ap,
|
||||
nl,
|
||||
rel15->dmrsConfigType,
|
||||
rel15->PTRSFreqDensity,
|
||||
rel15->rbSize,
|
||||
@@ -379,12 +381,12 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
|
||||
|
||||
/* Map DMRS Symbol */
|
||||
if ( ( dmrs_symbol_map & (1 << l) ) && (k == ((start_sc+get_dmrs_freq_idx(n, k_prime, delta, dmrs_Type))%(frame_parms->ofdm_symbol_size)))) {
|
||||
txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[dmrs_idx<<1]) >> 15;
|
||||
txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15;
|
||||
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[dmrs_idx<<1]) >> 15;
|
||||
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (Wt[l_prime]*Wf[k_prime]*amp*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15;
|
||||
#ifdef DEBUG_DLSCH_MAPPING
|
||||
printf("dmrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t txdataF: %d %d\n",
|
||||
dmrs_idx, l, k, k_prime, n, txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)],
|
||||
txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)]);
|
||||
dmrs_idx, l, k, k_prime, n, txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)],
|
||||
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)]);
|
||||
#endif
|
||||
dmrs_idx++;
|
||||
k_prime++;
|
||||
@@ -393,30 +395,30 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
|
||||
}
|
||||
/* Map PTRS Symbol */
|
||||
else if(is_ptrs_re){
|
||||
txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (beta_ptrs*amp*mod_ptrs[ptrs_idx<<1]) >> 15;
|
||||
txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (beta_ptrs*amp*mod_ptrs[(ptrs_idx<<1) + 1])>> 15;
|
||||
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (beta_ptrs*amp*mod_ptrs[ptrs_idx<<1]) >> 15;
|
||||
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (beta_ptrs*amp*mod_ptrs[(ptrs_idx<<1) + 1])>> 15;
|
||||
#ifdef DEBUG_DLSCH_MAPPING
|
||||
printf("ptrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t txdataF: %d %d\n",
|
||||
ptrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)],
|
||||
((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)]);
|
||||
ptrs_idx, l, k, k_prime, n, ((int16_t*)txdataF_precoding[nl])[((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)],
|
||||
((int16_t*)txdataF_precoding[nl])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)]);
|
||||
#endif
|
||||
ptrs_idx++;
|
||||
}
|
||||
/* Map DATA Symbol */
|
||||
else if( (!(dmrs_symbol_map & (1 << l))) || allowed_xlsch_re_in_dmrs_symbol(k,start_sc,frame_parms->ofdm_symbol_size,rel15->numDmrsCdmGrpsNoData,dmrs_Type)) {
|
||||
txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (amp * tx_layers[ap][m<<1]) >> 15;
|
||||
txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (amp * tx_layers[ap][(m<<1) + 1]) >> 15;
|
||||
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = (amp * tx_layers[nl][m<<1]) >> 15;
|
||||
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = (amp * tx_layers[nl][(m<<1) + 1]) >> 15;
|
||||
#ifdef DEBUG_DLSCH_MAPPING
|
||||
printf("m %d\t l %d \t k %d \t txdataF: %d %d\n",
|
||||
m, l, k, txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)],
|
||||
txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)]);
|
||||
m, l, k, txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)],
|
||||
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)]);
|
||||
#endif
|
||||
m++;
|
||||
}
|
||||
/* mute RE */
|
||||
else {
|
||||
txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = 0;
|
||||
txdataF_precoding[ap][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = 0;
|
||||
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + (2*txdataF_offset)] = 0;
|
||||
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1 + (2*txdataF_offset)] = 0;
|
||||
}
|
||||
if (++k >= frame_parms->ofdm_symbol_size)
|
||||
k -= frame_parms->ofdm_symbol_size;
|
||||
@@ -524,9 +526,6 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
|
||||
LOG_D(PHY,"beam index for PDSCH allocation already taken\n");
|
||||
}
|
||||
}// dlsch loop
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void dump_pdsch_stats(FILE *fd,PHY_VARS_gNB *gNB) {
|
||||
|
||||
@@ -63,15 +63,13 @@ void nr_pdsch_codeword_scrambling(uint8_t *in,
|
||||
uint32_t n_RNTI,
|
||||
uint32_t* out);
|
||||
|
||||
void nr_fill_dlsch(PHY_VARS_gNB *gNB,
|
||||
int frame,
|
||||
int slot,
|
||||
void nr_fill_dlsch(processingData_L1tx_t *msgTx,
|
||||
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
|
||||
unsigned char *sdu);
|
||||
|
||||
uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
|
||||
int frame,
|
||||
int slot);
|
||||
void nr_generate_pdsch(processingData_L1tx_t *msgTx,
|
||||
int frame,
|
||||
int slot);
|
||||
void free_gNB_dlsch(NR_gNB_DLSCH_t **dlschptr, uint16_t N_RB);
|
||||
|
||||
void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch);
|
||||
|
||||
@@ -39,10 +39,10 @@
|
||||
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_dlsch.h"
|
||||
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
#include "SCHED_NR/sched_nr.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/utils/nr/nr_common.h"
|
||||
#include <syscall.h>
|
||||
#include <openair2/UTIL/OPT/opt.h>
|
||||
|
||||
@@ -427,17 +427,19 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
|
||||
Tbslbrm = nr_compute_tbslbrm(rel15->mcsTable[0],nb_rb,Nl);
|
||||
|
||||
start_meas(dlsch_rate_matching_stats);
|
||||
nr_rate_matching_ldpc(Ilbrm,
|
||||
Tbslbrm,
|
||||
harq->BG,
|
||||
*Zc,
|
||||
harq->d[r],
|
||||
harq->e+r_offset,
|
||||
harq->C,
|
||||
F,
|
||||
Kr-F-2*(*Zc),
|
||||
rel15->rvIndex[0],
|
||||
E);
|
||||
if (nr_rate_matching_ldpc(Ilbrm,
|
||||
Tbslbrm,
|
||||
harq->BG,
|
||||
*Zc,
|
||||
harq->d[r],
|
||||
harq->e+r_offset,
|
||||
harq->C,
|
||||
F,
|
||||
Kr-F-2*(*Zc),
|
||||
rel15->rvIndex[0],
|
||||
E) == -1)
|
||||
return -1;
|
||||
|
||||
stop_meas(dlsch_rate_matching_stats);
|
||||
#ifdef DEBUG_DLSCH_CODING
|
||||
for (int i =0; i<16; i++)
|
||||
|
||||
@@ -254,48 +254,16 @@ void nr_emulate_dlsch_payload(uint8_t* pdu, uint16_t size) {
|
||||
*(pdu+i) = (uint8_t)rand();
|
||||
}
|
||||
|
||||
int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type) {
|
||||
|
||||
uint16_t i;
|
||||
int16_t first_free_index=-1;
|
||||
|
||||
AssertFatal(gNB!=NULL,"gNB is null\n");
|
||||
for (i=0; i<gNB->number_of_nr_dlsch_max; i++) {
|
||||
AssertFatal(gNB->dlsch[i]!=NULL,"gNB->dlsch[%d] is null\n",i);
|
||||
AssertFatal(gNB->dlsch[i][0]!=NULL,"gNB->dlsch[%d][0] is null\n",i);
|
||||
LOG_D(PHY,"searching for rnti %x : dlsch_index %d=> harq_mask %x, rnti %x, first_free_index %d\n", rnti,i,
|
||||
gNB->dlsch[i][0]->harq_mask,gNB->dlsch[i][0]->rnti,first_free_index);
|
||||
if ((gNB->dlsch[i][0]->harq_mask >0) &&
|
||||
(gNB->dlsch[i][0]->rnti==rnti)) return i;
|
||||
else if ((gNB->dlsch[i][0]->harq_mask == 0) && (first_free_index==-1)) first_free_index=i;
|
||||
}
|
||||
if (type == SEARCH_EXIST) return -1;
|
||||
if (first_free_index != -1)
|
||||
gNB->dlsch[first_free_index][0]->rnti = 0;
|
||||
return first_free_index;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void nr_fill_dlsch(PHY_VARS_gNB *gNB,
|
||||
int frame,
|
||||
int slot,
|
||||
void nr_fill_dlsch(processingData_L1tx_t *msgTx,
|
||||
nfapi_nr_dl_tti_pdsch_pdu *pdsch_pdu,
|
||||
uint8_t *sdu) {
|
||||
|
||||
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &pdsch_pdu->pdsch_pdu_rel15;
|
||||
|
||||
int dlsch_id = find_nr_dlsch(rel15->rnti,gNB,SEARCH_EXIST);
|
||||
AssertFatal( (dlsch_id>=0) && (dlsch_id<gNB->number_of_nr_dlsch_max),
|
||||
"illegal or no dlsch_id found!!! rnti %04x dlsch_id %d\n",rel15->rnti,dlsch_id);
|
||||
NR_gNB_DLSCH_t *dlsch = gNB->dlsch[dlsch_id][0];
|
||||
NR_gNB_DLSCH_t *dlsch = msgTx->dlsch[msgTx->num_pdsch_slot][0];
|
||||
NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
|
||||
/// DLSCH struct
|
||||
memcpy((void*)&harq->pdsch_pdu, (void*)pdsch_pdu, sizeof(nfapi_nr_dl_tti_pdsch_pdu));
|
||||
gNB->num_pdsch_rnti[slot]++;
|
||||
msgTx->num_pdsch_slot++;
|
||||
AssertFatal(sdu!=NULL,"sdu is null\n");
|
||||
harq->pdu = sdu;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h"
|
||||
#include "T.h"
|
||||
|
||||
|
||||
|
||||
@@ -92,6 +92,6 @@ uint8_t get_l0(uint16_t dlDmrsSymbPos) {
|
||||
if ((mask&1) == 1) break;
|
||||
mask>>=1;
|
||||
}
|
||||
AssertFatal(l0 < 4,"impossible l0 %d\n",l0);
|
||||
AssertFatal(l0 < 4,"impossible l0 %d, dlDmrsSymbPos %x\n",l0,dlDmrsSymbPos);
|
||||
return (l0);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
|
||||
#include "PHY/defs_nr_common.h"
|
||||
#include "PHY/defs_gNB.h"
|
||||
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
|
||||
#define NR_PBCH_PDU_BITS 24
|
||||
|
||||
@@ -315,6 +314,7 @@ int nr_find_pucch(uint16_t rnti,
|
||||
void init_prach_list(PHY_VARS_gNB *gNB);
|
||||
void init_prach_ru_list(RU_t *ru);
|
||||
void free_nr_ru_prach_entry(RU_t *ru, int prach_id);
|
||||
uint8_t get_nr_prach_duration(uint8_t prach_format);
|
||||
|
||||
void nr_generate_csi_rs(PHY_VARS_gNB *gNB,
|
||||
int16_t amp,
|
||||
|
||||
@@ -306,8 +306,8 @@ void nr_processULSegment(void* arg) {
|
||||
int max_ldpc_iterations = p_decoderParms->numMaxIter;
|
||||
int8_t llrProcBuf[OAI_UL_LDPC_MAX_NUM_LLR] __attribute__ ((aligned(32)));
|
||||
|
||||
int16_t z [68*384];
|
||||
int8_t l [68*384];
|
||||
int16_t z [68*384 + 16] __attribute__ ((aligned(16)));
|
||||
int8_t l [68*384 + 16] __attribute__ ((aligned(16)));
|
||||
|
||||
__m128i *pv = (__m128i*)&z;
|
||||
__m128i *pl = (__m128i*)&l;
|
||||
@@ -368,10 +368,10 @@ void nr_processULSegment(void* arg) {
|
||||
ulsch_harq->e[r],
|
||||
ulsch_harq->C,
|
||||
rv_index,
|
||||
(ulsch_harq->round==0)?1:0,
|
||||
ulsch_harq->new_rx,
|
||||
E,
|
||||
ulsch_harq->F,
|
||||
Kr-ulsch_harq->F-2*(p_decoderParms->Z))==-1) {
|
||||
ulsch_harq->F,
|
||||
Kr-ulsch_harq->F-2*(p_decoderParms->Z))==-1) {
|
||||
|
||||
stop_meas(&phy_vars_gNB->ulsch_rate_unmatching_stats);
|
||||
|
||||
@@ -505,9 +505,21 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_ULSCH_DECODING,1);
|
||||
harq_process->TBS = pusch_pdu->pusch_data.tb_size;
|
||||
// harq_process->round = nr_rv_round_map[pusch_pdu->pusch_data.rv_index];
|
||||
if (pusch_pdu->pusch_data.rv_index == 0) harq_process->round = 0;
|
||||
|
||||
harq_process->round = nr_rv_round_map[pusch_pdu->pusch_data.rv_index];
|
||||
|
||||
harq_process->new_rx = false; // flag to indicate if this is a new reception for this harq (initialized to false)
|
||||
if (harq_process->round == 0) {
|
||||
harq_process->new_rx = true;
|
||||
harq_process->ndi = pusch_pdu->pusch_data.new_data_indicator;
|
||||
}
|
||||
|
||||
// this happens if there was a DTX in round 0
|
||||
if (harq_process->ndi != pusch_pdu->pusch_data.new_data_indicator) {
|
||||
harq_process->new_rx = true;
|
||||
harq_process->ndi = pusch_pdu->pusch_data.new_data_indicator;
|
||||
LOG_D(PHY,"Missed ULSCH detection. NDI toggled but rv %d does not correspond to first reception\n",pusch_pdu->pusch_data.rv_index);
|
||||
}
|
||||
|
||||
A = (harq_process->TBS)<<3;
|
||||
|
||||
LOG_D(PHY,"ULSCH Decoding, harq_pid %d TBS %d G %d mcs %d Nl %d nb_rb %d, Qm %d, n_layers %d, Coderate %d\n",harq_pid,A,G, mcs, n_layers, nb_rb, Qm, n_layers, R);
|
||||
@@ -563,7 +575,7 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
|
||||
stats->power[aarx]=dB_fixed_x10(pusch->ulsch_power[aarx]);
|
||||
stats->noise_power[aarx]=dB_fixed_x10(pusch->ulsch_noise_power[aarx]);
|
||||
}
|
||||
if (harq_process->round == 0) {
|
||||
if (harq_process->new_rx == 0) {
|
||||
stats->current_Qm = Qm;
|
||||
stats->current_RI = n_layers;
|
||||
stats->total_bytes_tx += harq_process->TBS;
|
||||
|
||||
@@ -1222,6 +1222,10 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
|
||||
gNB->measurements.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",aarx,
|
||||
rel15_ul->bwp_start,rel15_ul->rb_start,rel15_ul->rb_size,
|
||||
gNB->pusch_vars[ulsch_id]->ulsch_power[aarx],
|
||||
gNB->pusch_vars[ulsch_id]->ulsch_noise_power[aarx]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,7 +206,9 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
nr_sequences=8>>(1-pucch_pdu->sr_flag);
|
||||
}
|
||||
|
||||
LOG_D(PHY,"pucch0: nr_symbols %d, start_symbol %d, prb_start %d, second_hop_prb %d, group_hop_flag %d, sequence_hop_flag %d, O_ACK %d, O_SR %d, mcs %d initial_cyclic_shift %d\n",pucch_pdu->nr_of_symbols,pucch_pdu->start_symbol_index,pucch_pdu->prb_start,pucch_pdu->second_hop_prb,pucch_pdu->group_hop_flag,pucch_pdu->sequence_hop_flag,pucch_pdu->bit_len_harq,pucch_pdu->sr_flag,mcs[0],pucch_pdu->initial_cyclic_shift);
|
||||
LOG_D(PHY,"pucch0: nr_symbols %d, start_symbol %d, prb_start %d, second_hop_prb %d, group_hop_flag %d, sequence_hop_flag %d, O_ACK %d, O_SR %d, mcs %d initial_cyclic_shift %d\n",
|
||||
pucch_pdu->nr_of_symbols,pucch_pdu->start_symbol_index,pucch_pdu->prb_start,pucch_pdu->second_hop_prb,pucch_pdu->group_hop_flag,pucch_pdu->sequence_hop_flag,pucch_pdu->bit_len_harq,
|
||||
pucch_pdu->sr_flag,mcs[0],pucch_pdu->initial_cyclic_shift);
|
||||
|
||||
int cs_ind = get_pucch0_cs_lut_index(gNB,pucch_pdu);
|
||||
/*
|
||||
@@ -238,7 +240,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
|
||||
// x_n contains the sequence r_u_v_alpha_delta(n)
|
||||
|
||||
int n,i,l;
|
||||
int n,i;
|
||||
int prb_offset[2] = {pucch_pdu->bwp_start+pucch_pdu->prb_start, pucch_pdu->bwp_start+pucch_pdu->prb_start};
|
||||
|
||||
nr_group_sequence_hopping(pucch_GroupHopping,pucch_pdu->hopping_id,0,slot,&u[0],&v[0]); // calculating u and v value first hop
|
||||
@@ -266,14 +268,14 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
int64_t xrtmag=0,xrtmag_next=0;
|
||||
uint8_t maxpos=0;
|
||||
uint8_t index=0;
|
||||
for (l=0; l<pucch_pdu->nr_of_symbols; l++) {
|
||||
for (int l=0; l<pucch_pdu->nr_of_symbols; l++) {
|
||||
for (int aarx=0;aarx<frame_parms->nb_antennas_rx;aarx++) {
|
||||
memset((void*)xr[aarx][l],0,24*sizeof(int16_t));
|
||||
}
|
||||
}
|
||||
int n2;
|
||||
|
||||
for (l=0; l<pucch_pdu->nr_of_symbols; l++) {
|
||||
for (int l=0; l<pucch_pdu->nr_of_symbols; l++) {
|
||||
l2 = l+pucch_pdu->start_symbol_index;
|
||||
re_offset[l] = (12*prb_offset[l]) + frame_parms->first_carrier_offset;
|
||||
if (re_offset[l]>= frame_parms->ofdm_symbol_size)
|
||||
@@ -300,11 +302,10 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
//int32_t no_corr = 0;
|
||||
int seq_index;
|
||||
int64_t temp;
|
||||
int64_t av_corr=0;
|
||||
|
||||
for(i=0;i<nr_sequences;i++){
|
||||
|
||||
for (l=0;l<pucch_pdu->nr_of_symbols;l++) {
|
||||
for (int l=0;l<pucch_pdu->nr_of_symbols;l++) {
|
||||
seq_index = (pucch_pdu->initial_cyclic_shift+
|
||||
mcs[i]+
|
||||
gNB->pucch0_lut.lut[cs_ind][slot][l+pucch_pdu->start_symbol_index])%12;
|
||||
@@ -322,26 +323,30 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
}
|
||||
}
|
||||
}
|
||||
LOG_D(PHY,"PUCCH IDFT[%d/%d] = (%d,%d)=>%f\n",mcs[i],seq_index,corr_re[0][0],corr_im[0][0],10*log10((double)corr_re[0][0]*corr_re[0][0] + (double)corr_im[0][0]*corr_im[0][0]));
|
||||
if (l>1) LOG_D(PHY,"PUCCH 2nd symbol IDFT[%d/%d] = (%d,%d)=>%f\n",mcs[i],seq_index,corr_re[0][1],corr_im[0][1],10*log10((double)corr_re[0][1]*corr_re[0][1] + (double)corr_im[0][1]*corr_im[0][1]));
|
||||
if (pucch_pdu->freq_hop_flag == 0 && l==1) {// non-coherent correlation
|
||||
temp=0;
|
||||
for (int aa=0;aa<frame_parms->nb_antennas_rx;aa++)
|
||||
temp+=(int64_t)corr_re[aa][0]*corr_re[aa][0] + (int64_t)corr_im[aa][0]*corr_im[aa][0];
|
||||
}
|
||||
|
||||
else if (pucch_pdu->freq_hop_flag == 0 && l==2) {
|
||||
int64_t corr_re2=0;
|
||||
int64_t corr_im2=0;
|
||||
temp=0;
|
||||
for (int aa=0;aa<frame_parms->nb_antennas_rx;aa++) {
|
||||
corr_re2 = (int64_t)corr_re[aa][0]+corr_re[aa][1];
|
||||
corr_im2 = (int64_t)corr_im[aa][0]+corr_im[aa][1];
|
||||
// coherent combining of 2 symbols and then complex modulus for single-frequency case
|
||||
temp+=corr_re2*corr_re2 + corr_im2*corr_im2;
|
||||
}
|
||||
}
|
||||
else if (pucch_pdu->freq_hop_flag == 1) {
|
||||
LOG_D(PHY,"PUCCH IDFT[%d/%d] = (%d,%d)=>%f\n",
|
||||
mcs[i],seq_index,corr_re[0][0],corr_im[0][0],
|
||||
10*log10((double)corr_re[0][0]*corr_re[0][0] + (double)corr_im[0][0]*corr_im[0][0]));
|
||||
if (pucch_pdu->nr_of_symbols==2)
|
||||
LOG_D(PHY,"PUCCH 2nd symbol IDFT[%d/%d] = (%d,%d)=>%f\n",
|
||||
mcs[i],seq_index,corr_re[0][1],corr_im[0][1],
|
||||
10*log10((double)corr_re[0][1]*corr_re[0][1] + (double)corr_im[0][1]*corr_im[0][1]));
|
||||
if (pucch_pdu->freq_hop_flag == 0) {
|
||||
if (pucch_pdu->nr_of_symbols==1) {// non-coherent correlation
|
||||
temp=0;
|
||||
for (int aa=0;aa<frame_parms->nb_antennas_rx;aa++)
|
||||
temp+=(int64_t)corr_re[aa][0]*corr_re[aa][0] + (int64_t)corr_im[aa][0]*corr_im[aa][0];
|
||||
} else {
|
||||
int64_t corr_re2=0;
|
||||
int64_t corr_im2=0;
|
||||
temp=0;
|
||||
for (int aa=0;aa<frame_parms->nb_antennas_rx;aa++) {
|
||||
corr_re2 = (int64_t)corr_re[aa][0]+corr_re[aa][1];
|
||||
corr_im2 = (int64_t)corr_im[aa][0]+corr_im[aa][1];
|
||||
// coherent combining of 2 symbols and then complex modulus for single-frequency case
|
||||
temp+=corr_re2*corr_re2 + corr_im2*corr_im2;
|
||||
}
|
||||
}
|
||||
} else if (pucch_pdu->freq_hop_flag == 1) {
|
||||
// full non-coherent combining of 2 symbols for frequency-hopping case
|
||||
temp=0;
|
||||
for (int aa=0;aa<frame_parms->nb_antennas_rx;aa++)
|
||||
@@ -349,7 +354,6 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
}
|
||||
else AssertFatal(1==0,"shouldn't happen\n");
|
||||
|
||||
av_corr+=temp;
|
||||
if (temp>xrtmag) {
|
||||
xrtmag_next = xrtmag;
|
||||
xrtmag=temp;
|
||||
@@ -359,19 +363,19 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
int64_t temp2=0,temp3=0;;
|
||||
for (int aa=0;aa<frame_parms->nb_antennas_rx;aa++) {
|
||||
temp2 += ((int64_t)corr_re[aa][0]*corr_re[aa][0] + (int64_t)corr_im[aa][0]*corr_im[aa][0]);
|
||||
if (l==2) temp3 += ((int64_t)corr_re[aa][1]*corr_re[aa][1] + (int64_t)corr_im[aa][1]*corr_im[aa][1]);
|
||||
if (pucch_pdu->nr_of_symbols==2)
|
||||
temp3 += ((int64_t)corr_re[aa][1]*corr_re[aa][1] + (int64_t)corr_im[aa][1]*corr_im[aa][1]);
|
||||
}
|
||||
uci_stats->current_pucch0_stat0= dB_fixed64(temp2);
|
||||
if (l==2) uci_stats->current_pucch0_stat1= dB_fixed64(temp3);
|
||||
if ( pucch_pdu->nr_of_symbols==2)
|
||||
uci_stats->current_pucch0_stat1= dB_fixed64(temp3);
|
||||
}
|
||||
else if (temp>xrtmag_next)
|
||||
xrtmag_next = temp;
|
||||
}
|
||||
|
||||
av_corr/=nr_sequences/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_dBtimes10 = 10*(int)dB_fixed64(xrtmag/(12*pucch_pdu->nr_of_symbols));
|
||||
int xrtmag_next_dBtimes10 = 10*(int)dB_fixed64(xrtmag_next/(12*pucch_pdu->nr_of_symbols));
|
||||
#ifdef DEBUG_NR_PUCCH_RX
|
||||
printf("PUCCH 0 : maxpos %d\n",maxpos);
|
||||
#endif
|
||||
@@ -426,7 +430,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
uci_pdu->harq->harq_confidence_level = no_conf ? 1 : 0;
|
||||
uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1);
|
||||
uci_pdu->harq->harq_list[0].harq_value = index&0x01;
|
||||
if (1/*no_conf*/) LOG_I(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ value %d with confidence level (0 is good, 1 is bad) %d xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d, energy %f, sync_pos %d\n",
|
||||
if (no_conf) LOG_I(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ value %d with confidence level (0 is good, 1 is bad) %d xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d, energy %f, sync_pos %d\n",
|
||||
frame,slot,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,10*log10((double)sigenergy),gNB->ulsch_stats[0].sync_pos);
|
||||
if (pucch_pdu->sr_flag == 1) {
|
||||
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
|
||||
@@ -1519,7 +1523,8 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
|
||||
#ifdef DEBUG_NR_PUCCH_RX
|
||||
printf("cw_ML %d, metric %d dB\n",cw_ML,corr_dB);
|
||||
#endif
|
||||
LOG_D(PHY,"cw_ML %d, metric %d dB\n",cw_ML,corr_dB);
|
||||
LOG_D(PHY,"slot %d PUCCH2 cw_ML %d, metric %d dB\n",slot,cw_ML,corr_dB);
|
||||
|
||||
decodedPayload[0]=(uint64_t)cw_ML;
|
||||
}
|
||||
else { // polar coded case
|
||||
|
||||
@@ -42,7 +42,6 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
|
||||
short coef)
|
||||
{
|
||||
|
||||
static int max_pos_fil = 0;
|
||||
static int count_max_pos_ok = 0;
|
||||
static int first_time = 1;
|
||||
int max_val = 0, max_pos = 0;
|
||||
@@ -55,13 +54,14 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
|
||||
|
||||
LOG_D(PHY,"AbsSubframe %d: rx_offset (before) = %d\n",subframe,ue->rx_offset);
|
||||
|
||||
// we only use channel estimates from tx antenna 0 here
|
||||
for (int i = 0; i < frame_parms->nb_prefix_samples; i++) {
|
||||
// search for maximum position within the cyclic prefix
|
||||
for (int i = -frame_parms->nb_prefix_samples/2; i < frame_parms->nb_prefix_samples/2; i++) {
|
||||
int temp = 0;
|
||||
|
||||
int j = (i < 0) ? (i + frame_parms->ofdm_symbol_size) : i;
|
||||
for (int aa = 0; aa < frame_parms->nb_antennas_rx; aa++) {
|
||||
int Re = ((int16_t*)ue->pbch_vars[gNB_id]->dl_ch_estimates_time[aa])[(i<<1)];
|
||||
int Im = ((int16_t*)ue->pbch_vars[gNB_id]->dl_ch_estimates_time[aa])[1+(i<<1)];
|
||||
int Re = ((int16_t*)ue->pbch_vars[gNB_id]->dl_ch_estimates_time[aa])[(j<<1)];
|
||||
int Im = ((int16_t*)ue->pbch_vars[gNB_id]->dl_ch_estimates_time[aa])[1+(j<<1)];
|
||||
temp += (Re*Re/2) + (Im*Im/2);
|
||||
}
|
||||
|
||||
@@ -71,19 +71,16 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
|
||||
}
|
||||
}
|
||||
|
||||
if (max_pos > frame_parms->ofdm_symbol_size/2)
|
||||
max_pos = max_pos - frame_parms->ofdm_symbol_size;
|
||||
|
||||
// filter position to reduce jitter
|
||||
if (clear == 1)
|
||||
max_pos_fil = max_pos;
|
||||
ue->max_pos_fil = max_pos;
|
||||
else
|
||||
max_pos_fil = ((max_pos_fil * coef) + (max_pos * ncoef)) >> 15;
|
||||
ue->max_pos_fil = ((ue->max_pos_fil * coef) + (max_pos * ncoef)) >> 15;
|
||||
|
||||
// do not filter to have proactive timing adjustment
|
||||
//max_pos_fil = max_pos;
|
||||
//ue->max_pos_fil = max_pos;
|
||||
|
||||
int diff = max_pos_fil - sync_pos;
|
||||
int diff = ue->max_pos_fil - sync_pos;
|
||||
|
||||
if (frame_parms->freq_range==nr_FR2)
|
||||
sync_offset = 2;
|
||||
@@ -131,7 +128,7 @@ void nr_adjust_synch_ue(NR_DL_FRAME_PARMS *frame_parms,
|
||||
ue->rx_offset,
|
||||
clear,
|
||||
max_pos,
|
||||
max_pos_fil,
|
||||
ue->max_pos_fil,
|
||||
max_val,
|
||||
sync_pos);
|
||||
#endif //DEBUG_PHY
|
||||
|
||||
@@ -485,8 +485,8 @@ int nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
|
||||
|
||||
|
||||
#ifdef DEBUG_PDCCH
|
||||
printf("PDCCH Channel Estimation : ThreadId %d, gNB_id %d ch_offset %d, OFDM size %d, Ncp=%d, Ns=%d, k=%d symbol %d\n",proc->thread_id, gNB_id,ch_offset,ue->frame_parms.ofdm_symbol_size,
|
||||
ue->frame_parms.Ncp,Ns,k, symbol);
|
||||
printf("PDCCH Channel Estimation : ThreadId %d, gNB_id %d ch_offset %d, OFDM size %d, Ncp=%d, Ns=%d, symbol %d\n",
|
||||
proc->thread_id, gNB_id,ch_offset,ue->frame_parms.ofdm_symbol_size,ue->frame_parms.Ncp,Ns,symbol);
|
||||
#endif
|
||||
|
||||
fl = filt16a_l1;
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include "PHY/phy_extern_nr_ue.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "PHY/sse_intrin.h"
|
||||
#include "openair2/LAYER2/NR_MAC_UE/mac_proto.h"
|
||||
|
||||
//#define k1 1000
|
||||
#define k1 ((long long int) 1000)
|
||||
@@ -61,7 +60,7 @@ int16_t get_nr_PL(uint8_t Mod_id, uint8_t CC_id, uint8_t gNB_index){
|
||||
|
||||
long referenceSignalPower = ue->nrUE_config.ssb_config.ss_pbch_power;
|
||||
|
||||
pathloss = (int16_t)(referenceSignalPower - 30 + ue->rx_total_gain_dB);
|
||||
pathloss = (int16_t)(referenceSignalPower - ue->measurements.rsrp_dBm[gNB_index]);
|
||||
|
||||
LOG_D(MAC, "In %s: pathloss %d dB, UE RX total gain %d dB, referenceSignalPower %ld dBm/RE (%f mW), RSRP %d dBm (%f mW)\n",
|
||||
__FUNCTION__,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -33,13 +33,7 @@
|
||||
#ifndef __PHY_NR_UE_TRANSPORT_DCI_NR__H__
|
||||
#define __PHY_NR_UE_TRANSPORT_DCI_NR__H__
|
||||
|
||||
#ifndef USER_MODE
|
||||
#include "PHY/types.h"
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define MAX_DCI_SIZE_BITS 45
|
||||
|
||||
|
||||
@@ -45,11 +45,6 @@
|
||||
|
||||
//#define DEBUG_HARQ
|
||||
|
||||
//#include "LAYER2/MAC/extern.h"
|
||||
//#include "LAYER2/MAC/defs.h"
|
||||
//#include "../openair2/LAYER2/MAC/extern.h"
|
||||
//#include "../openair2/LAYER2/MAC/defs.h"
|
||||
|
||||
//#define DEBUG_DCI
|
||||
#define NR_PDCCH_DCI_TOOLS
|
||||
//#define NR_PDCCH_DCI_TOOLS_DEBUG
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include "SIMULATION/TOOLS/sim.h"
|
||||
#include "executables/nr-uesoftmodem.h"
|
||||
#include "PHY/CODING/nrLDPC_extern.h"
|
||||
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
#include "common/utils/nr/nr_common.h"
|
||||
|
||||
//#define ENABLE_PHY_PAYLOAD_DEBUG 1
|
||||
|
||||
@@ -236,11 +236,10 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
uint8_t harq_pid,
|
||||
uint8_t is_crnti,
|
||||
uint8_t llr8_flag) {
|
||||
#if UE_TIMING_TRACE
|
||||
time_stats_t *dlsch_rate_unmatching_stats=&phy_vars_ue->dlsch_rate_unmatching_stats;
|
||||
time_stats_t *dlsch_turbo_decoding_stats=&phy_vars_ue->dlsch_turbo_decoding_stats;
|
||||
time_stats_t *dlsch_deinterleaving_stats=&phy_vars_ue->dlsch_deinterleaving_stats;
|
||||
#endif
|
||||
|
||||
uint32_t A,E;
|
||||
uint32_t G;
|
||||
uint32_t ret,offset;
|
||||
@@ -411,21 +410,15 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
for (r=0; r<harq_process->C; r++) {
|
||||
//printf("start rx segment %d\n",r);
|
||||
E = nr_get_E(G, harq_process->C, harq_process->Qm, harq_process->Nl, r);
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(dlsch_deinterleaving_stats);
|
||||
#endif
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_IN);
|
||||
nr_deinterleaving_ldpc(E,
|
||||
harq_process->Qm,
|
||||
harq_process->w[r], // [hna] w is e
|
||||
dlsch_llr+r_offset);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_OUT);
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(dlsch_deinterleaving_stats);
|
||||
#endif
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(dlsch_rate_unmatching_stats);
|
||||
#endif
|
||||
LOG_D(PHY,"HARQ_PID %d Rate Matching Segment %d (coded bits %d,E %d, F %d,unpunctured/repeated bits %d, TBS %d, mod_order %d, nb_rb %d, Nl %d, rv %d, round %d)...\n",
|
||||
harq_pid,r, G,E,harq_process->F,
|
||||
Kr*3,
|
||||
@@ -454,16 +447,12 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
E,
|
||||
harq_process->F,
|
||||
Kr-harq_process->F-2*(p_decParams->Z))==-1) {
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_RATE_MATCHING, VCD_FUNCTION_OUT);
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(dlsch_rate_unmatching_stats);
|
||||
#endif
|
||||
LOG_E(PHY,"dlsch_decoding.c: Problem in rate_matching\n");
|
||||
return(dlsch->max_ldpc_iterations + 1);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_RATE_MATCHING, VCD_FUNCTION_OUT);
|
||||
stop_meas(dlsch_rate_unmatching_stats);
|
||||
LOG_E(PHY,"dlsch_decoding.c: Problem in rate_matching\n");
|
||||
return(dlsch->max_ldpc_iterations + 1);
|
||||
} else {
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(dlsch_rate_unmatching_stats);
|
||||
#endif
|
||||
stop_meas(dlsch_rate_unmatching_stats);
|
||||
}
|
||||
|
||||
r_offset += E;
|
||||
@@ -492,9 +481,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
}
|
||||
|
||||
if (err_flag == 0) {
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(dlsch_turbo_decoding_stats);
|
||||
#endif
|
||||
//set first 2*Z_c bits to zeros
|
||||
memset(&z[0],0,2*harq_process->Z*sizeof(int16_t));
|
||||
//set Filler bits
|
||||
@@ -510,6 +497,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_LDPC, VCD_FUNCTION_IN);
|
||||
p_decParams->block_length=length_dec;
|
||||
nrLDPC_initcall(p_decParams, (int8_t*)&pl[0], llrProcBuf);
|
||||
no_iteration_ldpc = nrLDPC_decoder(p_decParams,
|
||||
(int8_t *)&pl[0],
|
||||
llrProcBuf,
|
||||
@@ -545,13 +534,10 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) {
|
||||
for (int k=0; k<A>>3; k++)
|
||||
LOG_D(PHY,"output decoder [%d] = 0x%02x \n", k, harq_process->c[r][k]);
|
||||
|
||||
LOG_D(PHY,"no_iterations_ldpc %d (ret %u)\n",no_iteration_ldpc,ret);
|
||||
}
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(dlsch_turbo_decoding_stats);
|
||||
#endif
|
||||
}
|
||||
|
||||
if ((err_flag == 0) && (ret>=(1+dlsch->max_ldpc_iterations))) {// a Code segment is in error so break;
|
||||
@@ -645,11 +631,10 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
uint8_t harq_pid,
|
||||
uint8_t is_crnti,
|
||||
uint8_t llr8_flag) {
|
||||
#if UE_TIMING_TRACE
|
||||
|
||||
time_stats_t *dlsch_rate_unmatching_stats=&phy_vars_ue->dlsch_rate_unmatching_stats;
|
||||
time_stats_t *dlsch_turbo_decoding_stats=&phy_vars_ue->dlsch_turbo_decoding_stats;
|
||||
time_stats_t *dlsch_deinterleaving_stats=&phy_vars_ue->dlsch_deinterleaving_stats;
|
||||
#endif
|
||||
uint32_t A,E;
|
||||
uint32_t G;
|
||||
uint32_t ret,offset;
|
||||
@@ -812,7 +797,6 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
|
||||
notifiedFIFO_elt_t *res_dl;
|
||||
opp_enabled=1;
|
||||
|
||||
if (harq_process->C>1) {
|
||||
for (int nb_seg =1 ; nb_seg<harq_process->C; nb_seg++) {
|
||||
if ( (res_dl=tryPullTpool(&nf, &pool_dl)) != NULL ) {
|
||||
@@ -867,9 +851,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
dlsch_llr+r_offset,
|
||||
&harq_process->w[r]);
|
||||
*/
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(dlsch_deinterleaving_stats);
|
||||
#endif
|
||||
nr_deinterleaving_ldpc(E,
|
||||
harq_process->Qm,
|
||||
harq_process->w[r],
|
||||
@@ -879,12 +861,8 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
for (int i =0; i<16; i++)
|
||||
LOG_D(PHY,"rx output deinterleaving w[%d]= %d r_offset %u\n", i,harq_process->w[r][i], r_offset);
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(dlsch_deinterleaving_stats);
|
||||
#endif
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(dlsch_rate_unmatching_stats);
|
||||
#endif
|
||||
|
||||
if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD))
|
||||
LOG_I(PHY,"HARQ_PID %d Rate Matching Segment %d (coded bits %d,unpunctured/repeated bits %d, TBS %d, mod_order %d, nb_rb %d, Nl %d, rv %d, round %d)...\n",
|
||||
@@ -915,15 +893,11 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
E,
|
||||
harq_process->F,
|
||||
Kr-harq_process->F-2*(p_decParams->Z))==-1) {
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(dlsch_rate_unmatching_stats);
|
||||
#endif
|
||||
LOG_E(PHY,"dlsch_decoding.c: Problem in rate_matching\n");
|
||||
return(dlsch->max_ldpc_iterations);
|
||||
} else {
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(dlsch_rate_unmatching_stats);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD))
|
||||
@@ -966,9 +940,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
Kr,r,harq_process->C,harq_process->nb_rb,crc_type,A,harq_process->TBS,
|
||||
harq_process->B,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round,dlsch->max_ldpc_iterations);
|
||||
*/
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(dlsch_turbo_decoding_stats);
|
||||
#endif
|
||||
LOG_D(PHY,"mthread AbsSubframe %d.%d Start LDPC segment %d/%d \n",frame%1024,nr_slot_rx,r,harq_process->C-1);
|
||||
/*for (int cnt =0; cnt < (kc-2)*p_decParams->Z; cnt++){
|
||||
inv_d[cnt] = (1)*harq_process->d[r][cnt];
|
||||
@@ -986,7 +958,8 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
for (i=0, j=0; j < ((kc*harq_process->Z)>>4)+1; i+=2, j++) {
|
||||
pl[j] = _mm_packs_epi16(pv[i],pv[i+1]);
|
||||
}
|
||||
|
||||
p_decParams->block_length=length_dec;
|
||||
nrLDPC_initcall(p_decParams, (int8_t*)&pl[0], llrProcBuf);
|
||||
no_iteration_ldpc = nrLDPC_decoder(p_decParams,
|
||||
(int8_t *)&pl[0],
|
||||
llrProcBuf,
|
||||
@@ -1037,11 +1010,10 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
for (int k=0; k<32; k++)
|
||||
LOG_D(PHY,"output decoder [%d] = 0x%02x \n", k, harq_process->c[r][k]);
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(dlsch_turbo_decoding_stats);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
if ((err_flag == 0) && (ret>=(1+dlsch->max_ldpc_iterations))) {// a Code segment is in error so break;
|
||||
LOG_D(PHY,"AbsSubframe %d.%d CRC failed, segment %d/%d \n",frame%1024,nr_slot_rx,r,harq_process->C-1);
|
||||
err_flag = 1;
|
||||
@@ -1135,7 +1107,6 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
}
|
||||
|
||||
|
||||
|
||||
void nr_dlsch_decoding_process(void *arg) {
|
||||
nr_rxtx_thread_data_t *rxtxD= (nr_rxtx_thread_data_t *)arg;
|
||||
UE_nr_rxtx_proc_t *proc = &rxtxD->proc;
|
||||
@@ -1167,11 +1138,10 @@ void nr_dlsch_decoding_process(void *arg) {
|
||||
proc->instance_cnt_dlsch_td=-1;
|
||||
//proc->nr_slot_rx = proc->sub_frame_start * frame_parms->slots_per_subframe;
|
||||
proc->decoder_thread_available = 1;
|
||||
#if UE_TIMING_TRACE
|
||||
time_stats_t *dlsch_rate_unmatching_stats=&phy_vars_ue->dlsch_rate_unmatching_stats;
|
||||
time_stats_t *dlsch_turbo_decoding_stats=&phy_vars_ue->dlsch_turbo_decoding_stats;
|
||||
time_stats_t *dlsch_deinterleaving_stats=&phy_vars_ue->dlsch_deinterleaving_stats;
|
||||
#endif
|
||||
|
||||
uint32_t A,E;
|
||||
uint32_t G;
|
||||
uint32_t ret;
|
||||
@@ -1272,9 +1242,7 @@ void nr_dlsch_decoding_process(void *arg) {
|
||||
Kr_bytes = Kr>>3;
|
||||
K_bits_F = Kr-harq_process->F;
|
||||
E = nr_get_E(G, harq_process->C, harq_process->Qm, harq_process->Nl, r);
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(dlsch_deinterleaving_stats);
|
||||
#endif
|
||||
nr_deinterleaving_ldpc(E,
|
||||
harq_process->Qm,
|
||||
harq_process->w[r],
|
||||
@@ -1284,13 +1252,8 @@ void nr_dlsch_decoding_process(void *arg) {
|
||||
for (int i =0; i<16; i++)
|
||||
LOG_D(PHY,"rx output thread 0 deinterleaving w[%d]= %d r_offset %u\n", i,harq_process->w[r][i], r_offset);
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(dlsch_deinterleaving_stats);
|
||||
#endif
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(dlsch_rate_unmatching_stats);
|
||||
#endif
|
||||
|
||||
if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD))
|
||||
LOG_I(PHY,"HARQ_PID %d Rate Matching Segment %d (coded bits %d,unpunctured/repeated bits %d, TBS %d, mod_order %d, nb_rb %d, Nl %d, rv %d, round %d)...\n",
|
||||
harq_pid,r, G,
|
||||
@@ -1319,15 +1282,11 @@ void nr_dlsch_decoding_process(void *arg) {
|
||||
E,
|
||||
harq_process->F,
|
||||
Kr-harq_process->F-2*(p_decParams->Z))==-1) {
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(dlsch_rate_unmatching_stats);
|
||||
#endif
|
||||
LOG_E(PHY,"dlsch_decoding.c: Problem in rate_matching\n");
|
||||
//return(dlsch->max_ldpc_iterations);
|
||||
} else {
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(dlsch_rate_unmatching_stats);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) {
|
||||
@@ -1364,9 +1323,7 @@ void nr_dlsch_decoding_process(void *arg) {
|
||||
Kr,r,harq_process->C,harq_process->nb_rb,A,harq_process->TBS,harq_process->B,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round);
|
||||
}
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(dlsch_turbo_decoding_stats);
|
||||
#endif
|
||||
// LOG_D(PHY,"AbsSubframe %d.%d Start LDPC segment %d/%d \n",frame%1024,subframe,r,harq_process->C-1);
|
||||
/*
|
||||
for (int cnt =0; cnt < (kc-2)*p_decParams->Z; cnt++){
|
||||
@@ -1386,7 +1343,8 @@ void nr_dlsch_decoding_process(void *arg) {
|
||||
for (i=0, j=0; j < ((kc*harq_process->Z)>>4)+1; i+=2, j++) {
|
||||
pl[j] = _mm_packs_epi16(pv[i],pv[i+1]);
|
||||
}
|
||||
|
||||
p_decParams->block_length=length_dec;
|
||||
nrLDPC_initcall(p_decParams, (int8_t*)&pl[0], llrProcBuf);
|
||||
no_iteration_ldpc = nrLDPC_decoder(p_decParams,
|
||||
(int8_t *)&pl[0],
|
||||
llrProcBuf,
|
||||
@@ -1412,10 +1370,7 @@ void nr_dlsch_decoding_process(void *arg) {
|
||||
if ( LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD))
|
||||
for (int k=0; k<2; k++)
|
||||
LOG_D(PHY,"segment 1 output decoder [%d] = 0x%02x \n", k, harq_process->c[r][k]);
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(dlsch_turbo_decoding_stats);
|
||||
#endif
|
||||
}
|
||||
|
||||
if ((err_flag == 0) && (ret>=(1+dlsch->max_ldpc_iterations))) {// a Code segment is in error so break;
|
||||
|
||||
@@ -41,12 +41,7 @@
|
||||
#include "openair1/PHY/NR_TRANSPORT/nr_dlsch.h"
|
||||
#include "PHY/NR_REFSIG/nr_refsig.h"
|
||||
#include "PHY/NR_REFSIG/dmrs_nr.h"
|
||||
|
||||
#ifndef USER_MODE
|
||||
#define NOCYGWIN_STATIC static
|
||||
#else
|
||||
#define NOCYGWIN_STATIC
|
||||
#endif
|
||||
#include "common/utils/nr/nr_common.h"
|
||||
|
||||
/* dynamic shift for LLR computation for TM3/4
|
||||
* set as command line argument, see lte-softmodem.c
|
||||
@@ -163,9 +158,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
||||
// int avg_0[2];
|
||||
// int avg_1[2];
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
uint8_t slot = 0;
|
||||
#endif
|
||||
|
||||
unsigned char aatx=0,aarx=0;
|
||||
|
||||
@@ -331,12 +324,10 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
||||
DevAssert(dlsch1_harq);
|
||||
}
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
if(symbol > ue->frame_parms.symbols_per_slot>>1)
|
||||
{
|
||||
slot = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_HARQ
|
||||
printf("Demod dlsch0_harq->pmi_alloc %d\n", dlsch0_harq->pmi_alloc);
|
||||
@@ -346,9 +337,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
||||
uint8_t config_type = dlsch0_harq->dmrsConfigType;
|
||||
|
||||
if (beamforming_mode==0) {//No beamforming
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
|
||||
#endif
|
||||
if (dlsch0_harq->Nl > 1)//More than or equal 2 layers
|
||||
nb_rb = nr_dlsch_extract_rbs_multiple(common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF,
|
||||
pdsch_vars[gNB_id]->dl_ch_estimates,
|
||||
@@ -389,7 +378,6 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
||||
|
||||
len = (pilots==1)? ((config_type==NFAPI_NR_DMRS_TYPE1)?nb_rb*(12-6*dlsch0_harq->n_dmrs_cdm_groups): nb_rb*(12-4*dlsch0_harq->n_dmrs_cdm_groups)):(nb_rb*12);
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
|
||||
#if DISABLE_LOG_X
|
||||
printf("[AbsSFN %u.%d] Slot%d Symbol %d type %d: Pilot/Data extraction %5.2f \n",
|
||||
@@ -398,11 +386,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
||||
LOG_I(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));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
|
||||
#endif
|
||||
n_tx = dlsch0_harq->Nl;
|
||||
n_rx = frame_parms->nb_antennas_rx;
|
||||
|
||||
@@ -416,18 +401,13 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
||||
len,
|
||||
nb_rb_pdsch);
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
|
||||
#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));
|
||||
#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));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
|
||||
#endif
|
||||
if (first_symbol_flag==1) {
|
||||
if (beamforming_mode==0){
|
||||
nr_dlsch_channel_level(pdsch_vars[gNB_id]->dl_ch_estimates_ext,
|
||||
@@ -482,19 +462,14 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
||||
}
|
||||
#endif
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
|
||||
#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));
|
||||
#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));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
|
||||
#endif
|
||||
// Now channel compensation
|
||||
if (dlsch0_harq->mimo_mode<NR_DUALSTREAM) {
|
||||
nr_dlsch_channel_compensation(pdsch_vars[gNB_id]->rxdataF_ext,
|
||||
@@ -539,18 +514,13 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
||||
0);
|
||||
}
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
|
||||
#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));
|
||||
#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));
|
||||
#endif
|
||||
#endif
|
||||
// MRC
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
|
||||
#endif
|
||||
|
||||
if (frame_parms->nb_antennas_rx > 1) {
|
||||
if (dlsch0_harq->mimo_mode<NR_DUALSTREAM) {
|
||||
@@ -603,19 +573,13 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
||||
//i_mod should have been passed as a parameter
|
||||
}
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
|
||||
#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));
|
||||
#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));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
|
||||
start_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
|
||||
#endif
|
||||
/* Store the valid DL RE's */
|
||||
pdsch_vars[gNB_id]->dl_valid_re[symbol-1] = len;
|
||||
|
||||
@@ -692,14 +656,12 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
||||
|
||||
}
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
|
||||
#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));
|
||||
#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));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Please keep it: useful for debugging
|
||||
#ifdef DEBUG_PDSCH_RX
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "PHY/NR_UE_ESTIMATION/nr_estimation.h"
|
||||
#include "SCHED_NR_UE/defs.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/nr/nr_common.h"
|
||||
|
||||
#include "common_lib.h"
|
||||
#include <math.h>
|
||||
@@ -126,15 +127,11 @@ int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_ini
|
||||
// initialization of structure
|
||||
current_ssb = create_ssb_node(l,hf);
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(&ue->dlsch_channel_estimation_stats);
|
||||
#endif
|
||||
// computing correlation between received DMRS symbols and transmitted sequence for current i_ssb and n_hf
|
||||
for(int i=pbch_initial_symbol; i<pbch_initial_symbol+3;i++)
|
||||
nr_pbch_dmrs_correlation(ue,proc,0,0,i,i-pbch_initial_symbol,current_ssb);
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(&ue->dlsch_channel_estimation_stats);
|
||||
#endif
|
||||
|
||||
current_ssb->metric = current_ssb->c_re*current_ssb->c_re + current_ssb->c_im*current_ssb->c_im;
|
||||
|
||||
@@ -150,15 +147,11 @@ int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_ini
|
||||
NR_UE_SSB *temp_ptr=best_ssb;
|
||||
while (ret!=0 && temp_ptr != NULL) {
|
||||
|
||||
#if UE_TIMING_TRACE
|
||||
start_meas(&ue->dlsch_channel_estimation_stats);
|
||||
#endif
|
||||
// computing channel estimation for selected best ssb
|
||||
for(int i=pbch_initial_symbol; i<pbch_initial_symbol+3;i++)
|
||||
nr_pbch_channel_estimation(ue,proc,0,0,i,i-pbch_initial_symbol,temp_ptr->i_ssb,temp_ptr->n_hf);
|
||||
#if UE_TIMING_TRACE
|
||||
stop_meas(&ue->dlsch_channel_estimation_stats);
|
||||
#endif
|
||||
|
||||
ret = nr_rx_pbch(ue,
|
||||
proc,
|
||||
@@ -492,9 +485,9 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
|
||||
|
||||
for(int n_ss = 0; n_ss<pdcch_vars->nb_search_space; n_ss++) {
|
||||
uint8_t nb_symb_pdcch = pdcch_vars->pdcch_config[n_ss].coreset.duration;
|
||||
int start_symb = pdcch_vars->pdcch_config[n_ss].coreset.StartSymbolIndex;
|
||||
get_coreset_rballoc(pdcch_vars->pdcch_config[n_ss].coreset.frequency_domain_resource,&coreset_nb_rb,&coreset_start_rb);
|
||||
|
||||
for (uint16_t l=0; l<nb_symb_pdcch; l++) {
|
||||
for (uint16_t l=start_symb; l<start_symb+nb_symb_pdcch; l++) {
|
||||
nr_slot_fep_init_sync(ue,
|
||||
proc,
|
||||
l, // the UE PHY has no notion of the symbols to be monitored in the search space
|
||||
|
||||
@@ -40,9 +40,7 @@
|
||||
//#define DEBUG_PBCH
|
||||
//#define DEBUG_PBCH_ENCODING
|
||||
|
||||
#ifdef OPENAIR2
|
||||
//#include "PHY_INTERFACE/defs.h"
|
||||
#endif
|
||||
|
||||
#define PBCH_A 24
|
||||
|
||||
|
||||
@@ -1466,7 +1466,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
|
||||
@param dl_Carrier Pointer to DL carrier to be set
|
||||
@param ul_Carrier Pointer to UL carrier to be set
|
||||
*/
|
||||
void nr_get_carrier_frequencies(NR_DL_FRAME_PARMS *fp,
|
||||
void nr_get_carrier_frequencies(PHY_VARS_NR_UE *ue,
|
||||
uint64_t *dl_Carrier,
|
||||
uint64_t *ul_Carrier);
|
||||
|
||||
|
||||
@@ -272,6 +272,8 @@ typedef struct {
|
||||
uint8_t dmrsConfigType;
|
||||
// Number of DMRS CDM groups with no data
|
||||
uint8_t n_dmrs_cdm_groups;
|
||||
/// DMRS ports bitmap
|
||||
uint16_t dmrs_ports;
|
||||
/// Starting Symbol number
|
||||
uint16_t start_symbol;
|
||||
/// Current subband PMI allocation
|
||||
|
||||
@@ -33,19 +33,17 @@
|
||||
#include "nr_transport_proto_ue.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
|
||||
void nr_get_carrier_frequencies(NR_DL_FRAME_PARMS *fp, uint64_t *dl_carrier, uint64_t *ul_carrier){
|
||||
void nr_get_carrier_frequencies(PHY_VARS_NR_UE *ue, uint64_t *dl_carrier, uint64_t *ul_carrier){
|
||||
|
||||
if (get_softmodem_params()->phy_test==1 || get_softmodem_params()->do_ra==1 || !downlink_frequency[0][0]) {
|
||||
NR_DL_FRAME_PARMS *fp = &ue->frame_parms;
|
||||
if (ue->if_freq!=0) {
|
||||
*dl_carrier = ue->if_freq;
|
||||
*ul_carrier = *dl_carrier + ue->if_freq_off;
|
||||
}
|
||||
else{
|
||||
*dl_carrier = fp->dl_CarrierFreq;
|
||||
} else {
|
||||
*dl_carrier = downlink_frequency[0][0];
|
||||
*ul_carrier = fp->ul_CarrierFreq;
|
||||
}
|
||||
|
||||
if (uplink_frequency_offset[0][0])
|
||||
*ul_carrier = *dl_carrier + uplink_frequency_offset[0][0];
|
||||
else
|
||||
*ul_carrier = *dl_carrier + fp->ul_CarrierFreq - fp->dl_CarrierFreq;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#include "PHY/CODING/nrLDPC_extern.h"
|
||||
#include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "LAYER2/NR_MAC_gNB/mac_proto.h"
|
||||
#include <openair2/UTIL/OPT/opt.h>
|
||||
|
||||
//#define DEBUG_ULSCH_CODING
|
||||
@@ -275,7 +274,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
|
||||
#ifdef DEBUG_ULSCH_CODING
|
||||
printf("encoding thinks this is a new packet \n");
|
||||
#endif
|
||||
harq_process->first_tx = 0;
|
||||
harq_process->first_tx = 0;
|
||||
///////////////////////// a---->| add CRC |---->b /////////////////////////
|
||||
///////////
|
||||
/*
|
||||
@@ -446,17 +445,19 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RATE_MATCHING_LDPC, VCD_FUNCTION_IN);
|
||||
start_meas(&ue->ulsch_rate_matching_stats);
|
||||
nr_rate_matching_ldpc(Ilbrm,
|
||||
Tbslbrm,
|
||||
harq_process->BG,
|
||||
*pz,
|
||||
harq_process->d[r],
|
||||
harq_process->e+r_offset,
|
||||
harq_process->C,
|
||||
F,
|
||||
Kr-F-2*(*pz),
|
||||
harq_process->pusch_pdu.pusch_data.rv_index,
|
||||
E);
|
||||
if (nr_rate_matching_ldpc(Ilbrm,
|
||||
Tbslbrm,
|
||||
harq_process->BG,
|
||||
*pz,
|
||||
harq_process->d[r],
|
||||
harq_process->e+r_offset,
|
||||
harq_process->C,
|
||||
F,
|
||||
Kr-F-2*(*pz),
|
||||
harq_process->pusch_pdu.pusch_data.rv_index,
|
||||
E) == -1)
|
||||
return -1;
|
||||
|
||||
stop_meas(&ue->ulsch_rate_matching_stats);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RATE_MATCHING_LDPC, VCD_FUNCTION_OUT);
|
||||
|
||||
|
||||
@@ -44,8 +44,6 @@
|
||||
#include "PHY/TOOLS/tools_defs.h"
|
||||
#include "executables/nr-softmodem.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
#include "LAYER2/NR_MAC_UE/mac_proto.h"
|
||||
|
||||
#include "PHY/NR_REFSIG/ul_ref_seq_nr.h"
|
||||
|
||||
//#define DEBUG_PUSCH_MAPPING
|
||||
@@ -143,7 +141,12 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
|
||||
ulsch_ue->Nid_cell = Nid_cell;
|
||||
|
||||
get_num_re_dmrs(pusch_pdu, &nb_dmrs_re_per_rb, &number_dmrs_symbols);
|
||||
for (int i = start_symbol; i < start_symbol + number_of_symbols; i++) {
|
||||
if((ul_dmrs_symb_pos >> i) & 0x01)
|
||||
number_dmrs_symbols += 1;
|
||||
}
|
||||
|
||||
nb_dmrs_re_per_rb = ((dmrs_type == pusch_dmrs_type1) ? 6:4)*cdm_grps_no_data;
|
||||
|
||||
LOG_D(PHY,"ulsch %x : start_rb %d bwp_start %d start_sc %d start_symbol %d num_symbols %d cdmgrpsnodata %d num_dmrs %d dmrs_re_per_rb %d\n",
|
||||
rnti,start_rb,pusch_pdu->bwp_start,start_sc,start_symbol,number_of_symbols,cdm_grps_no_data,number_dmrs_symbols,nb_dmrs_re_per_rb);
|
||||
@@ -159,7 +162,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
nb_dmrs_re_per_rb, number_dmrs_symbols, mod_order, Nl);
|
||||
|
||||
|
||||
nr_ulsch_encoding(UE, ulsch_ue, frame_parms, harq_pid, G);
|
||||
if (nr_ulsch_encoding(UE, ulsch_ue, frame_parms, harq_pid, G) == -1)
|
||||
return;
|
||||
|
||||
///////////
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "PHY/defs_nr_common.h"
|
||||
#include "PHY/defs_nr_UE.h"
|
||||
//#include "PHY/extern.h"
|
||||
//#include "LAYER2/MAC/extern.h"
|
||||
#include "PHY/NR_UE_TRANSPORT/pucch_nr.h"
|
||||
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
|
||||
@@ -91,8 +90,8 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue,
|
||||
// the value of u,v (delta always 0 for PUCCH) has to be calculated according to TS 38.211 Subclause 6.3.2.2.1
|
||||
uint8_t u[2]={0,0},v[2]={0,0};
|
||||
|
||||
LOG_D(PHY,"pucch0: slot %d nr_symbols %d, start_symbol %d, prb_start %d, second_hop_prb %d, group_hop_flag %d, sequence_hop_flag %d, mcs %d\n",nr_slot_tx,pucch_pdu->nr_of_symbols,pucch_pdu->start_symbol_index,pucch_pdu->prb_start,pucch_pdu->second_hop_prb,pucch_pdu->group_hop_flag,pucch_pdu->sequence_hop_flag,pucch_pdu->mcs);
|
||||
|
||||
LOG_D(PHY,"pucch0: slot %d nr_symbols %d, start_symbol %d, prb_start %d, second_hop_prb %d, group_hop_flag %d, sequence_hop_flag %d, mcs %d\n",
|
||||
nr_slot_tx,pucch_pdu->nr_of_symbols,pucch_pdu->start_symbol_index,pucch_pdu->prb_start,pucch_pdu->second_hop_prb,pucch_pdu->group_hop_flag,pucch_pdu->sequence_hop_flag,pucch_pdu->mcs);
|
||||
|
||||
#ifdef DEBUG_NR_PUCCH_TX
|
||||
printf("\t [nr_generate_pucch0] sequence generation: variable initialization for test\n");
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
#include "PHY/defs_nr_common.h"
|
||||
#include "PHY/defs_nr_UE.h"
|
||||
//#include "PHY/extern.h"
|
||||
//#include "LAYER2/MAC/extern.h"
|
||||
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
|
||||
@@ -69,18 +69,12 @@ void reset_stats(FL_OBJECT *button, long arg) {
|
||||
|
||||
|
||||
static void *scope_thread_eNB(void *arg) {
|
||||
# ifdef ENABLE_XFORMS_WRITE_STATS
|
||||
FILE *eNB_stats;
|
||||
# endif
|
||||
struct sched_param sched_param;
|
||||
int UE_id, CC_id;
|
||||
int ue_cnt=0;
|
||||
sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO)+1;
|
||||
sched_setscheduler(0, SCHED_FIFO,&sched_param);
|
||||
printf("Scope thread has priority %d\n",sched_param.sched_priority);
|
||||
# ifdef ENABLE_XFORMS_WRITE_STATS
|
||||
eNB_stats = fopen("eNB_stats.txt", "w");
|
||||
#endif
|
||||
|
||||
while (!oai_exit) {
|
||||
ue_cnt=0;
|
||||
@@ -99,16 +93,6 @@ static void *scope_thread_eNB(void *arg) {
|
||||
usleep(100*1000);
|
||||
}
|
||||
|
||||
// printf("%s",stats_buffer);
|
||||
# ifdef ENABLE_XFORMS_WRITE_STATS
|
||||
|
||||
if (eNB_stats) {
|
||||
rewind (eNB_stats);
|
||||
fwrite (stats_buffer, 1, len, eNB_stats);
|
||||
fclose (eNB_stats);
|
||||
}
|
||||
|
||||
# endif
|
||||
pthread_exit((void *)arg);
|
||||
}
|
||||
|
||||
|
||||
@@ -72,16 +72,10 @@ void reset_stats(FL_OBJECT *button, long arg) {
|
||||
|
||||
static void *scope_thread_UE(void *arg) {
|
||||
char stats_buffer[16384];
|
||||
# ifdef ENABLE_XFORMS_WRITE_STATS
|
||||
FILE *UE_stats, *eNB_stats;
|
||||
# endif
|
||||
struct sched_param sched_param;
|
||||
sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO)+1;
|
||||
sched_setscheduler(0, SCHED_FIFO,&sched_param);
|
||||
printf("Scope thread has priority %d\n",sched_param.sched_priority);
|
||||
# ifdef ENABLE_XFORMS_WRITE_STATS
|
||||
UE_stats = fopen("UE_stats.txt", "w");
|
||||
#endif
|
||||
|
||||
while (!oai_exit) {
|
||||
// dump_ue_stats (PHY_vars_UE_g[0][0], &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0],stats_buffer, 0, mode,rx_input_level_dBm);
|
||||
@@ -94,16 +88,6 @@ static void *scope_thread_UE(void *arg) {
|
||||
0,7);
|
||||
// printf("%s",stats_buffer);
|
||||
}
|
||||
|
||||
# ifdef ENABLE_XFORMS_WRITE_STATS
|
||||
|
||||
if (UE_stats) {
|
||||
rewind (UE_stats);
|
||||
fwrite (stats_buffer, 1, len, UE_stats);
|
||||
fclose (UE_stats);
|
||||
}
|
||||
|
||||
# endif
|
||||
pthread_exit((void *)arg);
|
||||
}
|
||||
|
||||
|
||||
@@ -517,9 +517,6 @@ void phy_scope_gNB(OAI_phy_scope_t *form,
|
||||
}
|
||||
static void *scope_thread_gNB(void *arg) {
|
||||
scopeData_t *p=(scopeData_t *) arg;
|
||||
//# ifdef ENABLE_XFORMS_WRITE_STATS
|
||||
// FILE *gNB_stats = fopen("gNB_stats.txt", "w");
|
||||
//#endif
|
||||
size_t stksize=0;
|
||||
pthread_attr_t atr;
|
||||
pthread_attr_init(&atr);
|
||||
|
||||
@@ -18,17 +18,27 @@
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <stdio.h>
|
||||
#include "time_meas.h"
|
||||
#include <math.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <string.h>
|
||||
#include "assertions.h"
|
||||
#ifndef PHYSIM
|
||||
#include <pthread.h>
|
||||
#include "common/config/config_userapi.h"
|
||||
#endif
|
||||
// global var for openair performance profiler
|
||||
int opp_enabled = 0;
|
||||
double cpu_freq_GHz __attribute__ ((aligned(32)));
|
||||
|
||||
double cpu_freq_GHz __attribute__ ((aligned(32)))=0.0;
|
||||
#ifndef PHYSIM
|
||||
static uint32_t max_cpumeasur;
|
||||
static time_stats_t **measur_table;
|
||||
notifiedFIFO_t measur_fifo;
|
||||
#endif
|
||||
double get_cpu_freq_GHz(void)
|
||||
{
|
||||
if (cpu_freq_GHz <1 ) {
|
||||
@@ -80,9 +90,9 @@ void print_meas_now(time_stats_t *ts,
|
||||
}
|
||||
|
||||
void print_meas(time_stats_t *ts,
|
||||
const char *name,
|
||||
time_stats_t *total_exec_time,
|
||||
time_stats_t *sf_exec_time)
|
||||
const char *name,
|
||||
time_stats_t *total_exec_time,
|
||||
time_stats_t *sf_exec_time)
|
||||
{
|
||||
if (opp_enabled) {
|
||||
static int first_time = 0;
|
||||
@@ -121,6 +131,49 @@ void print_meas(time_stats_t *ts,
|
||||
}
|
||||
}
|
||||
|
||||
int print_meas_log(time_stats_t *ts,
|
||||
const char *name,
|
||||
time_stats_t *total_exec_time,
|
||||
time_stats_t *sf_exec_time,
|
||||
char *output)
|
||||
{
|
||||
int stroff = 0;
|
||||
static int first_time = 0;
|
||||
static double cpu_freq_GHz = 0.0;
|
||||
|
||||
if (cpu_freq_GHz == 0.0)
|
||||
cpu_freq_GHz = get_cpu_freq_GHz();
|
||||
|
||||
if (first_time == 0) {
|
||||
first_time=1;
|
||||
|
||||
if ((total_exec_time == NULL) || (sf_exec_time== NULL))
|
||||
stroff += sprintf(output, "%25s %25s %25s %25s %25s %6f\n","Name","Total","Per Trials", "Num Trials","CPU_F_GHz", cpu_freq_GHz);
|
||||
else
|
||||
stroff += sprintf(output+stroff, "%25s %25s %25s %20s %15s %6f\n","Name","Total","Average/Frame","Trials", "CPU_F_GHz", cpu_freq_GHz);
|
||||
}
|
||||
|
||||
if (ts->trials>0) {
|
||||
//printf("%20s: total: %10.3f ms, average: %10.3f us (%10d trials)\n", name, ts->diff/cpu_freq_GHz/1000000.0, ts->diff/ts->trials/cpu_freq_GHz/1000.0, ts->trials);
|
||||
if ((total_exec_time == NULL) || (sf_exec_time== NULL)) {
|
||||
stroff += sprintf(output+stroff, "%25s: %15.3f us; %15d; %15.3f us;\n",
|
||||
name,
|
||||
(ts->diff/ts->trials/cpu_freq_GHz/1000.0),
|
||||
ts->trials,
|
||||
ts->max/cpu_freq_GHz/1000.0);
|
||||
} else {
|
||||
stroff += sprintf(output+stroff, "%25s: %15.3f ms (%5.2f%%); %15.3f us (%5.2f%%); %15d;\n",
|
||||
name,
|
||||
(ts->diff/cpu_freq_GHz/1000000.0),
|
||||
((ts->diff/cpu_freq_GHz/1000000.0)/(total_exec_time->diff/cpu_freq_GHz/1000000.0))*100, // percentage
|
||||
(ts->diff/ts->trials/cpu_freq_GHz/1000.0),
|
||||
((ts->diff/ts->trials/cpu_freq_GHz/1000.0)/(sf_exec_time->diff/sf_exec_time->trials/cpu_freq_GHz/1000.0))*100, // percentage
|
||||
ts->trials);
|
||||
}
|
||||
}
|
||||
return stroff;
|
||||
}
|
||||
|
||||
double get_time_meas_us(time_stats_t *ts)
|
||||
{
|
||||
static double cpu_freq_GHz = 0.0;
|
||||
@@ -133,3 +186,112 @@ double get_time_meas_us(time_stats_t *ts)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef PHYSIM
|
||||
/* function for the asynchronous measurment module: cpu stat are sent to a dedicated thread
|
||||
* which is in charge of computing the cpu time spent in a given function/algorithm...
|
||||
*/
|
||||
|
||||
time_stats_t *register_meas(char *name)
|
||||
{
|
||||
for (int i=0; i<max_cpumeasur; i++) {
|
||||
if (measur_table[i] == NULL) {
|
||||
measur_table[i] = (time_stats_t *)malloc(sizeof(time_stats_t));
|
||||
memset(measur_table[i] ,0,sizeof(time_stats_t));
|
||||
measur_table[i]->meas_name = strdup(name);
|
||||
measur_table[i]->meas_index = i;
|
||||
measur_table[i]->tpoolmsg =newNotifiedFIFO_elt(sizeof(time_stats_msg_t),0,NULL,NULL);
|
||||
measur_table[i]->tstatptr = (time_stats_msg_t *)NotifiedFifoData(measur_table[i]->tpoolmsg);
|
||||
return measur_table[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void free_measurtbl(void) {
|
||||
for (int i=0; i<max_cpumeasur; i++) {
|
||||
if (measur_table[i] != NULL) {
|
||||
free(measur_table[i]->meas_name);
|
||||
delNotifiedFIFO_elt(measur_table[i]->tpoolmsg);
|
||||
free(measur_table[i]);
|
||||
}
|
||||
}
|
||||
//free the fifo...
|
||||
}
|
||||
|
||||
void run_cpumeasur(void) {
|
||||
struct sched_param schedp;
|
||||
pthread_setname_np(pthread_self(), "measur");
|
||||
schedp.sched_priority=0;
|
||||
int rt=pthread_setschedparam(pthread_self(), SCHED_IDLE, &schedp);
|
||||
AssertFatal(rt==0, "couldn't set measur thread priority: %s\n",strerror(errno));
|
||||
initNotifiedFIFO(&measur_fifo);
|
||||
while(1) {
|
||||
notifiedFIFO_elt_t *msg = pullNotifiedFIFO(&measur_fifo);
|
||||
time_stats_msg_t *tsm = (time_stats_msg_t *)NotifiedFifoData(msg);
|
||||
switch(tsm->msgid) {
|
||||
case TIMESTAT_MSGID_START:
|
||||
measur_table[tsm->timestat_id]->in=tsm->ts;
|
||||
(measur_table[tsm->timestat_id]->trials)++;
|
||||
break;
|
||||
case TIMESTAT_MSGID_STOP:
|
||||
/// process duration is the difference between two clock points
|
||||
measur_table[tsm->timestat_id]->p_time = (tsm->ts - measur_table[tsm->timestat_id]->in);
|
||||
measur_table[tsm->timestat_id]->diff += measur_table[tsm->timestat_id]->p_time;
|
||||
if ( measur_table[tsm->timestat_id]->p_time > measur_table[tsm->timestat_id]->max )
|
||||
measur_table[tsm->timestat_id]->max = measur_table[tsm->timestat_id]->p_time;
|
||||
break;
|
||||
case TIMESTAT_MSGID_DISPLAY:
|
||||
{
|
||||
char aline[256];
|
||||
int start, stop;
|
||||
if (tsm->displayFunc != NULL) {
|
||||
if(tsm->timestat_id >= 0) {
|
||||
start=tsm->timestat_id ;
|
||||
stop=start+1;
|
||||
}
|
||||
else {
|
||||
start=0;
|
||||
stop=max_cpumeasur ;
|
||||
}
|
||||
for (int i=start ; i<stop ; i++) {
|
||||
if (measur_table[i] != NULL) {
|
||||
sprintf(aline,"%s: %15.3f us ",measur_table[i]->meas_name, measur_table[i]->trials==0?0:( (measur_table[i]->trials/measur_table[i]->diff )/ cpu_freq_GHz /1000 ));
|
||||
tsm->displayFunc(aline);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TIMESTAT_MSGID_END:
|
||||
free_measurtbl();
|
||||
delNotifiedFIFO_elt(msg);
|
||||
pthread_exit(NULL);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
delNotifiedFIFO_elt(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void init_meas(void) {
|
||||
pthread_t thid;
|
||||
paramdef_t cpumeasur_params[] = CPUMEASUR_PARAMS_DESC;
|
||||
int numparams=sizeof(cpumeasur_params)/sizeof(paramdef_t);
|
||||
int rt = config_get( cpumeasur_params,numparams,CPUMEASUR_SECTION);
|
||||
AssertFatal(rt >= 0, "cpumeasur configuration couldn't be performed");
|
||||
measur_table=calloc(max_cpumeasur,sizeof( time_stats_t *));
|
||||
AssertFatal(measur_table!=NULL, "couldn't allocate %u cpu measurements entries\n",max_cpumeasur);
|
||||
rt=pthread_create(&thid,NULL, (void *(*)(void *))run_cpumeasur, NULL);
|
||||
AssertFatal(rt==0, "couldn't create cpu measurment thread: %s\n",strerror(errno));
|
||||
}
|
||||
|
||||
void end_meas(void) {
|
||||
notifiedFIFO_elt_t *nfe = newNotifiedFIFO_elt(sizeof(time_stats_msg_t),0,NULL,NULL);
|
||||
time_stats_msg_t *msg = (time_stats_msg_t *)NotifiedFifoData(nfe);
|
||||
msg->msgid = TIMESTAT_MSGID_END ;
|
||||
pushNotifiedFIFO(&measur_fifo, nfe);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -31,37 +31,64 @@
|
||||
#include <pthread.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/types.h>
|
||||
#ifndef PHYSIM
|
||||
#include "common/utils/threadPool/thread-pool.h"
|
||||
#endif
|
||||
// global var to enable openair performance profiler
|
||||
extern int opp_enabled;
|
||||
extern double cpu_freq_GHz __attribute__ ((aligned(32)));;
|
||||
|
||||
// structure to store data to compute cpu measurment
|
||||
#if defined(__x86_64__) || defined(__i386__)
|
||||
typedef struct {
|
||||
long long in;
|
||||
long long diff;
|
||||
long long p_time; /*!< \brief absolute process duration */
|
||||
long long diff_square; /*!< \brief process duration square */
|
||||
long long max;
|
||||
int trials;
|
||||
int meas_flag;
|
||||
} time_stats_t;
|
||||
#define OAI_CPUTIME_TYPE long long
|
||||
#elif defined(__arm__)
|
||||
typedef struct {
|
||||
uint32_t in;
|
||||
uint32_t diff;
|
||||
uint32_t p_time; /*!< \brief absolute process duration */
|
||||
uint32_t diff_square; /*!< \brief process duration square */
|
||||
uint32_t max;
|
||||
int trials;
|
||||
} time_stats_t;
|
||||
#define OAI_CPUTIME_TYPE uint32_t
|
||||
#else
|
||||
#error "building on unsupported CPU architecture"
|
||||
#endif
|
||||
|
||||
#define TIMESTAT_MSGID_START 0 /*!< \brief send time at measure starting point */
|
||||
#define TIMESTAT_MSGID_STOP 1 /*!< \brief send time at measure end point */
|
||||
#define TIMESTAT_MSGID_ENABLE 2 /*!< \brief enable measure point */
|
||||
#define TIMESTAT_MSGID_DISABLE 3 /*!< \brief disable measure point */
|
||||
#define TIMESTAT_MSGID_DISPLAY 10 /*!< \brief display measure */
|
||||
#define TIMESTAT_MSGID_END 11 /*!< \brief stops the measure threads and free assocated resources */
|
||||
typedef void(*meas_printfunc_t)(const char* format, ...);
|
||||
typedef struct {
|
||||
int msgid; /*!< \brief message id, as defined by TIMESTAT_MSGID_X macros */
|
||||
int timestat_id; /*!< \brief points to the time_stats_t entry in cpumeas table */
|
||||
OAI_CPUTIME_TYPE ts; /*!< \brief time stamp */
|
||||
meas_printfunc_t displayFunc; /*!< \brief function to call when DISPLAY message is received*/
|
||||
} time_stats_msg_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
OAI_CPUTIME_TYPE in; /*!< \brief time at measure starting point */
|
||||
OAI_CPUTIME_TYPE diff; /*!< \brief average difference between time at starting point and time at endpoint*/
|
||||
OAI_CPUTIME_TYPE p_time; /*!< \brief absolute process duration */
|
||||
OAI_CPUTIME_TYPE diff_square; /*!< \brief process duration square */
|
||||
OAI_CPUTIME_TYPE max; /*!< \brief maximum difference between time at starting point and time at endpoint*/
|
||||
int trials; /*!< \brief number of start point - end point iterations */
|
||||
int meas_flag; /*!< \brief 1: stop_meas not called (consecutive calls of start_meas) */
|
||||
char *meas_name; /*!< \brief name to use when printing the measure (not used for PHY simulators)*/
|
||||
int meas_index; /*!< \brief index of this measure in the measure array (not used for PHY simulators)*/
|
||||
int meas_enabled; /*!< \brief per measure enablement flag. send_meas tests this flag, unused today in start_meas and stop_meas*/
|
||||
#ifndef PHYSIM
|
||||
notifiedFIFO_elt_t *tpoolmsg; /*!< \brief message pushed to the cpu measurment queue to report a measure START or STOP */
|
||||
time_stats_msg_t *tstatptr; /*!< \brief pointer to the time_stats_msg_t data in the tpoolmsg, stored here for perf considerations*/
|
||||
#endif
|
||||
} time_stats_t;
|
||||
#define MEASURE_ENABLED(X) (X->meas_enabled)
|
||||
|
||||
|
||||
|
||||
|
||||
static inline void start_meas(time_stats_t *ts) __attribute__((always_inline));
|
||||
static inline void stop_meas(time_stats_t *ts) __attribute__((always_inline));
|
||||
|
||||
|
||||
void print_meas_now(time_stats_t *ts, const char *name, FILE *file_name);
|
||||
void print_meas(time_stats_t *ts, const char *name, time_stats_t *total_exec_time, time_stats_t *sf_exec_time);
|
||||
int print_meas_log(time_stats_t *ts, const char *name, time_stats_t *total_exec_time, time_stats_t *sf_exec_time, char *output);
|
||||
double get_time_meas_us(time_stats_t *ts);
|
||||
double get_cpu_freq_GHz(void);
|
||||
|
||||
@@ -137,4 +164,28 @@ static inline void copy_meas(time_stats_t *dst_ts,time_stats_t *src_ts) {
|
||||
dst_ts->max=src_ts->max;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef PHYSIM
|
||||
extern notifiedFIFO_t measur_fifo;
|
||||
#define CPUMEASUR_SECTION "cpumeasur"
|
||||
|
||||
#define CPUMEASUR_PARAMS_DESC { \
|
||||
{"max_cpumeasur", "Max number of cpu measur entries", 0, uptr:&max_cpumeasur, defintval:100, TYPE_UINT, 0},\
|
||||
}
|
||||
|
||||
void init_meas(void);
|
||||
time_stats_t *register_meas(char *name);
|
||||
#define START_MEAS(X) send_meas(X, TIMESTAT_MSGID_START)
|
||||
#define STOP_MEAS(X) send_meas(X, TIMESTAT_MSGID_STOP)
|
||||
static inline void send_meas(time_stats_t *ts, int msgid) {
|
||||
if (MEASURE_ENABLED(ts) ) {
|
||||
ts->tstatptr->timestat_id=ts->meas_index;
|
||||
ts->tstatptr->msgid = msgid ;
|
||||
ts->tstatptr->ts = rdtsc_oai();
|
||||
pushNotifiedFIFO(&measur_fifo, ts->tpoolmsg);
|
||||
}
|
||||
}
|
||||
void end_meas(void);
|
||||
|
||||
#endif //ifndef PHYSIM
|
||||
#endif
|
||||
|
||||
@@ -48,7 +48,6 @@
|
||||
#ifdef MEX
|
||||
#define msg mexPrintf
|
||||
#else
|
||||
#ifdef OPENAIR2
|
||||
#if ENABLE_RAL
|
||||
#include "collection/hashtable/hashtable.h"
|
||||
#include "COMMON/ral_messages_types.h"
|
||||
@@ -56,9 +55,6 @@
|
||||
#endif
|
||||
#include "common/utils/LOG/log.h"
|
||||
#define msg(aRGS...) LOG_D(PHY, ##aRGS)
|
||||
#else
|
||||
#define msg printf
|
||||
#endif
|
||||
#endif
|
||||
//use msg in the real-time thread context
|
||||
#define msg_nrt printf
|
||||
@@ -196,19 +192,6 @@ typedef struct {
|
||||
NB_IoT_UE_DLSCH_t *dlsch_rn_MCH[10];
|
||||
|
||||
} PHY_VARS_RN_NB_IoT;
|
||||
/*
|
||||
#ifdef OCP_FRAMEWORK
|
||||
#include <enums.h>
|
||||
#else
|
||||
//typedef enum {normal_txrx=0,rx_calib_ue=1,rx_calib_ue_med=2,rx_calib_ue_byp=3,debug_prach=4,no_L2_connect=5,calib_prach_tx=6,rx_dump_frame=7,loop_through_memory=8} runmode_t;
|
||||
*/
|
||||
// enum transmission_access_mode {
|
||||
// NO_ACCESS=0,
|
||||
// POSTPONED_ACCESS,
|
||||
// CANCELED_ACCESS,
|
||||
// UNKNOWN_ACCESS,
|
||||
// SCHEDULED_ACCESS,
|
||||
// CBA_ACCESS};
|
||||
|
||||
typedef enum {
|
||||
eNodeB_3GPP_NB_IoT=0, // classical eNodeB function
|
||||
|
||||
@@ -762,6 +762,7 @@ typedef struct RRU_config_s {
|
||||
typedef struct processingData_RU {
|
||||
int frame_tx;
|
||||
int slot_tx;
|
||||
int next_slot;
|
||||
openair0_timestamp timestamp_tx;
|
||||
RU_t *ru;
|
||||
} processingData_RU_t;
|
||||
|
||||
@@ -87,7 +87,6 @@
|
||||
#define LOG_W(x, ...) mexPrintf(__VA_ARGS__)
|
||||
#define LOG_M(x, ...) mexPrintf(__VA_ARGS__)
|
||||
#else
|
||||
#ifdef OPENAIR2
|
||||
#if ENABLE_RAL
|
||||
#include "collection/hashtable/hashtable.h"
|
||||
#include "COMMON/ral_messages_types.h"
|
||||
@@ -95,9 +94,6 @@
|
||||
#endif
|
||||
#include "common/utils/LOG/log.h"
|
||||
#define msg(aRGS...) LOG_D(PHY, ##aRGS)
|
||||
#else
|
||||
#define msg printf
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
+26
-5
@@ -122,8 +122,6 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
uint8_t active;
|
||||
int frame;
|
||||
int slot;
|
||||
nfapi_nr_dl_tti_csi_rs_pdu csirs_pdu;
|
||||
} NR_gNB_CSIRS_t;
|
||||
|
||||
@@ -251,6 +249,8 @@ typedef struct {
|
||||
uint32_t slot;
|
||||
/// Index of current HARQ round for this DLSCH
|
||||
uint8_t round;
|
||||
uint8_t ndi;
|
||||
bool new_rx;
|
||||
/// Last TPC command
|
||||
uint8_t TPC;
|
||||
/// MIMO mode for this DLSCH
|
||||
@@ -764,7 +764,6 @@ typedef struct PHY_VARS_gNB_s {
|
||||
// nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu;
|
||||
// nfapi_nr_ul_dci_request_pdus_t *ul_dci_pdu;
|
||||
uint16_t num_pdsch_rnti[80];
|
||||
NR_gNB_SSB_t ssb[64];
|
||||
NR_gNB_PBCH pbch;
|
||||
nr_cce_t cce_list[MAX_DCI_CORESET][NR_MAX_PDCCH_AGG_LEVEL];
|
||||
NR_gNB_COMMON common_vars;
|
||||
@@ -772,7 +771,6 @@ typedef struct PHY_VARS_gNB_s {
|
||||
NR_gNB_PUSCH *pusch_vars[NUMBER_OF_NR_ULSCH_MAX];
|
||||
NR_gNB_PUCCH_t *pucch[NUMBER_OF_NR_PUCCH_MAX];
|
||||
NR_gNB_PDCCH_t pdcch_pdu[NUMBER_OF_NR_PDCCH_MAX];
|
||||
NR_gNB_CSIRS_t csirs_pdu[NUMBER_OF_NR_CSIRS_MAX];
|
||||
NR_gNB_UL_PDCCH_t ul_pdcch_pdu[NUMBER_OF_NR_PDCCH_MAX];
|
||||
NR_gNB_DLSCH_t *dlsch[NUMBER_OF_NR_DLSCH_MAX][2]; // Nusers times two spatial streams
|
||||
NR_gNB_ULSCH_t *ulsch[NUMBER_OF_NR_ULSCH_MAX][2]; // [Nusers times][2 codewords]
|
||||
@@ -855,10 +853,13 @@ typedef struct PHY_VARS_gNB_s {
|
||||
int pusch_thres;
|
||||
int prach_thres;
|
||||
uint64_t bad_pucch;
|
||||
int num_ulprbbl;
|
||||
int ulprbbl[275];
|
||||
/*
|
||||
time_stats_t phy_proc;
|
||||
*/
|
||||
time_stats_t phy_proc_tx;
|
||||
time_stats_t *phy_proc_tx_0;
|
||||
time_stats_t *phy_proc_tx_1;
|
||||
time_stats_t phy_proc_rx;
|
||||
time_stats_t rx_prach;
|
||||
/*
|
||||
@@ -950,4 +951,24 @@ typedef struct processingData_L1 {
|
||||
PHY_VARS_gNB *gNB;
|
||||
} processingData_L1_t;
|
||||
|
||||
typedef enum {
|
||||
FILLED,
|
||||
FILLING,
|
||||
NOT_FILLED
|
||||
} msgStatus_t;
|
||||
|
||||
typedef struct processingData_L1tx {
|
||||
int frame;
|
||||
int slot;
|
||||
openair0_timestamp timestamp_tx;
|
||||
PHY_VARS_gNB *gNB;
|
||||
nfapi_nr_dl_tti_pdcch_pdu pdcch_pdu;
|
||||
nfapi_nr_ul_dci_request_pdus_t ul_pdcch_pdu;
|
||||
NR_gNB_CSIRS_t csirs_pdu[NUMBER_OF_NR_CSIRS_MAX];
|
||||
NR_gNB_DLSCH_t *dlsch[NUMBER_OF_NR_DLSCH_MAX][2];
|
||||
NR_gNB_SSB_t ssb[64];
|
||||
uint16_t num_pdsch_slot;
|
||||
time_stats_t phy_proc_tx;
|
||||
} processingData_L1tx_t;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -51,16 +51,12 @@
|
||||
#ifdef MEX
|
||||
#define msg mexPrintf
|
||||
#else
|
||||
#ifdef OPENAIR2
|
||||
#if ENABLE_RAL
|
||||
#include "common/utils/hashtable/hashtable.h"
|
||||
#include "COMMON/ral_messages_types.h"
|
||||
#include "UTIL/queue.h"
|
||||
#endif
|
||||
#define msg(aRGS...) LOG_D(PHY, ##aRGS)
|
||||
#else
|
||||
#define msg printf
|
||||
#endif
|
||||
#endif
|
||||
//use msg in the real-time thread context
|
||||
#define msg_nrt printf
|
||||
@@ -638,7 +634,7 @@ typedef struct {
|
||||
uint8_t dciFormat;
|
||||
uint8_t agregationLevel;
|
||||
int nb_search_space;
|
||||
fapi_nr_dl_config_dci_dl_pdu_rel15_t pdcch_config[FAPI_NR_MAX_SS_PER_CORESET];
|
||||
fapi_nr_dl_config_dci_dl_pdu_rel15_t pdcch_config[FAPI_NR_MAX_SS];
|
||||
// frame and slot for sib1 in initial sync
|
||||
uint16_t sfn;
|
||||
uint16_t slot;
|
||||
@@ -767,6 +763,10 @@ typedef struct {
|
||||
int UE_scan_carrier;
|
||||
/// \brief Indicator that UE should enable estimation and compensation of frequency offset
|
||||
int UE_fo_compensation;
|
||||
/// IF frequency for RF
|
||||
uint64_t if_freq;
|
||||
/// UL IF frequency offset for RF
|
||||
int if_freq_off;
|
||||
/// \brief Indicator that UE is synchronized to a gNB
|
||||
int is_synchronized;
|
||||
/// \brief Indicator that UE lost frame synchronization
|
||||
@@ -917,9 +917,10 @@ typedef struct {
|
||||
uint8_t init_sync_frame;
|
||||
/// temporary offset during cell search prior to MIB decoding
|
||||
int ssb_offset;
|
||||
uint16_t symbol_offset; // offset in terms of symbols for detected ssb in sync
|
||||
int rx_offset; /// Timing offset
|
||||
uint16_t symbol_offset; /// offset in terms of symbols for detected ssb in sync
|
||||
int rx_offset; /// Timing offset
|
||||
int rx_offset_diff; /// Timing adjustment for ofdm symbol0 on HW USRP
|
||||
int max_pos_fil; /// Timing offset IIR filter
|
||||
int time_sync_cell;
|
||||
|
||||
/// Timing Advance updates variables
|
||||
|
||||
@@ -272,9 +272,14 @@
|
||||
#define NB_NUMEROLOGIES_NR (5)
|
||||
#define TDD_CONFIG_NB_FRAMES (2)
|
||||
#define NR_MAX_SLOTS_PER_FRAME (160) /* number of slots per frame */
|
||||
#define NR_UE_CAPABILITY_SLOT_RX_TO_TX (5) /* FFS_NR_TODO it defines ue capability which is the number of slots */
|
||||
/* - between reception of pdsch and tarnsmission of its acknowlegment */
|
||||
/* - between reception of un uplink grant and its related transmission */
|
||||
|
||||
/* FFS_NR_TODO it defines ue capability which is the number of slots */
|
||||
/* - between reception of pdsch and tarnsmission of its acknowlegment */
|
||||
/* - between reception of un uplink grant and its related transmission */
|
||||
/* - FIXME temprarily set to 5 to avoid timing issues at OAI UE in rfsimulator */
|
||||
/* - issues caused by no rendez-vous point between TX and RX in the OAI UE */
|
||||
#define NR_UE_CAPABILITY_SLOT_RX_TO_TX (5)
|
||||
|
||||
#ifndef NO_RAT_NR
|
||||
#define DURATION_RX_TO_TX (NR_UE_CAPABILITY_SLOT_RX_TO_TX) /* for NR this will certainly depends to such UE capability which is not yet defined */
|
||||
#else
|
||||
|
||||
@@ -55,12 +55,6 @@ extern char mode_string[4][20];
|
||||
extern unsigned char NB_RU;
|
||||
|
||||
|
||||
#ifndef OPENAIR2
|
||||
extern unsigned char NB_eNB_INST;
|
||||
extern uint16_t NB_UE_INST;
|
||||
extern unsigned char NB_RN_INST;
|
||||
#endif
|
||||
|
||||
extern int flag_LA;
|
||||
extern double sinr_bler_map[MCS_COUNT][2][MCS_TABLE_LENGTH_MAX];
|
||||
extern double sinr_bler_map_up[MCS_COUNT][2][16];
|
||||
|
||||
@@ -63,12 +63,6 @@ extern char mode_string[4][20];
|
||||
|
||||
extern unsigned char NB_RU;
|
||||
|
||||
#ifndef OPENAIR2
|
||||
extern unsigned char NB_eNB_INST;
|
||||
extern uint16_t NB_UE_INST;
|
||||
extern unsigned char NB_RN_INST;
|
||||
#endif
|
||||
|
||||
extern int flag_LA;
|
||||
extern double sinr_bler_map[MCS_COUNT][2][MCS_TABLE_LENGTH_MAX];
|
||||
extern double sinr_bler_map_up[MCS_COUNT][2][16];
|
||||
|
||||
@@ -53,12 +53,6 @@ extern int flagMag;
|
||||
extern char mode_string[4][20];
|
||||
|
||||
|
||||
#ifndef OPENAIR2
|
||||
extern unsigned char NB_eNB_INST;
|
||||
extern uint16_t NB_UE_INST;
|
||||
extern unsigned char NB_RN_INST;
|
||||
#endif
|
||||
|
||||
extern int flag_LA;
|
||||
extern double sinr_bler_map[MCS_COUNT][2][MCS_TABLE_LENGTH_MAX];
|
||||
extern double sinr_bler_map_up[MCS_COUNT][2][16];
|
||||
|
||||
@@ -55,13 +55,6 @@ const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1};
|
||||
|
||||
unsigned char NB_RU=0;
|
||||
|
||||
#ifndef OPENAIR2
|
||||
//unsigned char NB_eNB_INST=0;
|
||||
//uint16_t NB_UE_INST=0;
|
||||
//unsigned char NB_RN_INST=0;
|
||||
//unsigned char NB_INST=0;
|
||||
#endif
|
||||
|
||||
int number_of_cards;
|
||||
|
||||
|
||||
|
||||
@@ -57,13 +57,6 @@ const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1};
|
||||
|
||||
unsigned char NB_RU=0;
|
||||
|
||||
#ifndef OPENAIR2
|
||||
unsigned char NB_eNB_INST=0;
|
||||
uint16_t NB_UE_INST=0;
|
||||
unsigned char NB_RN_INST=0;
|
||||
unsigned char NB_INST=0;
|
||||
#endif
|
||||
|
||||
|
||||
int number_of_cards;
|
||||
|
||||
|
||||
@@ -47,14 +47,6 @@ const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1};
|
||||
#include "SIMULATION/ETH_TRANSPORT/vars.h"
|
||||
|
||||
|
||||
#ifndef OPENAIR2
|
||||
unsigned char NB_eNB_INST=0;
|
||||
uint16_t NB_UE_INST=0;
|
||||
unsigned char NB_RN_INST=0;
|
||||
unsigned char NB_INST=0;
|
||||
#endif
|
||||
|
||||
|
||||
int number_of_cards;
|
||||
|
||||
|
||||
|
||||
@@ -22,11 +22,6 @@
|
||||
#ifndef __openair_TYPES_NB_IOT_H__
|
||||
#define __openair_TYPES_NB_IOT_H__
|
||||
|
||||
#ifdef USER_MODE
|
||||
#include <stdint.h>
|
||||
#else
|
||||
#include <linux/types.h>
|
||||
#endif
|
||||
|
||||
|
||||
#endif /*__openair_TYPES_NB_IOT_H__ */
|
||||
|
||||
Reference in New Issue
Block a user