From 6d90aaaae2cf133fd54fa3816e672bf40ce3e7b1 Mon Sep 17 00:00:00 2001
From: Robert Schmidt <robert.schmidt@openairinterface.org>
Date: Tue, 28 Feb 2023 14:01:16 +0100
Subject: [PATCH] (Almost) Remove all PHY/phy_vars* and PHY/phy_extern

---
 doc/Doxyfile                                  |   1 -
 executables/lte-ru.c                          |   8 +-
 executables/main_ru.c                         |   2 +
 openair1/PHY/INIT/lte_init_ru.c               |   3 +-
 openair1/PHY/INIT/nr_init_ru.c                |   3 +-
 openair1/PHY/LTE_ESTIMATION/lte_sync_time.c   |   2 +-
 .../PHY/LTE_ESTIMATION/lte_sync_timefreq.c    |   1 +
 .../PHY/LTE_ESTIMATION/lte_ue_measurements.c  |   1 +
 .../lte_ul_channel_estimation.c               |   4 +-
 openair1/PHY/LTE_REFSIG/README.txt            |   1 -
 openair1/PHY/LTE_REFSIG/primary_synch.h       |  27 -
 openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c |   4 +-
 openair1/PHY/LTE_TRANSPORT/dlsch_tbs.h        |   5 +
 openair1/PHY/LTE_TRANSPORT/print_stats.c      | 753 ------------------
 openair1/PHY/LTE_TRANSPORT/pss.c              |   2 +-
 .../PHY/LTE_TRANSPORT/ulsch_demodulation.c    |   3 -
 openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c  |  59 +-
 .../PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c |   2 +-
 openair1/PHY/LTE_UE_TRANSPORT/pbch_ue.c       |   2 +-
 openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c       |   2 +-
 openair1/PHY/LTE_UE_TRANSPORT/pucch_ue.c      |   1 +
 openair1/PHY/LTE_UE_TRANSPORT/rar_tools_ue.c  |   1 +
 .../PHY/LTE_UE_TRANSPORT/srs_modulation.c     |  66 +-
 openair1/PHY/LTE_UE_TRANSPORT/sss_ue.c        |   4 +-
 openair1/PHY/LTE_UE_TRANSPORT/uci_tools_ue.c  |   1 -
 openair1/PHY/LTE_UE_TRANSPORT/ulsch_coding.c  |   1 +
 .../PHY/LTE_UE_TRANSPORT/ulsch_modulation.c   |   1 +
 openair1/PHY/NR_UE_TRANSPORT/dci_nr.c         |   2 +-
 .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c   |   2 +-
 openair1/PHY/phy_extern.h                     | 147 ++--
 openair1/PHY/phy_extern_nr_ue.h               |  83 --
 openair1/PHY/phy_extern_ue.h                  |  72 +-
 openair1/PHY/phy_vars.h                       |  92 +--
 openair1/PHY/phy_vars_nr_ue.h                 |   8 -
 openair1/PHY/phy_vars_ue.h                    |  86 +-
 openair1/SCHED_UE/phy_procedures_lte_ue.c     |   2 +-
 openair1/SCHED_UE/pusch_pc.c                  |   3 +-
 openair1/SCHED_UE/srs_pc.c                    |   1 +
 openair1/SIMULATION/LTE_PHY/ulsim.c           |   6 +-
 openair2/LAYER2/MAC/mac.h                     |   2 +
 40 files changed, 199 insertions(+), 1267 deletions(-)
 delete mode 100644 openair1/PHY/LTE_REFSIG/primary_synch.h
 delete mode 100644 openair1/PHY/LTE_TRANSPORT/print_stats.c

diff --git a/doc/Doxyfile b/doc/Doxyfile
index 51492143d76..198bede6073 100644
--- a/doc/Doxyfile
+++ b/doc/Doxyfile
@@ -2244,7 +2244,6 @@ INPUT                  = \
 @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/defs_L1_NB_IoT.h \
 @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/phy_extern_ue.h \
 @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/defs_gNB.h \
-@CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/LTE_REFSIG/primary_synch.h \
 @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/LTE_REFSIG/lte_dl_cell_spec.c \
 @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/LTE_REFSIG/defs_NB_IoT.h \
 @CMAKE_CURRENT_SOURCE_DIR@/../openair1/PHY/LTE_REFSIG/lte_refsig.h \
diff --git a/executables/lte-ru.c b/executables/lte-ru.c
index 8d5f4254ee7..a784ee5a099 100644
--- a/executables/lte-ru.c
+++ b/executables/lte-ru.c
@@ -51,6 +51,7 @@
 #include "PHY/defs_common.h"
 #include "PHY/types.h"
 #include "PHY/INIT/phy_init.h"
+#include "PHY/phy_extern.h"
 #include "PHY/LTE_ESTIMATION/lte_estimation.h"
 #include "PHY/LTE_REFSIG/lte_refsig.h"
 #include "PHY/LTE_TRANSPORT/if4_tools.h"
@@ -105,13 +106,6 @@ void wait_eNBs(void);
 
 const char ru_states[6][9] = {"RU_IDLE","RU_CONFIG","RU_READY","RU_RUN","RU_ERROR","RU_SYNC"};
 
-extern const char NB_functions[7][20];
-extern const char NB_timing[2][20];
-
-
-extern const char ru_if_types[MAX_RU_IF_TYPES][20];
-
-
 #if defined(PRE_SCD_THREAD)
 #include "common/ran_context.h"
 #include "nfapi/oai_integration/vendor_ext.h"
diff --git a/executables/main_ru.c b/executables/main_ru.c
index ee2e6dc39c6..33e01f5bffd 100644
--- a/executables/main_ru.c
+++ b/executables/main_ru.c
@@ -49,12 +49,14 @@
 #include "radio/ETHERNET/USERSPACE/LIB/if_defs.h"
 
 #include "PHY/phy_vars.h"
+#include "PHY/phy_extern.h"
 #include "PHY/TOOLS/phy_scope_interface.h"
 #include "common/utils/LOG/log.h"
 #include "common/utils/LOG/vcd_signal_dumper.h"
 #include "PHY/INIT/phy_init.h"
 #include "openair2/ENB_APP/enb_paramdef.h"
 #include "system.h"
+#include "nfapi/oai_integration/vendor_ext.h"
 
 #include <executables/softmodem-common.h>
 #include <executables/thread-common.h>
diff --git a/openair1/PHY/INIT/lte_init_ru.c b/openair1/PHY/INIT/lte_init_ru.c
index a856c33999e..c07c9230d89 100644
--- a/openair1/PHY/INIT/lte_init_ru.c
+++ b/openair1/PHY/INIT/lte_init_ru.c
@@ -20,6 +20,7 @@
  */
 
 #include "phy_init.h"
+#include "PHY/phy_extern.h"
 #include "SCHED/sched_eNB.h"
 #include "PHY/LTE_REFSIG/lte_refsig.h"
 //#include "SIMULATION/TOOLS/sim.h"
@@ -33,8 +34,6 @@
 
 void init_7_5KHz(void);
 
-extern const char ru_if_types[MAX_RU_IF_TYPES][20];
-
 int phy_init_RU(RU_t *ru) {
   LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
   RU_CALIBRATION *calibration = &ru->calibration;
diff --git a/openair1/PHY/INIT/nr_init_ru.c b/openair1/PHY/INIT/nr_init_ru.c
index f1810e55411..6b433f17d10 100644
--- a/openair1/PHY/INIT/nr_init_ru.c
+++ b/openair1/PHY/INIT/nr_init_ru.c
@@ -20,6 +20,7 @@
  */
 
 #include "phy_init.h"
+#include "PHY/phy_extern.h"
 #include "SCHED/sched_common.h"
 #include "common/utils/LOG/vcd_signal_dumper.h"
 #include "assertions.h"
@@ -28,8 +29,6 @@
 
 void init_prach_ru_list(RU_t *ru);
 
-extern const char ru_if_types[MAX_RU_IF_TYPES][20];
-
 int nr_phy_init_RU(RU_t *ru) {
 
   NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
index d699e7ebd96..8587bf1f701 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
@@ -28,7 +28,7 @@
 //#include <string.h>
 #include <math.h>
 #include "PHY/defs_UE.h"
-#include "PHY/phy_extern_ue.h"
+#include "PHY/phy_extern.h"
 #include "PHY/LTE_REFSIG/lte_refsig.h"
 
 // Note: this is for prototype of generate_drs_pusch (OTA synchronization of RRUs)
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_timefreq.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_timefreq.c
index 524b200e1a1..780c3955cf9 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_sync_timefreq.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_timefreq.c
@@ -38,6 +38,7 @@
 //#include "defs.h"
 #include "PHY/defs_UE.h"
 #include "PHY/phy_extern_ue.h"
+#include "PHY/phy_extern.h"
 
 #if defined(__x86_64__) || defined(__i386__)
 #include "pss6144.h"
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c
index 16b818e90f4..340da97d48d 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c
@@ -23,6 +23,7 @@
 
 #include "PHY/defs_UE.h"
 #include "PHY/phy_extern_ue.h"
+#include "PHY/phy_extern.h"
 #include "common/utils/LOG/log.h"
 #include "PHY/sse_intrin.h"
 
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c
index 152a2983987..5d5e9c5d567 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c
@@ -20,7 +20,7 @@
  */
 
 #include "PHY/defs_eNB.h"
-//#include "PHY/phy_extern.h"
+#include "PHY/phy_extern.h"
 #include "PHY/sse_intrin.h"
 //#define DEBUG_CH
 #include "common/utils/LOG/log.h"
@@ -35,8 +35,6 @@ static int16_t ru_90c[2*128] = {32767, 0,32766, -402,32758, -804,32746, -1206,32
 
 #define SCALE 0x3FFF
 
-static const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1};
-
 int32_t lte_ul_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
                                   L1_rxtx_proc_t *proc,
 				  LTE_eNB_ULSCH_t * ulsch,
diff --git a/openair1/PHY/LTE_REFSIG/README.txt b/openair1/PHY/LTE_REFSIG/README.txt
index eae92fb389a..8d0014f39b4 100644
--- a/openair1/PHY/LTE_REFSIG/README.txt
+++ b/openair1/PHY/LTE_REFSIG/README.txt
@@ -5,7 +5,6 @@ lte_gold.c          : Generators for LTE gold sequences (used for pilots and scr
 lte_ul_ref.c        : UL DRS signal generation for TX and RX
 defs.h              : data structures and function prototypes
 mod_table.h         : lookup tables for QAM modulation (CBMIMO1 tables)
-primary_synch.h     : 3 PSS sequences
 primary_synch.m     : MATLAB/OCTAVE generator for PSS
 gen_mod_table.m     : MATLAB/OCTAVE generator for CBMIMO1 mod_table.h
 lte_ul.m            : MATLAB/OCTAVE generator for UL (SC-FDMA) DFT sizes                           
diff --git a/openair1/PHY/LTE_REFSIG/primary_synch.h b/openair1/PHY/LTE_REFSIG/primary_synch.h
deleted file mode 100644
index 8152722df32..00000000000
--- a/openair1/PHY/LTE_REFSIG/primary_synch.h
+++ /dev/null
@@ -1,27 +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
- */
-
-short primary_synch0[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-26120,-19785,11971,-30502,-24020,-22288,32117,6492,31311,9658,-16384,-28378,25100,-21063,-7292,-31946,20429,25618,14948,29158,11971,-30502,31311,9658,25100,-21063,-16384,28377,-24020,22287,32117,6492,-7292,31945,20429,25618,-26120,-19785,-16384,-28378,-16384,28377,-26120,-19785,-32402,4883,31311,-9659,32117,6492,-7292,-31946,32767,-1,25100,-21063,-24020,22287,-32402,4883,-32402,4883,-24020,22287,25100,-21063,32767,-1,-7292,-31946,32117,6492,31311,-9659,-32402,4883,-26120,-19785,-16384,28377,-16384,-28378,-26120,-19785,20429,25618,-7292,31945,32117,6492,-24020,22287,-16384,28377,25100,-21063,31311,9658,11971,-30502,14948,29158,20429,25618,-7292,-31946,25100,-21063,-16384,-28378,31311,9658,32117,6492,-24020,-22288,11971,-30502,-26120,-19785,32767,0,0,0,0,0,0,0,0,0,0,0};
-short primary_synch1[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-31754,-8086,-24020,-22288,2448,32675,-26120,19784,27073,18458,-16384,28377,25100,21062,-29523,14217,-7292,31945,-13477,-29868,-24020,-22288,27073,18458,25100,21062,-16384,-28378,2448,-32676,-26120,19784,-29523,-14218,-7292,31945,-31754,-8086,-16384,28377,-16384,-28378,-31754,-8086,31311,-9659,27073,-18459,-26120,19784,-29523,14217,32767,-1,25100,21062,2448,-32676,31311,-9659,31311,-9659,2448,-32676,25100,21062,32767,0,-29523,14217,-26120,19784,27073,-18459,31311,-9659,-31754,-8086,-16384,-28378,-16384,28377,-31754,-8086,-7292,31945,-29523,-14218,-26120,19784,2448,-32676,-16384,-28378,25100,21062,27073,18458,-24020,-22288,-13477,-29868,-7292,31945,-29523,14217,25100,21062,-16384,28377,27073,18458,-26120,19784,2448,32675,-24020,-22288,-31754,-8086,32767,0,0,0,0,0,0,0,0,0,0,0};
-short primary_synch2[144] = {0,0,0,0,0,0,0,0,0,0,32767,0,-31754,8085,-24020,22287,2448,-32676,-26120,-19785,27073,-18459,-16384,-28378,25100,-21063,-29523,-14218,-7292,-31946,-13477,29867,-24020,22287,27073,-18459,25100,-21063,-16384,28377,2448,32675,-26120,-19785,-29523,14217,-7292,-31946,-31754,8085,-16384,-28378,-16384,28377,-31754,8085,31311,9658,27073,18458,-26120,-19785,-29523,-14218,32767,0,25100,-21063,2448,32675,31311,9658,31311,9658,2448,32675,25100,-21063,32767,0,-29523,-14218,-26120,-19785,27073,18458,31311,9658,-31754,8085,-16384,28377,-16384,-28378,-31754,8085,-7292,-31946,-29523,14217,-26120,-19785,2448,32675,-16384,28377,25100,-21063,27073,-18459,-24020,22287,-13477,29867,-7292,-31946,-29523,-14218,25100,-21063,-16384,-28378,27073,-18459,-26120,-19785,2448,-32676,-24020,22287,-31754,8085,32767,-1,0,0,0,0,0,0,0,0,0,0};
-unsigned char primary_synch0_tab[72] = {0,0,0,0,0,85,110,97,109,146,145,106,92,103,139,137,97,145,92,127,124,146,130,139,110,106,127,110,118,88,146,103,85,92,124,118,118,124,92,85,103,146,88,118,110,127,106,110,139,130,146,124,127,92,145,97,137,139,103,92,106,145,146,109,97,110,85,0,0,0,0,0};
-unsigned char primary_synch1_tab[72] = {0,0,0,0,0,85,114,109,133,123,142,127,141,121,130,105,109,142,141,106,100,123,112,130,114,127,106,114,88,91,123,121,85,141,100,88,88,100,141,85,121,123,91,88,114,106,127,114,130,112,123,100,106,141,142,109,105,130,121,141,127,142,123,133,109,114,85,0,0,0,0,0};
-unsigned char primary_synch2_tab[72] = {0,0,0,0,0,85,119,124,100,110,91,106,92,112,103,128,124,91,92,127,133,110,121,103,119,106,127,119,145,142,110,112,85,92,133,145,145,133,92,85,112,110,142,145,119,127,106,119,103,121,110,133,127,92,91,124,128,103,112,92,106,91,110,100,124,119,85,0,0,0,0,0};
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c b/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c
index 015a95a8624..7075b74fe12 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_scrambling.c
@@ -163,8 +163,7 @@ void dlsch_scrambling(LTE_DL_FRAME_PARMS *frame_parms,
   VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_SCRAMBLING, VCD_FUNCTION_OUT);
 }
 
-
-
+uint8_t scrambling_lut[65536*16] __attribute__((aligned(32)));
 void init_scrambling_lut(void) {
   uint32_t s;
   int i=0,j;
@@ -215,6 +214,7 @@ void dlsch_unscrambling(LTE_DL_FRAME_PARMS *frame_parms,
   }
 }
 
+int16_t unscrambling_lut[65536*16] __attribute__((aligned(32)));
 void init_unscrambling_lut(void) {
   uint32_t s;
   int i=0,j;
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_tbs.h b/openair1/PHY/LTE_TRANSPORT/dlsch_tbs.h
index 3a18924fe4f..863eb33d34f 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_tbs.h
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_tbs.h
@@ -19,6 +19,9 @@
  *      contact@openairinterface.org
  */
 
+#ifndef DLSCH_TBS_H_
+#define DLSCH_TBS_H_
+
 static const unsigned int dlsch_tbs25[27][25] = {
     {16, 32, 56, 88, 120, 152, 176, 208, 224, 256, 288, 328, 344, 376, 392, 424, 456, 488, 504, 536, 568, 600, 616, 648, 680},
     {24, 56, 88, 144, 176, 208, 224, 256, 328, 344, 376, 424, 456, 488, 520, 568, 600, 632, 680, 712, 744, 776, 808, 872, 904},
@@ -47,3 +50,5 @@ static const unsigned int dlsch_tbs25[27][25] = {
     {584, 1192, 1800, 2408, 2984, 3624, 4264, 4968, 5544, 5992, 6712, 7224, 7992, 8504, 9144, 9912, 10296, 11064, 11448, 12216, 12960, 13536, 14112, 14688, 15264},
     {616, 1256, 1864, 2536, 3112, 3752, 4392, 5160, 5736, 6200, 6968, 7480, 8248, 8760, 9528, 10296, 10680, 11448, 12216, 12576, 13536, 14112, 14688, 15264, 15840},
     {712, 1480, 2216, 2984, 3752, 4392, 5160, 5992, 6712, 7480, 8248, 8760, 9528, 10296, 11064, 11832, 12576, 13536, 14112, 14688, 15264, 16416, 16992, 17568, 18336}};
+
+#endif /* DLSCH_TBS_H_ */
diff --git a/openair1/PHY/LTE_TRANSPORT/print_stats.c b/openair1/PHY/LTE_TRANSPORT/print_stats.c
deleted file mode 100644
index 856e392070b..00000000000
--- a/openair1/PHY/LTE_TRANSPORT/print_stats.c
+++ /dev/null
@@ -1,753 +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/LTE_TRANSPORT/print_stats.c
-* \brief PHY statstic logging function
-* \author R. Knopp, F. Kaltenberger, navid nikaein
-* \date 2011
-* \version 0.1
-* \company Eurecom
-* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr, navid.nikaein@eurecom.fr
-* \note
-* \warning
-*/
-
-#include "PHY/LTE_TRANSPORT/proto.h"
-#include "executables/lte-softmodem.h"
-#include "PHY/defs.h"
-#include "PHY/extern.h"
-#include "SCHED/extern.h"
-
-  #include "openair2/LAYER2/MAC/proto.h"
-  #include "openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
-
-extern int mac_get_rrc_status(uint8_t Mod_id,uint8_t eNB_flag,uint8_t index);
-
-#include "common_lib.h"
-extern openair0_config_t openair0_cfg[];
-
-
-int dump_ue_stats(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc,char *buffer, int length, runmode_t mode, int input_level_dBm) {
-  uint8_t eNB=0;
-  uint32_t RRC_status;
-  int len=length;
-  int harq_pid,round;
-
-  if (ue==NULL)
-    return 0;
-
-  if ((mode == normal_txrx) || (mode == no_L2_connect)) {
-    len += sprintf(&buffer[len], "[UE_PROC] UE %d, RNTI %x\n",ue->Mod_id, ue->pdcch_vars[0][0]->crnti);
-    len += sprintf(&buffer[len],"[UE PROC] RSRP[0] %.2f dBm/RE, RSSI %.2f dBm, RSRQ[0] %.2f dB, N0 %d dBm/RE (NF %.1f dB)\n",
-                   10*log10(ue->measurements.rsrp[0])-ue->rx_total_gain_dB,
-                   10*log10(ue->measurements.rssi)-ue->rx_total_gain_dB,
-                   10*log10(ue->measurements.rsrq[0]),
-                   ue->measurements.n0_power_tot_dBm,
-                   (double)ue->measurements.n0_power_tot_dBm+132.24);
-    /*
-    len += sprintf(&buffer[len],
-                   "[UE PROC] Frame count: %d\neNB0 RSSI %d dBm/RE (%d dB, %d dB)\neNB1 RSSI %d dBm/RE (%d dB, %d dB)neNB2 RSSI %d dBm/RE (%d dB, %d dB)\nN0 %d dBm/RE, %f dBm/%dPRB (%d dB, %d dB)\n",
-                   proc->frame_rx,
-                   ue->measurements.rx_rssi_dBm[0],
-                   ue->measurements.rx_power_dB[0][0],
-                   ue->measurements.rx_power_dB[0][1],
-                   ue->measurements.rx_rssi_dBm[1],
-                   ue->measurements.rx_power_dB[1][0],
-                   ue->measurements.rx_power_dB[1][1],
-                   ue->measurements.rx_rssi_dBm[2],
-                   ue->measurements.rx_power_dB[2][0],
-                   ue->measurements.rx_power_dB[2][1],
-                   ue->measurements.n0_power_tot_dBm,
-                   ue->measurements.n0_power_tot_dBm+10*log10(12*ue->frame_parms.N_RB_DL),
-                   ue->frame_parms.N_RB_DL,
-                   ue->measurements.n0_power_dB[0],
-                   ue->measurements.n0_power_dB[1]);
-    */
-    len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB\n",ue->rx_total_gain_dB);
-    len += sprintf(&buffer[len], "[UE_PROC] Frequency offset %d Hz, estimated carrier frequency %f Hz\n",ue->common_vars.freq_offset,openair0_cfg[0].rx_freq[0]-ue->common_vars.freq_offset);
-    len += sprintf(&buffer[len], "[UE PROC] UE mode = %s (%d)\n",mode_string[ue->UE_mode[0]],ue->UE_mode[0]);
-    len += sprintf(&buffer[len], "[UE PROC] timing_advance = %d\n",ue->timing_advance);
-
-    if (ue->UE_mode[0]==PUSCH) {
-      len += sprintf(&buffer[len], "[UE PROC] Po_PUSCH = %d dBm (PL %d dB, Po_NOMINAL_PUSCH %d dBm, PHR %d dB)\n",
-                     ue->ulsch[0]->Po_PUSCH,
-                     get_PL(ue->Mod_id,ue->CC_id,0),
-                     ue->frame_parms.ul_power_control_config_common.p0_NominalPUSCH,
-                     ue->ulsch[0]->PHR);
-      len += sprintf(&buffer[len], "[UE PROC] Po_PUCCH = %d dBm (Po_NOMINAL_PUCCH %d dBm, g_pucch %d dB)\n",
-                     get_PL(ue->Mod_id,ue->CC_id,0)+
-                     ue->frame_parms.ul_power_control_config_common.p0_NominalPUCCH+
-                     ue->dlsch[0][0][0]->g_pucch,
-                     ue->frame_parms.ul_power_control_config_common.p0_NominalPUCCH,
-                     ue->dlsch[0][0][0]->g_pucch);
-    }
-
-    //for (eNB=0;eNB<NUMBER_OF_eNB_MAX;eNB++) {
-    for (eNB=0; eNB<1; eNB++) {
-      len += sprintf(&buffer[len], "[UE PROC] RX spatial power eNB%d: [%d %d; %d %d] dB\n",
-                     eNB,
-                     ue->measurements.rx_spatial_power_dB[eNB][0][0],
-                     ue->measurements.rx_spatial_power_dB[eNB][0][1],
-                     ue->measurements.rx_spatial_power_dB[eNB][1][0],
-                     ue->measurements.rx_spatial_power_dB[eNB][1][1]);
-      len += sprintf(&buffer[len], "[UE PROC] RX total power eNB%d: %d dB, avg: %d dB\n",eNB,ue->measurements.rx_power_tot_dB[eNB],ue->measurements.rx_power_avg_dB[eNB]);
-      len += sprintf(&buffer[len], "[UE PROC] RX total power lin: %d, avg: %d, RX total noise lin: %d, avg: %d\n",ue->measurements.rx_power_tot[eNB],
-                     ue->measurements.rx_power_avg[eNB], ue->measurements.n0_power_tot, ue->measurements.n0_power_avg);
-      len += sprintf(&buffer[len], "[UE PROC] effective SINR %.2f dB\n",ue->sinr_eff);
-      len += sprintf(&buffer[len], "[UE PROC] Wideband CQI eNB %d: %d dB, avg: %d dB\n",eNB,ue->measurements.wideband_cqi_tot[eNB],ue->measurements.wideband_cqi_avg[eNB]);
-
-      switch (ue->frame_parms.N_RB_DL) {
-        case 6:
-          len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 0): [%d %d %d %d %d %d] dB\n",
-                         eNB,
-                         ue->measurements.subband_cqi_dB[eNB][0][0],
-                         ue->measurements.subband_cqi_dB[eNB][0][1],
-                         ue->measurements.subband_cqi_dB[eNB][0][2],
-                         ue->measurements.subband_cqi_dB[eNB][0][3],
-                         ue->measurements.subband_cqi_dB[eNB][0][4],
-                         ue->measurements.subband_cqi_dB[eNB][0][5]);
-          len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 1): [%d %d %d %d %d %d] dB\n",
-                         eNB,
-                         ue->measurements.subband_cqi_dB[eNB][1][0],
-                         ue->measurements.subband_cqi_dB[eNB][1][1],
-                         ue->measurements.subband_cqi_dB[eNB][1][2],
-                         ue->measurements.subband_cqi_dB[eNB][1][3],
-                         ue->measurements.subband_cqi_dB[eNB][1][4],
-                         ue->measurements.subband_cqi_dB[eNB][1][5]);
-          len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 0): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n",
-                         eNB,
-                         ue->measurements.subband_pmi_re[eNB][0][0],
-                         ue->measurements.subband_pmi_im[eNB][0][0],
-                         ue->measurements.subband_pmi_re[eNB][1][0],
-                         ue->measurements.subband_pmi_im[eNB][1][0],
-                         ue->measurements.subband_pmi_re[eNB][2][0],
-                         ue->measurements.subband_pmi_im[eNB][2][0],
-                         ue->measurements.subband_pmi_re[eNB][3][0],
-                         ue->measurements.subband_pmi_im[eNB][3][0],
-                         ue->measurements.subband_pmi_re[eNB][4][0],
-                         ue->measurements.subband_pmi_im[eNB][4][0],
-                         ue->measurements.subband_pmi_re[eNB][5][0],
-                         ue->measurements.subband_pmi_im[eNB][5][0]);
-          len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 1): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n",
-                         eNB,
-                         ue->measurements.subband_pmi_re[eNB][0][1],
-                         ue->measurements.subband_pmi_im[eNB][0][1],
-                         ue->measurements.subband_pmi_re[eNB][1][1],
-                         ue->measurements.subband_pmi_im[eNB][1][1],
-                         ue->measurements.subband_pmi_re[eNB][2][1],
-                         ue->measurements.subband_pmi_im[eNB][2][1],
-                         ue->measurements.subband_pmi_re[eNB][3][1],
-                         ue->measurements.subband_pmi_im[eNB][3][1],
-                         ue->measurements.subband_pmi_re[eNB][4][1],
-                         ue->measurements.subband_pmi_im[eNB][4][1],
-                         ue->measurements.subband_pmi_re[eNB][5][1],
-                         ue->measurements.subband_pmi_im[eNB][5][1]);
-          len += sprintf(&buffer[len], "[UE PROC] PMI Antenna selection eNB%d : [%d %d %d %d %d %d]\n",
-                         eNB,
-                         ue->measurements.selected_rx_antennas[eNB][0],
-                         ue->measurements.selected_rx_antennas[eNB][1],
-                         ue->measurements.selected_rx_antennas[eNB][2],
-                         ue->measurements.selected_rx_antennas[eNB][3],
-                         ue->measurements.selected_rx_antennas[eNB][4],
-                         ue->measurements.selected_rx_antennas[eNB][5]);
-          len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (max): %jx\n",eNB,pmi2hex_2Ar1(quantize_subband_pmi(&ue->measurements,eNB,6)));
-          len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (both): %jx,%jx\n",eNB,
-                         pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,0,6)),
-                         pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,1,6)));
-          break;
-
-        case 25:
-          len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 0): [%d %d %d %d %d %d %d] dB\n",
-                         eNB,
-                         ue->measurements.subband_cqi_dB[eNB][0][0],
-                         ue->measurements.subband_cqi_dB[eNB][0][1],
-                         ue->measurements.subband_cqi_dB[eNB][0][2],
-                         ue->measurements.subband_cqi_dB[eNB][0][3],
-                         ue->measurements.subband_cqi_dB[eNB][0][4],
-                         ue->measurements.subband_cqi_dB[eNB][0][5],
-                         ue->measurements.subband_cqi_dB[eNB][0][6]);
-          len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 1): [%d %d %d %d %d %d %d] dB\n",
-                         eNB,
-                         ue->measurements.subband_cqi_dB[eNB][1][0],
-                         ue->measurements.subband_cqi_dB[eNB][1][1],
-                         ue->measurements.subband_cqi_dB[eNB][1][2],
-                         ue->measurements.subband_cqi_dB[eNB][1][3],
-                         ue->measurements.subband_cqi_dB[eNB][1][4],
-                         ue->measurements.subband_cqi_dB[eNB][1][5],
-                         ue->measurements.subband_cqi_dB[eNB][1][6]);
-          len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 0): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n",
-                         eNB,
-                         ue->measurements.subband_pmi_re[eNB][0][0],
-                         ue->measurements.subband_pmi_im[eNB][0][0],
-                         ue->measurements.subband_pmi_re[eNB][1][0],
-                         ue->measurements.subband_pmi_im[eNB][1][0],
-                         ue->measurements.subband_pmi_re[eNB][2][0],
-                         ue->measurements.subband_pmi_im[eNB][2][0],
-                         ue->measurements.subband_pmi_re[eNB][3][0],
-                         ue->measurements.subband_pmi_im[eNB][3][0],
-                         ue->measurements.subband_pmi_re[eNB][4][0],
-                         ue->measurements.subband_pmi_im[eNB][4][0],
-                         ue->measurements.subband_pmi_re[eNB][5][0],
-                         ue->measurements.subband_pmi_im[eNB][5][0],
-                         ue->measurements.subband_pmi_re[eNB][6][0],
-                         ue->measurements.subband_pmi_im[eNB][6][0]);
-          len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 1): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n",
-                         eNB,
-                         ue->measurements.subband_pmi_re[eNB][0][1],
-                         ue->measurements.subband_pmi_im[eNB][0][1],
-                         ue->measurements.subband_pmi_re[eNB][1][1],
-                         ue->measurements.subband_pmi_im[eNB][1][1],
-                         ue->measurements.subband_pmi_re[eNB][2][1],
-                         ue->measurements.subband_pmi_im[eNB][2][1],
-                         ue->measurements.subband_pmi_re[eNB][3][1],
-                         ue->measurements.subband_pmi_im[eNB][3][1],
-                         ue->measurements.subband_pmi_re[eNB][4][1],
-                         ue->measurements.subband_pmi_im[eNB][4][1],
-                         ue->measurements.subband_pmi_re[eNB][5][1],
-                         ue->measurements.subband_pmi_im[eNB][5][1],
-                         ue->measurements.subband_pmi_re[eNB][6][1],
-                         ue->measurements.subband_pmi_im[eNB][6][1]);
-          len += sprintf(&buffer[len], "[UE PROC] PMI Antenna selection eNB%d : [%d %d %d %d %d %d %d]\n",
-                         eNB,
-                         ue->measurements.selected_rx_antennas[eNB][0],
-                         ue->measurements.selected_rx_antennas[eNB][1],
-                         ue->measurements.selected_rx_antennas[eNB][2],
-                         ue->measurements.selected_rx_antennas[eNB][3],
-                         ue->measurements.selected_rx_antennas[eNB][4],
-                         ue->measurements.selected_rx_antennas[eNB][5],
-                         ue->measurements.selected_rx_antennas[eNB][6]);
-          len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (max): %jx\n",eNB,pmi2hex_2Ar1(quantize_subband_pmi(&ue->measurements,eNB,7)));
-          len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (both): %jx,%jx\n",eNB,
-                         pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,0,7)),
-                         pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,1,7)));
-          break;
-
-        case 50:
-          len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 0): [%d %d %d %d %d %d %d %d %d] dB\n",
-                         eNB,
-                         ue->measurements.subband_cqi_dB[eNB][0][0],
-                         ue->measurements.subband_cqi_dB[eNB][0][1],
-                         ue->measurements.subband_cqi_dB[eNB][0][2],
-                         ue->measurements.subband_cqi_dB[eNB][0][3],
-                         ue->measurements.subband_cqi_dB[eNB][0][4],
-                         ue->measurements.subband_cqi_dB[eNB][0][5],
-                         ue->measurements.subband_cqi_dB[eNB][0][6],
-                         ue->measurements.subband_cqi_dB[eNB][0][7],
-                         ue->measurements.subband_cqi_dB[eNB][0][8]);
-          len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 1): [%d %d %d %d %d %d %d %d %d] dB\n",
-                         eNB,
-                         ue->measurements.subband_cqi_dB[eNB][1][0],
-                         ue->measurements.subband_cqi_dB[eNB][1][1],
-                         ue->measurements.subband_cqi_dB[eNB][1][2],
-                         ue->measurements.subband_cqi_dB[eNB][1][3],
-                         ue->measurements.subband_cqi_dB[eNB][1][4],
-                         ue->measurements.subband_cqi_dB[eNB][1][5],
-                         ue->measurements.subband_cqi_dB[eNB][1][6],
-                         ue->measurements.subband_cqi_dB[eNB][1][7],
-                         ue->measurements.subband_cqi_dB[eNB][1][8]);
-          len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 0): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n",
-                         eNB,
-                         ue->measurements.subband_pmi_re[eNB][0][0],
-                         ue->measurements.subband_pmi_im[eNB][0][0],
-                         ue->measurements.subband_pmi_re[eNB][1][0],
-                         ue->measurements.subband_pmi_im[eNB][1][0],
-                         ue->measurements.subband_pmi_re[eNB][2][0],
-                         ue->measurements.subband_pmi_im[eNB][2][0],
-                         ue->measurements.subband_pmi_re[eNB][3][0],
-                         ue->measurements.subband_pmi_im[eNB][3][0],
-                         ue->measurements.subband_pmi_re[eNB][4][0],
-                         ue->measurements.subband_pmi_im[eNB][4][0],
-                         ue->measurements.subband_pmi_re[eNB][5][0],
-                         ue->measurements.subband_pmi_im[eNB][5][0],
-                         ue->measurements.subband_pmi_re[eNB][6][0],
-                         ue->measurements.subband_pmi_im[eNB][6][0],
-                         ue->measurements.subband_pmi_re[eNB][7][0],
-                         ue->measurements.subband_pmi_im[eNB][7][0],
-                         ue->measurements.subband_pmi_re[eNB][8][0],
-                         ue->measurements.subband_pmi_im[eNB][8][0]);
-          len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 1): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n",
-                         eNB,
-                         ue->measurements.subband_pmi_re[eNB][0][1],
-                         ue->measurements.subband_pmi_im[eNB][0][1],
-                         ue->measurements.subband_pmi_re[eNB][1][1],
-                         ue->measurements.subband_pmi_im[eNB][1][1],
-                         ue->measurements.subband_pmi_re[eNB][2][1],
-                         ue->measurements.subband_pmi_im[eNB][2][1],
-                         ue->measurements.subband_pmi_re[eNB][3][1],
-                         ue->measurements.subband_pmi_im[eNB][3][1],
-                         ue->measurements.subband_pmi_re[eNB][4][1],
-                         ue->measurements.subband_pmi_im[eNB][4][1],
-                         ue->measurements.subband_pmi_re[eNB][5][1],
-                         ue->measurements.subband_pmi_im[eNB][5][1],
-                         ue->measurements.subband_pmi_re[eNB][6][1],
-                         ue->measurements.subband_pmi_im[eNB][6][1],
-                         ue->measurements.subband_pmi_re[eNB][7][1],
-                         ue->measurements.subband_pmi_im[eNB][7][1],
-                         ue->measurements.subband_pmi_re[eNB][8][1],
-                         ue->measurements.subband_pmi_im[eNB][8][1]);
-          len += sprintf(&buffer[len], "[UE PROC] PMI Antenna selection eNB%d : [%d %d %d %d %d %d %d %d %d]\n",
-                         eNB,
-                         ue->measurements.selected_rx_antennas[eNB][0],
-                         ue->measurements.selected_rx_antennas[eNB][1],
-                         ue->measurements.selected_rx_antennas[eNB][2],
-                         ue->measurements.selected_rx_antennas[eNB][3],
-                         ue->measurements.selected_rx_antennas[eNB][4],
-                         ue->measurements.selected_rx_antennas[eNB][5],
-                         ue->measurements.selected_rx_antennas[eNB][6],
-                         ue->measurements.selected_rx_antennas[eNB][7],
-                         ue->measurements.selected_rx_antennas[eNB][8]);
-          len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (max): %jx\n",eNB,pmi2hex_2Ar1(quantize_subband_pmi(&ue->measurements,eNB,9)));
-          len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (both): %jx,%jx\n",eNB,
-                         pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,0,9)),
-                         pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,1,9)));
-          break;
-
-        case 100:
-          len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 0): [%d %d %d %d %d %d %d %d %d %d %d %d %d] dB\n",
-                         eNB,
-                         ue->measurements.subband_cqi_dB[eNB][0][0],
-                         ue->measurements.subband_cqi_dB[eNB][0][1],
-                         ue->measurements.subband_cqi_dB[eNB][0][2],
-                         ue->measurements.subband_cqi_dB[eNB][0][3],
-                         ue->measurements.subband_cqi_dB[eNB][0][4],
-                         ue->measurements.subband_cqi_dB[eNB][0][5],
-                         ue->measurements.subband_cqi_dB[eNB][0][6],
-                         ue->measurements.subband_cqi_dB[eNB][0][7],
-                         ue->measurements.subband_cqi_dB[eNB][0][8],
-                         ue->measurements.subband_cqi_dB[eNB][0][9],
-                         ue->measurements.subband_cqi_dB[eNB][0][10],
-                         ue->measurements.subband_cqi_dB[eNB][0][11],
-                         ue->measurements.subband_cqi_dB[eNB][0][12]);
-          len += sprintf(&buffer[len], "[UE PROC] Subband CQI eNB%d (Ant 1): [%d %d %d %d %d %d %d %d %d %d %d %d %d] dB\n",
-                         eNB,
-                         ue->measurements.subband_cqi_dB[eNB][1][0],
-                         ue->measurements.subband_cqi_dB[eNB][1][1],
-                         ue->measurements.subband_cqi_dB[eNB][1][2],
-                         ue->measurements.subband_cqi_dB[eNB][1][3],
-                         ue->measurements.subband_cqi_dB[eNB][1][4],
-                         ue->measurements.subband_cqi_dB[eNB][1][5],
-                         ue->measurements.subband_cqi_dB[eNB][1][6],
-                         ue->measurements.subband_cqi_dB[eNB][1][7],
-                         ue->measurements.subband_cqi_dB[eNB][1][8],
-                         ue->measurements.subband_cqi_dB[eNB][1][9],
-                         ue->measurements.subband_cqi_dB[eNB][1][10],
-                         ue->measurements.subband_cqi_dB[eNB][1][11],
-                         ue->measurements.subband_cqi_dB[eNB][1][12]);
-          len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 0): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n",
-                         eNB,
-                         ue->measurements.subband_pmi_re[eNB][0][0],
-                         ue->measurements.subband_pmi_im[eNB][0][0],
-                         ue->measurements.subband_pmi_re[eNB][1][0],
-                         ue->measurements.subband_pmi_im[eNB][1][0],
-                         ue->measurements.subband_pmi_re[eNB][2][0],
-                         ue->measurements.subband_pmi_im[eNB][2][0],
-                         ue->measurements.subband_pmi_re[eNB][3][0],
-                         ue->measurements.subband_pmi_im[eNB][3][0],
-                         ue->measurements.subband_pmi_re[eNB][4][0],
-                         ue->measurements.subband_pmi_im[eNB][4][0],
-                         ue->measurements.subband_pmi_re[eNB][5][0],
-                         ue->measurements.subband_pmi_im[eNB][5][0],
-                         ue->measurements.subband_pmi_re[eNB][6][0],
-                         ue->measurements.subband_pmi_im[eNB][6][0],
-                         ue->measurements.subband_pmi_re[eNB][7][0],
-                         ue->measurements.subband_pmi_im[eNB][7][0],
-                         ue->measurements.subband_pmi_re[eNB][8][0],
-                         ue->measurements.subband_pmi_im[eNB][8][0],
-                         ue->measurements.subband_pmi_re[eNB][9][0],
-                         ue->measurements.subband_pmi_im[eNB][9][0],
-                         ue->measurements.subband_pmi_re[eNB][10][0],
-                         ue->measurements.subband_pmi_im[eNB][10][0],
-                         ue->measurements.subband_pmi_re[eNB][11][0],
-                         ue->measurements.subband_pmi_im[eNB][11][0],
-                         ue->measurements.subband_pmi_re[eNB][12][0],
-                         ue->measurements.subband_pmi_im[eNB][12][0]);
-          len += sprintf(&buffer[len], "[UE PROC] Subband PMI eNB%d (Ant 1): [(%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d) (%d %d)]\n",
-                         eNB,
-                         ue->measurements.subband_pmi_re[eNB][0][1],
-                         ue->measurements.subband_pmi_im[eNB][0][1],
-                         ue->measurements.subband_pmi_re[eNB][1][1],
-                         ue->measurements.subband_pmi_im[eNB][1][1],
-                         ue->measurements.subband_pmi_re[eNB][2][1],
-                         ue->measurements.subband_pmi_im[eNB][2][1],
-                         ue->measurements.subband_pmi_re[eNB][3][1],
-                         ue->measurements.subband_pmi_im[eNB][3][1],
-                         ue->measurements.subband_pmi_re[eNB][4][1],
-                         ue->measurements.subband_pmi_im[eNB][4][1],
-                         ue->measurements.subband_pmi_re[eNB][5][1],
-                         ue->measurements.subband_pmi_im[eNB][5][1],
-                         ue->measurements.subband_pmi_re[eNB][6][1],
-                         ue->measurements.subband_pmi_im[eNB][6][1],
-                         ue->measurements.subband_pmi_re[eNB][7][1],
-                         ue->measurements.subband_pmi_im[eNB][7][1],
-                         ue->measurements.subband_pmi_re[eNB][8][1],
-                         ue->measurements.subband_pmi_im[eNB][8][1],
-                         ue->measurements.subband_pmi_re[eNB][9][1],
-                         ue->measurements.subband_pmi_im[eNB][9][1],
-                         ue->measurements.subband_pmi_re[eNB][10][1],
-                         ue->measurements.subband_pmi_im[eNB][10][1],
-                         ue->measurements.subband_pmi_re[eNB][11][1],
-                         ue->measurements.subband_pmi_im[eNB][11][1],
-                         ue->measurements.subband_pmi_re[eNB][12][1],
-                         ue->measurements.subband_pmi_im[eNB][12][1]);
-          len += sprintf(&buffer[len], "[UE PROC] PMI Antenna selection eNB%d : [%d %d %d %d %d %d %d %d %d %d %d %d %d]\n",
-                         eNB,
-                         ue->measurements.selected_rx_antennas[eNB][0],
-                         ue->measurements.selected_rx_antennas[eNB][1],
-                         ue->measurements.selected_rx_antennas[eNB][2],
-                         ue->measurements.selected_rx_antennas[eNB][3],
-                         ue->measurements.selected_rx_antennas[eNB][4],
-                         ue->measurements.selected_rx_antennas[eNB][5],
-                         ue->measurements.selected_rx_antennas[eNB][6],
-                         ue->measurements.selected_rx_antennas[eNB][7],
-                         ue->measurements.selected_rx_antennas[eNB][8],
-                         ue->measurements.selected_rx_antennas[eNB][9],
-                         ue->measurements.selected_rx_antennas[eNB][10],
-                         ue->measurements.selected_rx_antennas[eNB][11],
-                         ue->measurements.selected_rx_antennas[eNB][12]);
-          len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (max): %jx\n",eNB,pmi2hex_2Ar1(quantize_subband_pmi(&ue->measurements,eNB,13)));
-          len += sprintf(&buffer[len], "[UE PROC] Quantized PMI eNB %d (both): %jx,%jx\n",eNB,
-                         pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,0,13)),
-                         pmi2hex_2Ar1(quantize_subband_pmi2(&ue->measurements,eNB,1,13)));
-          break;
-      }
-
-      RRC_status = mac_UE_get_rrc_status(ue->Mod_id, 0);
-      len += sprintf(&buffer[len],"[UE PROC] RRC status = %d\n",RRC_status);
-      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,
-                     ue->pbch_vars[eNB]->pdu_errors,
-                     ue->pbch_vars[eNB]->pdu_fer);
-
-      if (ue->transmission_mode[eNB] == 6)
-        len += sprintf(&buffer[len], "[UE PROC] Mode 6 Wideband CQI eNB %d : %d dB\n",eNB,ue->measurements.precoded_cqi_dB[eNB][0]);
-
-      for (harq_pid=0; harq_pid<8; harq_pid++) {
-        len+=sprintf(&buffer[len],"[UE PROC] eNB %d: CW 0 harq_pid %d, mcs %d:",eNB,harq_pid,ue->dlsch[0][0][0]->harq_processes[harq_pid]->mcs);
-
-        for (round=0; round<8; round++)
-          len+=sprintf(&buffer[len],"%d/%d ",
-                       ue->dlsch[0][0][0]->harq_processes[harq_pid]->errors[round],
-                       ue->dlsch[0][0][0]->harq_processes[harq_pid]->trials[round]);
-
-        len+=sprintf(&buffer[len],"\n");
-      }
-
-      if (ue->dlsch[0][0] && ue->dlsch[0][0][0] && ue->dlsch[0][0][1]) {
-        len += sprintf(&buffer[len], "[UE PROC] Saved PMI for DLSCH eNB %d : %jx (%p)\n",eNB,pmi2hex_2Ar1(ue->dlsch[0][0][0]->pmi_alloc),ue->dlsch[0][0][0]);
-        len += sprintf(&buffer[len], "[UE PROC] eNB %d: dl_power_off = %d\n",eNB,ue->dlsch[0][0][0]->harq_processes[0]->dl_power_off);
-
-        for (harq_pid=0; harq_pid<8; harq_pid++) {
-          len+=sprintf(&buffer[len],"[UE PROC] eNB %d: CW 1 harq_pid %d, mcs %d:",eNB,harq_pid,ue->dlsch[0][0][1]->harq_processes[0]->mcs);
-
-          for (round=0; round<8; round++)
-            len+=sprintf(&buffer[len],"%d/%d ",
-                         ue->dlsch[0][0][1]->harq_processes[harq_pid]->errors[round],
-                         ue->dlsch[0][0][1]->harq_processes[harq_pid]->trials[round]);
-
-          len+=sprintf(&buffer[len],"\n");
-        }
-      }
-
-      len += sprintf(&buffer[len], "[UE PROC] DLSCH Total %d, Error %d, FER %d\n",ue->dlsch_received[0],ue->dlsch_errors[0],ue->dlsch_fer[0]);
-      len += sprintf(&buffer[len], "[UE PROC] DLSCH (SI) Total %d, Error %d\n",ue->dlsch_SI_received[0],ue->dlsch_SI_errors[0]);
-      len += sprintf(&buffer[len], "[UE PROC] DLSCH (RA) Total %d, Error %d\n",ue->dlsch_ra_received[0],ue->dlsch_ra_errors[0]);
-      int i=0;
-
-      //len += sprintf(&buffer[len], "[UE PROC] MCH  Total %d\n", ue->dlsch_mch_received[0]);
-      for(i=0; i <ue->frame_parms.num_MBSFN_config; i++ ) {
-        len += sprintf(&buffer[len], "[UE PROC] MCH (MCCH MBSFN %d) Total %d, Error %d, Trials %d\n",
-                       i, ue->dlsch_mcch_received[i][0],ue->dlsch_mcch_errors[i][0],ue->dlsch_mcch_trials[i][0]);
-        len += sprintf(&buffer[len], "[UE PROC] MCH (MTCH MBSFN %d) Total %d, Error %d, Trials %d\n",
-                       i, ue->dlsch_mtch_received[i][0],ue->dlsch_mtch_errors[i][0],ue->dlsch_mtch_trials[i][0]);
-      }
-
-      len += sprintf(&buffer[len], "[UE PROC] DLSCH Bitrate %dkbps\n",(ue->bitrate[0]/1000));
-      len += sprintf(&buffer[len], "[UE PROC] Total Received Bits %dkbits\n",(ue->total_received_bits[0]/1000));
-      len += sprintf(&buffer[len], "[UE PROC] IA receiver %d\n",ue->use_ia_receiver);
-    }
-  } else {
-    len += sprintf(&buffer[len], "[UE PROC] Frame count: %d, RSSI %3.2f dB (%d dB, %d dB), N0 %3.2f dB (%d dB, %d dB)\n",
-                   proc->frame_rx,
-                   10*log10(ue->measurements.rssi),
-                   ue->measurements.rx_power_dB[0][0],
-                   ue->measurements.rx_power_dB[0][1],
-                   10*log10(ue->measurements.n0_power_tot),
-                   ue->measurements.n0_power_dB[0],
-                   ue->measurements.n0_power_dB[1]);
-  }
-
-  len += sprintf(&buffer[len],"EOF\n");
-  return len;
-} // is_clusterhead
-
-/*
-int dump_eNB_stats(PHY_VARS_eNB *eNB, char* buffer, int length)
-{
-
-  unsigned int success=0;
-  uint8_t eNB_id,UE_id,i,j,number_of_cards_l=1;
-  uint32_t ulsch_errors=0,dlsch_errors=0;
-  uint32_t ulsch_round_attempts[4]= {0,0,0,0},ulsch_round_errors[4]= {0,0,0,0};
-  uint32_t dlsch_round_attempts[4]= {0,0,0,0},dlsch_round_errors[4]= {0,0,0,0};
-  uint32_t UE_id_mac, RRC_status;
-  eNB_rxtx_proc_t *proc = &eNB->proc.proc_rxtx[0];
-  if (eNB==NULL)
-    return 0;
-
-  int len = length;
-
-  //  if(eNB->frame==0){
-  eNB->total_dlsch_bitrate = 0;//eNB->UE_stats[UE_id].dlsch_bitrate + eNB->total_dlsch_bitrate;
-  eNB->total_transmitted_bits = 0;// eNB->UE_stats[UE_id].total_transmitted_bits +  eNB->total_transmitted_bits;
-  eNB->total_system_throughput = 0;//eNB->UE_stats[UE_id].total_transmitted_bits + eNB->total_system_throughput;
-  // }
-
-  for (eNB_id=0; eNB_id<number_of_cards_l; eNB_id++) {
-    len += sprintf(&buffer[len],"eNB %d/%d Frame %d: RX Gain %d dB, I0 %d dBm (%d,%d) dB \n",
-                   eNB_id,number_of_cards_l,
-                   proc->frame_tx,
-                   eNB->rx_total_gain_dB,
-                   eNB->measurements.n0_power_tot_dBm,
-                   eNB->measurements.n0_power_dB[0],
-                   eNB->measurements.n0_power_dB[1]);
-
-    len += sprintf(&buffer[len],"PRB I0 (%X.%X.%X.%X): ",
-       eNB->rb_mask_ul[0],
-       eNB->rb_mask_ul[1],eNB->rb_mask_ul[2],eNB->rb_mask_ul[3]);
-
-    for (i=0; i<eNB->frame_parms.N_RB_UL; i++) {
-      len += sprintf(&buffer[len],"%4d ",
-                     eNB->measurements.n0_subband_power_tot_dBm[i]);
-      if ((i>0) && ((i%25) == 0))
-  len += sprintf(&buffer[len],"\n");
-    }
-    len += sprintf(&buffer[len],"\n");
-    len += sprintf(&buffer[len],"\nPERFORMANCE PARAMETERS\n");
-
-    for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++) {
-      if (eNB &&
-    (eNB->dlsch!=NULL) &&
-    (eNB->dlsch[(uint8_t)UE_id]!=NULL) &&
-    (eNB->dlsch[(uint8_t)UE_id][0]->rnti>0)&&
-    (eNB->UE_stats[UE_id].mode == PUSCH)) {
-
-        eNB->total_dlsch_bitrate = eNB->UE_stats[UE_id].dlsch_bitrate + eNB->total_dlsch_bitrate;
-        eNB->total_transmitted_bits = eNB->UE_stats[UE_id].total_TBS + eNB->total_transmitted_bits;
-
-        //eNB->total_system_throughput = eNB->UE_stats[UE_id].total_transmitted_bits + eNB->total_system_throughput;
-
-  for (i=0; i<8; i++)
-    success = success + (eNB->UE_stats[UE_id].dlsch_trials[i][0] - eNB->UE_stats[UE_id].dlsch_l2_errors[i]);
-
-
-
-  len += sprintf(&buffer[len],"Total DLSCH %d kbits / %d frames ",(eNB->total_transmitted_bits/1000),proc->frame_tx+1);
-  len += sprintf(&buffer[len],"Total DLSCH throughput %d kbps ",(eNB->total_dlsch_bitrate/1000));
-  len += sprintf(&buffer[len],"Total DLSCH trans %d / %d frames\n",success,proc->frame_tx+1);
-  //len += sprintf(&buffer[len],"[eNB PROC] FULL MU-MIMO Transmissions/Total Transmissions = %d/%d\n",eNB->FULL_MUMIMO_transmissions,eNB->check_for_total_transmissions);
-  //len += sprintf(&buffer[len],"[eNB PROC] MU-MIMO Transmissions/Total Transmissions = %d/%d\n",eNB->check_for_MUMIMO_transmissions,eNB->check_for_total_transmissions);
-  //len += sprintf(&buffer[len],"[eNB PROC] SU-MIMO Transmissions/Total Transmissions = %d/%d\n",eNB->check_for_SUMIMO_transmissions,eNB->check_for_total_transmissions);
-
-  len += sprintf(&buffer[len],"UE %d (%x) Power: (%d,%d) dB, Po_PUSCH: (%d,%d) dBm, Po_PUCCH (%d/%d) dBm, Po_PUCCH1 (%d,%d) dBm,  PUCCH1 Thres %d dBm \n",
-           UE_id,
-           eNB->UE_stats[UE_id].crnti,
-           dB_fixed(eNB->pusch_vars[UE_id]->ulsch_power[0]),
-           dB_fixed(eNB->pusch_vars[UE_id]->ulsch_power[1]),
-           eNB->UE_stats[UE_id].UL_rssi[0],
-           eNB->UE_stats[UE_id].UL_rssi[1],
-           dB_fixed(eNB->UE_stats[UE_id].Po_PUCCH/eNB->frame_parms.N_RB_UL)-eNB->rx_total_gain_dB,
-           eNB->frame_parms.ul_power_control_config_common.p0_NominalPUCCH,
-           dB_fixed(eNB->UE_stats[UE_id].Po_PUCCH1_below/eNB->frame_parms.N_RB_UL)-eNB->rx_total_gain_dB,
-           dB_fixed(eNB->UE_stats[UE_id].Po_PUCCH1_above/eNB->frame_parms.N_RB_UL)-eNB->rx_total_gain_dB,
-           PUCCH1_THRES+eNB->measurements.n0_power_tot_dBm-dB_fixed(eNB->frame_parms.N_RB_UL));
-
-  len+= sprintf(&buffer[len],"DL mcs %d, UL mcs %d, UL rb %d, delta_TF %d, ",
-          eNB->dlsch[(uint8_t)UE_id][0]->harq_processes[0]->mcs,
-          eNB->ulsch[(uint8_t)UE_id]->harq_processes[0]->mcs,
-          eNB->ulsch[(uint8_t)UE_id]->harq_processes[0]->nb_rb,
-          eNB->ulsch[(uint8_t)UE_id]->harq_processes[0]->delta_TF);
-
-  len += sprintf(&buffer[len],"Wideband CQI: (%d,%d) dB\n",
-           eNB->measurements.wideband_cqi_dB[UE_id][0],
-           eNB->measurements.wideband_cqi_dB[UE_id][1]);
-
-  len += sprintf(&buffer[len],"DL TM %d, DL_cqi %d, DL_pmi_single %jx ",
-           eNB->transmission_mode[UE_id],
-           eNB->UE_stats[UE_id].DL_cqi[0],
-           pmi2hex_2Ar1(eNB->UE_stats[UE_id].DL_pmi_single));
-
-  len += sprintf(&buffer[len],"Timing advance %d samples (%d 16Ts), update %d ",
-           eNB->UE_stats[UE_id].UE_timing_offset,
-           eNB->UE_stats[UE_id].UE_timing_offset>>2,
-           eNB->UE_stats[UE_id].timing_advance_update);
-
-  len += sprintf(&buffer[len],"Mode = %s(%d) ",
-           mode_string[eNB->UE_stats[UE_id].mode],
-           eNB->UE_stats[UE_id].mode);
-  UE_id_mac = find_UE_id(eNB->Mod_id,eNB->dlsch[(uint8_t)UE_id][0]->rnti);
-
-  if (UE_id_mac != -1) {
-    RRC_status = mac_eNB_get_rrc_status(eNB->Mod_id,eNB->dlsch[(uint8_t)UE_id][0]->rnti);
-    len += sprintf(&buffer[len],"UE_id_mac = %d, RRC status = %d\n",UE_id_mac,RRC_status);
-  } else
-    len += sprintf(&buffer[len],"UE_id_mac = -1\n");
-
-        len += sprintf(&buffer[len],"SR received/total: %d/%d (diff %d)\n",
-                       eNB->UE_stats[UE_id].sr_received,
-                       eNB->UE_stats[UE_id].sr_total,
-                       eNB->UE_stats[UE_id].sr_total-eNB->UE_stats[UE_id].sr_received);
-
-  len += sprintf(&buffer[len],"DL Subband CQI: ");
-
-  int nb_sb;
-  switch (eNB->frame_parms.N_RB_DL) {
-  case 6:
-    nb_sb=0;
-    break;
-  case 15:
-    nb_sb = 4;
-  case 25:
-    nb_sb = 7;
-    break;
-  case 50:
-    nb_sb = 9;
-    break;
-  case 75:
-    nb_sb = 10;
-    break;
-  case 100:
-    nb_sb = 13;
-    break;
-  default:
-    nb_sb=0;
-    break;
-  }
-  for (i=0; i<nb_sb; i++)
-    len += sprintf(&buffer[len],"%2d ",
-       eNB->UE_stats[UE_id].DL_subband_cqi[0][i]);
-  len += sprintf(&buffer[len],"\n");
-
-
-
-        ulsch_errors = 0;
-
-        for (j=0; j<4; j++) {
-          ulsch_round_attempts[j]=0;
-          ulsch_round_errors[j]=0;
-        }
-
-        len += sprintf(&buffer[len],"ULSCH errors/attempts per harq (per round): \n");
-
-        for (i=0; i<8; i++) {
-          len += sprintf(&buffer[len],"   harq %d: %d/%d (fer %d) (%d/%d, %d/%d, %d/%d, %d/%d) ",
-                         i,
-                         eNB->UE_stats[UE_id].ulsch_errors[i],
-                         eNB->UE_stats[UE_id].ulsch_decoding_attempts[i][0],
-                         eNB->UE_stats[UE_id].ulsch_round_fer[i][0],
-                         eNB->UE_stats[UE_id].ulsch_round_errors[i][0],
-                         eNB->UE_stats[UE_id].ulsch_decoding_attempts[i][0],
-                         eNB->UE_stats[UE_id].ulsch_round_errors[i][1],
-                         eNB->UE_stats[UE_id].ulsch_decoding_attempts[i][1],
-                         eNB->UE_stats[UE_id].ulsch_round_errors[i][2],
-                         eNB->UE_stats[UE_id].ulsch_decoding_attempts[i][2],
-                         eNB->UE_stats[UE_id].ulsch_round_errors[i][3],
-                         eNB->UE_stats[UE_id].ulsch_decoding_attempts[i][3]);
-    if ((i&1) == 1)
-      len += sprintf(&buffer[len],"\n");
-
-          ulsch_errors+=eNB->UE_stats[UE_id].ulsch_errors[i];
-
-          for (j=0; j<4; j++) {
-            ulsch_round_attempts[j]+=eNB->UE_stats[UE_id].ulsch_decoding_attempts[i][j];
-            ulsch_round_errors[j]+=eNB->UE_stats[UE_id].ulsch_round_errors[i][j];
-          }
-        }
-
-        len += sprintf(&buffer[len],"ULSCH errors/attempts total %d/%d (%d/%d, %d/%d, %d/%d, %d/%d)\n",
-                       ulsch_errors,ulsch_round_attempts[0],
-
-                       ulsch_round_errors[0],ulsch_round_attempts[0],
-                       ulsch_round_errors[1],ulsch_round_attempts[1],
-                       ulsch_round_errors[2],ulsch_round_attempts[2],
-                       ulsch_round_errors[3],ulsch_round_attempts[3]);
-
-        dlsch_errors = 0;
-
-        for (j=0; j<4; j++) {
-          dlsch_round_attempts[j]=0;
-          dlsch_round_errors[j]=0;
-        }
-
-        len += sprintf(&buffer[len],"DLSCH errors/attempts per harq (per round): \n");
-
-        for (i=0; i<8; i++) {
-          len += sprintf(&buffer[len],"   harq %d: %d/%d (%d/%d/%d, %d/%d/%d, %d/%d/%d, %d/%d/%d) ",
-                         i,
-                         eNB->UE_stats[UE_id].dlsch_l2_errors[i],
-                         eNB->UE_stats[UE_id].dlsch_trials[i][0],
-                         eNB->UE_stats[UE_id].dlsch_ACK[i][0],
-                         eNB->UE_stats[UE_id].dlsch_NAK[i][0],
-                         eNB->UE_stats[UE_id].dlsch_trials[i][0],
-                         eNB->UE_stats[UE_id].dlsch_ACK[i][1],
-                         eNB->UE_stats[UE_id].dlsch_NAK[i][1],
-                         eNB->UE_stats[UE_id].dlsch_trials[i][1],
-                         eNB->UE_stats[UE_id].dlsch_ACK[i][2],
-                         eNB->UE_stats[UE_id].dlsch_NAK[i][2],
-                         eNB->UE_stats[UE_id].dlsch_trials[i][2],
-                         eNB->UE_stats[UE_id].dlsch_ACK[i][3],
-                         eNB->UE_stats[UE_id].dlsch_NAK[i][3],
-                         eNB->UE_stats[UE_id].dlsch_trials[i][3]);
-    if ((i&1) == 1)
-      len += sprintf(&buffer[len],"\n");
-
-
-          dlsch_errors+=eNB->UE_stats[UE_id].dlsch_l2_errors[i];
-
-          for (j=0; j<4; j++) {
-            dlsch_round_attempts[j]+=eNB->UE_stats[UE_id].dlsch_trials[i][j];
-            dlsch_round_errors[j]+=eNB->UE_stats[UE_id].dlsch_NAK[i][j];
-          }
-        }
-
-        len += sprintf(&buffer[len],"DLSCH errors/attempts total %d/%d (%d/%d, %d/%d, %d/%d, %d/%d): \n",
-                       dlsch_errors,dlsch_round_attempts[0],
-                       dlsch_round_errors[0],dlsch_round_attempts[0],
-                       dlsch_round_errors[1],dlsch_round_attempts[1],
-                       dlsch_round_errors[2],dlsch_round_attempts[2],
-                       dlsch_round_errors[3],dlsch_round_attempts[3]);
-
-
-        len += sprintf(&buffer[len],"DLSCH total bits from MAC: %dkbit ",(eNB->UE_stats[UE_id].total_TBS_MAC)/1000);
-        len += sprintf(&buffer[len],"DLSCH total bits ack'ed: %dkbit ",(eNB->UE_stats[UE_id].total_TBS)/1000);
-        len += sprintf(&buffer[len],"DLSCH Average throughput (100 frames): %dkbps\n",(eNB->UE_stats[UE_id].dlsch_bitrate/1000));
-  //        len += sprintf(&buffer[len],"[eNB PROC] Transmission Mode %d\n",eNB->transmission_mode[UE_id]);
-      }
-    }
-
-    len += sprintf(&buffer[len],"\n");
-  }
-
-  len += sprintf(&buffer[len],"EOF\n");
-
-  return len;
-}
-*/
diff --git a/openair1/PHY/LTE_TRANSPORT/pss.c b/openair1/PHY/LTE_TRANSPORT/pss.c
index 34a7ba70073..8d95001c0ec 100644
--- a/openair1/PHY/LTE_TRANSPORT/pss.c
+++ b/openair1/PHY/LTE_TRANSPORT/pss.c
@@ -48,7 +48,7 @@ int generate_pss(int32_t **txdataF,
   unsigned int Nsymb;
   unsigned short k,m,aa,a;
   uint8_t Nid2;
-  short *primary_sync;
+  const short *primary_sync;
   Nid2 = frame_parms->Nid_cell % 3;
 
   switch (Nid2) {
diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c
index 39d1a86e5ba..190e3c47c04 100644
--- a/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c
+++ b/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c
@@ -40,8 +40,6 @@
 
 #include "T.h"
 
-//extern char* namepointer_chMag ;
-//eren
 //extern int **ulchmag_eren;
 //eren
 
@@ -1044,7 +1042,6 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
               L1_rxtx_proc_t *proc,
               uint8_t UE_id) {
   LTE_eNB_ULSCH_t **ulsch = eNB->ulsch;
-  // flagMag = 0;
   LTE_eNB_COMMON *common_vars = &eNB->common_vars;
   LTE_eNB_PUSCH *pusch_vars = eNB->pusch_vars[UE_id];
   LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c
index b5e5b490a35..42a83a2cda3 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c
@@ -37,6 +37,7 @@
 #include "PHY/phy_vars.h"
 #endif
 #include "assertions.h"
+#include "PHY/LTE_TRANSPORT/transport_vars.h"
 
 
 //#define DEBUG_HARQ
@@ -60,10 +61,67 @@
 #define LOG_I(A,B...) printf(B)
 */
 
+int flag_LA=0;
+
 extern uint16_t beta_cqi[16];
 extern uint16_t beta_ri[16];
 extern uint16_t beta_ack[16];
 
+static const double p_qpsk[8] = {5982.42405670359,
+                                 -21568.1135917693,
+                                 31293.9987036905,
+                                 -23394.6795043871,
+                                 9608.34750585489,
+                                 -2158.15802349899,
+                                 267.731968719036,
+                                 -20.6145324295965};
+static const double p_qam16[8] = {7862.12690694170,
+                                  -28510.3207048338,
+                                  41542.2150287122,
+                                  -31088.3036957379,
+                                  12690.1982361016,
+                                  -2785.66604739984,
+                                  326.595462489375,
+                                  -18.9911849872089};
+static const double p_qam64[8] = {8832.57933013696,
+                                  -32119.1802555952,
+                                  46914.2578990397,
+                                  -35163.8150557183,
+                                  14343.7419388853,
+                                  -3126.61025510092,
+                                  360.954930562237,
+                                  -18.0358548533343};
+static const double q_qpsk[8] = {1.94491167814437e-09,
+                                 8.40494123817774e-08,
+                                 4.75527131198034e-07,
+                                 -2.48946285301621e-05,
+                                 -0.000347614016158364,
+                                 0.00209252225437100,
+                                 0.0742986115462510,
+                                 0.488297879889425};
+static const double q_qam16[8] = {3.21151853033897e-10,
+                                  5.55435952230651e-09,
+                                  -2.30760065362117e-07,
+                                  -6.25587743817859e-06,
+                                  4.62251036452795e-06,
+                                  0.00224150813158937,
+                                  0.0393723140344367,
+                                  0.245486379182639};
+static const double q_qam64[8] = {2.25934026232206e-11,
+                                  -1.45992206328306e-10,
+                                  -3.70861183071900e-08,
+                                  -1.22206071019319e-06,
+                                  6.49115500399637e-06,
+                                  0.00129828997837433,
+                                  0.0259669554914859,
+                                  0.166602901214898};
+static const double sinr_to_cqi[4][16] = {
+  {-2.5051, -2.5051, -1.7451, -0.3655, 1.0812, 2.4012, 3.6849, 6.6754, 8.3885, 8.7970, 12.0437, 14.4709, 15.7281,  17.2424,  17.2424, 17.2424},
+  {-2.2360, -2.2360, -1.3919, -0.0218, 1.5319,  2.9574,  4.3234, 6.3387, 8.9879, 9.5096, 12.6609, 14.0116, 16.4984, 18.1572, 18.1572, 18.1572},
+  {-1, -1.0000, -0.4198, -0.0140, 1.0362,  2.3520, 3.5793, 6.1136, 8.4836, 9.0858, 12.4723, 13.9128, 16.2054, 17.7392, 17.7392, 17.7392},
+  { -4.1057, -4.1057, -3.3768, -2.2916, -1.1392, 0.1236, 1.2849, 3.1933, 5.9298, 6.4052, 9.6245, 10.9414, 13.5166, 14.9545, 14.9545, 14.9545}
+};
+
 static int errorRB(int rb, char * table, int line) {
   LOG_E(PHY,"Received %d rb, impossble in table %s, at line %d\n", rb, table, line);
   return 0;
@@ -2926,7 +2984,6 @@ uint16_t quantize_wideband_pmi(PHY_MEASUREMENTS *meas,uint8_t eNB_id)
 
 uint8_t sinr2cqi(double sinr,uint8_t trans_mode)
 {
-  // int flag_LA=0;
 
   uint8_t retValue = 0;
 
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c
index 096c0fd4422..8c0681e1624 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c
@@ -30,7 +30,7 @@
  * \warning
  */
 #include "PHY/defs_UE.h"
-#include "PHY/phy_extern_ue.h"
+#include "PHY/phy_extern.h"
 #include "SCHED_UE/sched_UE.h"
 #include "transport_ue.h"
 #include "transport_proto_ue.h"
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/pbch_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/pbch_ue.c
index ad7bb6c8bfb..108680c640a 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/pbch_ue.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/pbch_ue.c
@@ -36,7 +36,7 @@
 #include "PHY/CODING/coding_extern.h"
 #include "PHY/CODING/lte_interleaver_inline.h"
 #include "transport_ue.h"
-#include "PHY/phy_extern_ue.h"
+#include "PHY/phy_extern.h"
 #include "PHY/sse_intrin.h"
 #include "PHY/LTE_REFSIG/lte_refsig.h"
 
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c
index ae5a608da1c..eb9e3bc7422 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c
@@ -32,7 +32,7 @@
 
 
 #include "PHY/defs_UE.h"
-#include "PHY/phy_extern_ue.h"
+#include "PHY/phy_extern.h"
 #include "PHY/sse_intrin.h"
 #include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
 
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/pucch_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/pucch_ue.c
index 9427ec3a5bb..6df56d6c530 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/pucch_ue.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/pucch_ue.c
@@ -32,6 +32,7 @@
 #include "PHY/defs_UE.h"
 #include "PHY/phy_extern_ue.h" 
 #include "PHY/LTE_REFSIG/lte_refsig.h"
+#include "PHY/LTE_TRANSPORT/transport_vars.h"
 
 #include "common/utils/LOG/log.h"
 #include "common/utils/LOG/vcd_signal_dumper.h"
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/rar_tools_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/rar_tools_ue.c
index b4273095ba1..b856976638b 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/rar_tools_ue.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/rar_tools_ue.c
@@ -35,6 +35,7 @@
 #include "LAYER2/MAC/mac.h"
 #include "common/utils/LOG/vcd_signal_dumper.h"
 #include "transport_proto_ue.h"
+#include "PHY/LTE_TRANSPORT/transport_vars.h"
 
 #include "assertions.h"
 
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c b/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c
index 9c0edb467ca..534228a9350 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/srs_modulation.c
@@ -30,60 +30,22 @@
 * \warning
 */
 #include "PHY/defs_UE.h"
-#include "PHY/phy_extern_ue.h"
+#include "PHY/phy_extern.h"
 #include "common/utils/LOG/log.h"
 
-unsigned short msrsb_6_40[8][4] = {{36,12,4,4},
-  {32,16,8,4},
-  {24,4,4,4},
-  {20,4,4,4},
-  {16,4,4,4},
-  {12,4,4,4},
-  {8,4,4,4},
-  {4,4,4,4}
-};
-
-unsigned short msrsb_41_60[8][4] = {{48,24,12,4},
-  {48,16,8,4},
-  {40,20,4,4},
-  {36,12,4,4},
-  {32,16,8,4},
-  {24,4,4,4},
-  {20,4,4,4},
-  {16,4,4,4}
+static unsigned short msrsb_6_40[8][4] = {
+  {36, 12, 4, 4},
+  {32, 16, 8, 4},
+  {24, 4, 4, 4},
+  {20, 4, 4, 4},
+  {16, 4, 4, 4},
+  {12, 4, 4, 4},
+  {8, 4, 4, 4},
+  {4, 4, 4, 4}
 };
 
-unsigned short msrsb_61_80[8][4] = {{72,24,12,4},
-  {64,32,16,4},
-  {60,20,4,4},
+static unsigned short msrsb_41_60[8][4] = {
   {48,24,12,4},
-  {48,16,8,4},
-  {40,20,4,4},
-  {36,12,4,4},
-  {32,16,8,4}
-};
-
-unsigned short msrsb_81_110[8][4] = {{96,48,24,4},
-  {96,32,16,4},
-  {80,40,20,4},
-  {72,24,12,4},
-  {64,32,16,4},
-  {60,20,4,4},
-  {48,24,12,4},
-  {48,16,8,4}
-};
-
-unsigned short Nb_6_40[8][4] = {{36,12,4,4},
-  {32,16,8,4},
-  {24,4,4,4},
-  {20,4,4,4},
-  {16,4,4,4},
-  {12,4,4,4},
-  {8,4,4,4},
-  {4,4,4,4}
-};
-
-unsigned short Nb_41_60[8][4] = {{48,24,12,4},
   {48,16,8,4},
   {40,20,4,4},
   {36,12,4,4},
@@ -93,7 +55,8 @@ unsigned short Nb_41_60[8][4] = {{48,24,12,4},
   {16,4,4,4}
 };
 
-unsigned short Nb_61_80[8][4] = {{72,24,12,4},
+static unsigned short msrsb_61_80[8][4] = {
+  {72,24,12,4},
   {64,32,16,4},
   {60,20,4,4},
   {48,24,12,4},
@@ -103,7 +66,8 @@ unsigned short Nb_61_80[8][4] = {{72,24,12,4},
   {32,16,8,4}
 };
 
-unsigned short Nb_81_110[8][4] = {{96,48,24,4},
+static unsigned short msrsb_81_110[8][4] = {
+  {96,48,24,4},
   {96,32,16,4},
   {80,40,20,4},
   {72,24,12,4},
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/sss_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/sss_ue.c
index 7087b83bcaa..79b20dc10c8 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/sss_ue.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/sss_ue.c
@@ -31,7 +31,7 @@
 */
 #include "PHY/defs_UE.h"
 #include "transport_ue.h"
-#include "PHY/phy_extern_ue.h"
+#include "PHY/phy_extern.h"
 #include "PHY/MODULATION/modulation_UE.h"
 
 //#define DEBUG_SSS
@@ -44,7 +44,7 @@ int pss_ch_est(PHY_VARS_UE *ue,
                int32_t sss_ext[4][72])
 {
 
-  int16_t *pss;
+  const int16_t *pss;
   int16_t *pss_ext2,*sss_ext2,*sss_ext3,tmp_re,tmp_im,tmp_re2,tmp_im2;
   uint8_t aarx,i;
   LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/uci_tools_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/uci_tools_ue.c
index e687ccfd049..642659f6748 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/uci_tools_ue.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/uci_tools_ue.c
@@ -56,7 +56,6 @@ void print_CQI(void *o,UCI_format_t uci_format,unsigned char eNB_id,int N_RB_DL)
   switch(uci_format) {
   case wideband_cqi_rank1_2A:
 #ifdef DEBUG_UCI
-    LOG_D(PHY,"[PRINT CQI] flat_LA %d\n", flag_LA);
     switch(N_RB_DL) {
     case 6:
       LOG_I(PHY,"[PRINT CQI] wideband_cqi rank 1: eNB %d, cqi %d\n",eNB_id,
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/ulsch_coding.c b/openair1/PHY/LTE_UE_TRANSPORT/ulsch_coding.c
index f7566abebfa..293ebc2a4fc 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/ulsch_coding.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/ulsch_coding.c
@@ -38,6 +38,7 @@
 #include "PHY/CODING/lte_interleaver_inline.h"
 #include "PHY/LTE_UE_TRANSPORT/transport_ue.h"
 #include "common/utils/LOG/vcd_signal_dumper.h"
+#include "PHY/LTE_TRANSPORT/transport_vars.h"
 
 //#define DEBUG_ULSCH_CODING
 //#define DEBUG_ULSCH_FREE 1
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c b/openair1/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c
index 341e1e90b64..838da362892 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/ulsch_modulation.c
@@ -38,6 +38,7 @@
 #include "PHY/LTE_TRANSPORT/transport_eNB.h"
 #include "common/utils/LOG/vcd_signal_dumper.h"
 #include "PHY/LTE_REFSIG/lte_refsig.h"
+#include "PHY/LTE_TRANSPORT/transport_vars.h"
 
 
 //#define DEBUG_ULSCH_MODULATION
diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c
index d4ffb66b656..5a7bd8a0207 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c
@@ -38,7 +38,7 @@
 #include "executables/softmodem-common.h"
 #include "nr_transport_proto_ue.h"
 #include "PHY/CODING/nrPolar_tools/nr_polar_dci_defs.h"
-#include "PHY/phy_extern_nr_ue.h"
+#include "PHY/phy_extern.h"
 #include "PHY/CODING/coding_extern.h"
 #include "PHY/sse_intrin.h"
 #include "common/utils/nr/nr_common.h"
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
index d5681721536..1a28d42cdc4 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
@@ -29,7 +29,7 @@
  * \warning
  */
 #include "PHY/defs_nr_UE.h"
-#include "PHY/phy_extern_nr_ue.h"
+#include "PHY/phy_extern.h"
 #include "PHY/NR_TRANSPORT/nr_transport_proto.h"
 #include "nr_transport_proto_ue.h"
 #include "PHY/sse_intrin.h"
diff --git a/openair1/PHY/phy_extern.h b/openair1/PHY/phy_extern.h
index 71db7df2bdc..97a0046bc40 100644
--- a/openair1/PHY/phy_extern.h
+++ b/openair1/PHY/phy_extern.h
@@ -24,80 +24,107 @@
 
 #include "PHY/defs_common.h"
 
-extern  char* namepointer_chMag ;
-extern char* namepointer_log2;
-extern  char fmageren_name2[512];
-
-extern unsigned int RX_DMA_BUFFER[4][NB_ANTENNAS_RX];
-extern unsigned int TX_DMA_BUFFER[4][NB_ANTENNAS_TX];
-
 #include "PHY/LTE_TRANSPORT/transport_vars.h"
 #include "PHY/defs_RU.h"
 
-extern unsigned int DAQ_MBOX;
 extern int number_of_cards;
 
-extern const short conjugate[8],conjugate2[8];
-
-
-extern short primary_synch0[144];
-extern short primary_synch1[144];
-extern short primary_synch2[144];
-extern unsigned char primary_synch0_tab[72];
-extern unsigned char primary_synch1_tab[72];
-extern unsigned char primary_synch2_tab[72];
-
-extern int flagMag;
-//extern short **txdataF_rep_tmp;
-
-extern char mode_string[4][20];
+static const short conjugate[8] __attribute__((aligned(16))) = {-1, 1, -1, 1, -1, 1, -1, 1};
+static const short conjugate2[8] __attribute__((aligned(16))) = {1, -1, 1, -1, 1, -1, 1, -1};
+
+static const short primary_synch0[144] = {
+    0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      32767,  0,      -26120, -19785, 11971,  -30502,
+    -24020, -22288, 32117,  6492,   31311,  9658,   -16384, -28378, 25100,  -21063, -7292,  -31946, 20429,  25618,  14948,  29158,
+    11971,  -30502, 31311,  9658,   25100,  -21063, -16384, 28377,  -24020, 22287,  32117,  6492,   -7292,  31945,  20429,  25618,
+    -26120, -19785, -16384, -28378, -16384, 28377,  -26120, -19785, -32402, 4883,   31311,  -9659,  32117,  6492,   -7292,  -31946,
+    32767,  -1,     25100,  -21063, -24020, 22287,  -32402, 4883,   -32402, 4883,   -24020, 22287,  25100,  -21063, 32767,  -1,
+    -7292,  -31946, 32117,  6492,   31311,  -9659,  -32402, 4883,   -26120, -19785, -16384, 28377,  -16384, -28378, -26120, -19785,
+    20429,  25618,  -7292,  31945,  32117,  6492,   -24020, 22287,  -16384, 28377,  25100,  -21063, 31311,  9658,   11971,  -30502,
+    14948,  29158,  20429,  25618,  -7292,  -31946, 25100,  -21063, -16384, -28378, 31311,  9658,   32117,  6492,   -24020, -22288,
+    11971,  -30502, -26120, -19785, 32767,  0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0};
+static const short primary_synch1[144] = {
+    0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      32767,  0,      -31754, -8086,  -24020, -22288,
+    2448,   32675,  -26120, 19784,  27073,  18458,  -16384, 28377,  25100,  21062,  -29523, 14217,  -7292,  31945,  -13477, -29868,
+    -24020, -22288, 27073,  18458,  25100,  21062,  -16384, -28378, 2448,   -32676, -26120, 19784,  -29523, -14218, -7292,  31945,
+    -31754, -8086,  -16384, 28377,  -16384, -28378, -31754, -8086,  31311,  -9659,  27073,  -18459, -26120, 19784,  -29523, 14217,
+    32767,  -1,     25100,  21062,  2448,   -32676, 31311,  -9659,  31311,  -9659,  2448,   -32676, 25100,  21062,  32767,  0,
+    -29523, 14217,  -26120, 19784,  27073,  -18459, 31311,  -9659,  -31754, -8086,  -16384, -28378, -16384, 28377,  -31754, -8086,
+    -7292,  31945,  -29523, -14218, -26120, 19784,  2448,   -32676, -16384, -28378, 25100,  21062,  27073,  18458,  -24020, -22288,
+    -13477, -29868, -7292,  31945,  -29523, 14217,  25100,  21062,  -16384, 28377,  27073,  18458,  -26120, 19784,  2448,   32675,
+    -24020, -22288, -31754, -8086,  32767,  0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0};
+static const short primary_synch2[144] = {
+    0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      32767,  0,      -31754, 8085,   -24020, 22287,
+    2448,   -32676, -26120, -19785, 27073,  -18459, -16384, -28378, 25100,  -21063, -29523, -14218, -7292,  -31946, -13477, 29867,
+    -24020, 22287,  27073,  -18459, 25100,  -21063, -16384, 28377,  2448,   32675,  -26120, -19785, -29523, 14217,  -7292,  -31946,
+    -31754, 8085,   -16384, -28378, -16384, 28377,  -31754, 8085,   31311,  9658,   27073,  18458,  -26120, -19785, -29523, -14218,
+    32767,  0,      25100,  -21063, 2448,   32675,  31311,  9658,   31311,  9658,   2448,   32675,  25100,  -21063, 32767,  0,
+    -29523, -14218, -26120, -19785, 27073,  18458,  31311,  9658,   -31754, 8085,   -16384, 28377,  -16384, -28378, -31754, 8085,
+    -7292,  -31946, -29523, 14217,  -26120, -19785, 2448,   32675,  -16384, 28377,  25100,  -21063, 27073,  -18459, -24020, 22287,
+    -13477, 29867,  -7292,  -31946, -29523, -14218, 25100,  -21063, -16384, -28378, 27073,  -18459, -26120, -19785, 2448,   -32676,
+    -24020, 22287,  -31754, 8085,   32767,  -1,     0,      0,      0,      0,      0,      0,      0,      0,      0,      0};
 
 extern unsigned char NB_RU;
 
 
-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];
-extern int table_length[MCS_COUNT];
-extern const double sinr_to_cqi[4][16];
-extern const int cqi_to_mcs[16];
-
-//for MU-MIMO abstraction using MIESM
-//this 2D arrarays contains SINR, MI and RBIR in rows 1, 2, and 3 respectively
-extern double MI_map_4qam[3][162];
-extern double MI_map_16qam[3][197];
-extern double MI_map_64qam[3][227];
-
-extern const double beta1_dlsch_MI[6][MCS_COUNT];
-extern const double beta2_dlsch_MI[6][MCS_COUNT];
-
-extern const double q_qpsk[8];
-extern const double q_qam16[8];
-extern const double q_qam64[8];
-extern const double p_qpsk[8];
-extern const double p_qam16[8];
-extern const double p_qam64[8];
-
-extern const double beta1_dlsch[6][MCS_COUNT];
-extern const double beta2_dlsch[6][MCS_COUNT];
-
-extern const char NB_functions[7][20];
-extern const char NB_timing[2][20];
-extern const char ru_if_types[MAX_RU_IF_TYPES][20];
+static const char NB_functions[7][20] = {
+    "eNodeB_3GPP",
+    "eNodeB_3GPP_BBU",
+    "NGFI_RAU_IF4p5",
+    "NGFI_RRU_IF5",
+    "NGFI_RRU_IF4p5",
+    "gNodeB_3GPP",
+};
+static const char NB_timing[2][20] = {"synch_to_ext_device", "synch_to_other"};
+static const char ru_if_types[MAX_RU_IF_TYPES][20] = {"local RF", "IF5 RRU", "IF5 Mobipass", "IF4p5 RRU", "IF1pp RRU"};
 
 extern int16_t unscrambling_lut[65536*16];
 extern uint8_t scrambling_lut[65536*16];
 
-extern unsigned short msrsb_6_40[8][4];
-extern unsigned short msrsb_41_60[8][4];
-extern unsigned short msrsb_61_80[8][4];
-extern unsigned short msrsb_81_110[8][4];
-extern unsigned short Nb_6_40[8][4];
-extern unsigned short Nb_41_60[8][4];
-extern unsigned short Nb_61_80[8][4];
-extern unsigned short Nb_81_110[8][4];
+static const unsigned short Nb_6_40[8][4] = {
+  {36,12,4,4},
+  {32,16,8,4},
+  {24,4,4,4},
+  {20,4,4,4},
+  {16,4,4,4},
+  {12,4,4,4},
+  {8,4,4,4},
+  {4,4,4,4}
+};
+static const unsigned short Nb_41_60[8][4] = {
+  {48,24,12,4},
+  {48,16,8,4},
+  {40,20,4,4},
+  {36,12,4,4},
+  {32,16,8,4},
+  {24,4,4,4},
+  {20,4,4,4},
+  {16,4,4,4}
+};
+static const unsigned short Nb_61_80[8][4] = {
+  {72,24,12,4},
+  {64,32,16,4},
+  {60,20,4,4},
+  {48,24,12,4},
+  {48,16,8,4},
+  {40,20,4,4},
+  {36,12,4,4},
+  {32,16,8,4}
+};
+static const unsigned short Nb_81_110[8][4] = {
+  {96,48,24,4},
+  {96,32,16,4},
+  {80,40,20,4},
+  {72,24,12,4},
+  {64,32,16,4},
+  {60,20,4,4},
+  {48,24,12,4},
+  {48,16,8,4}
+};
+
+static const uint8_t alpha_lut[8] = {0, 40, 50, 60, 70, 80, 90, 100};
 
-extern uint8_t alpha_lut[8];
 extern uint8_t max_turbo_iterations;
+extern double cpuf;
+
 #endif /*__PHY_EXTERN_H__ */
 
diff --git a/openair1/PHY/phy_extern_nr_ue.h b/openair1/PHY/phy_extern_nr_ue.h
index 4701a160121..98765730bbe 100644
--- a/openair1/PHY/phy_extern_nr_ue.h
+++ b/openair1/PHY/phy_extern_nr_ue.h
@@ -23,90 +23,7 @@
 #define __PHY_EXTERN_NR_UE__H__
 
 #include "PHY/defs_nr_UE.h"
-//#include "common/ran_context.h"
-
-#ifdef XFORMS
-  #include "PHY/TOOLS/nr_phy_scope.h"
-  extern uint32_t do_forms;
-#endif
-
-extern char* namepointer_chMag ;
-extern char* namepointer_log2;
-extern char  fmageren_name2[512];
-
-extern unsigned int RX_DMA_BUFFER[4][NB_ANTENNAS_RX];
-extern unsigned int TX_DMA_BUFFER[4][NB_ANTENNAS_TX];
-
-extern uint64_t downlink_frequency[MAX_NUM_CCs][4];
-extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
-
-extern const short conjugate[8],conjugate2[8];
-extern int number_of_cards;
-
-
 extern PHY_VARS_NR_UE ***PHY_vars_UE_g;
 
-extern short primary_synch0[144];
-extern short primary_synch1[144];
-extern short primary_synch2[144];
-extern unsigned char primary_synch0_tab[72];
-extern unsigned char primary_synch1_tab[72];
-extern unsigned char primary_synch2_tab[72];
-extern int16_t *primary_synch0_time; //!< index: [0..ofdm_symbol_size*2[
-extern int16_t *primary_synch1_time; //!< index: [0..ofdm_symbol_size*2[
-extern int16_t *primary_synch2_time; //!< index: [0..ofdm_symbol_size*2[
-
-extern int flagMag;
-//extern short **txdataF_rep_tmp;
-
-extern char mode_string[4][20];
-
-extern unsigned char NB_RU;
-
-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];
-extern int table_length[MCS_COUNT];
-extern const double sinr_to_cqi[4][16];
-extern const int cqi_to_mcs[16];
-
-//for MU-MIMO abstraction using MIESM
-//this 2D arrarays contains SINR, MI and RBIR in rows 1, 2, and 3 respectively
-extern double MI_map_4qam[3][162];
-extern double MI_map_16qam[3][197];
-extern double MI_map_64qam[3][227];
-
-extern const double beta1_dlsch_MI[6][MCS_COUNT];
-extern const double beta2_dlsch_MI[6][MCS_COUNT];
-
-extern const double q_qpsk[8];
-extern const double q_qam16[8];
-extern const double q_qam64[8];
-
-extern const double beta1_dlsch[6][MCS_COUNT];
-extern const double beta2_dlsch[6][MCS_COUNT];
-
-extern const char NB_functions[7][20];
-extern const char NB_timing[2][20];
-extern const char ru_if_types[MAX_RU_IF_TYPES][20];
-
-extern int16_t unscrambling_lut[65536*16];
-extern uint8_t scrambling_lut[65536*16];
-
-extern unsigned short msrsb_6_40[8][4];
-extern unsigned short msrsb_41_60[8][4];
-extern unsigned short msrsb_61_80[8][4];
-extern unsigned short msrsb_81_110[8][4];
-extern unsigned short Nb_6_40[8][4];
-extern unsigned short Nb_41_60[8][4];
-extern unsigned short Nb_61_80[8][4];
-extern unsigned short Nb_81_110[8][4];
-
-extern uint16_t hundred_times_log10_NPRB[100];
-extern uint8_t alpha_lut[8];
-extern uint8_t max_turbo_iterations;
-
-extern double cpuf;
-
 #endif /*__PHY_EXTERN_H__ */
 
diff --git a/openair1/PHY/phy_extern_ue.h b/openair1/PHY/phy_extern_ue.h
index 0249ed0147a..dd4740e27a8 100644
--- a/openair1/PHY/phy_extern_ue.h
+++ b/openair1/PHY/phy_extern_ue.h
@@ -24,79 +24,9 @@
 
 #include "PHY/defs_UE.h"
 
-extern  char* namepointer_chMag ;
-extern char* namepointer_log2;
-extern  char fmageren_name2[512];
-
-extern unsigned int RX_DMA_BUFFER[4][NB_ANTENNAS_RX];
-extern unsigned int TX_DMA_BUFFER[4][NB_ANTENNAS_TX];
-
-#include "PHY/LTE_TRANSPORT/transport_vars.h"
-
-extern int number_of_cards;
-
-extern const short conjugate[8],conjugate2[8];
-
-
 extern PHY_VARS_UE ***PHY_vars_UE_g;
 
-extern short primary_synch0[144];
-extern short primary_synch1[144];
-extern short primary_synch2[144];
-extern unsigned char primary_synch0_tab[72];
-extern unsigned char primary_synch1_tab[72];
-extern unsigned char primary_synch2_tab[72];
-
-extern int flagMag;
-//extern short **txdataF_rep_tmp;
-
-extern char mode_string[4][20];
-
-
-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];
-extern int table_length[MCS_COUNT];
-extern const double sinr_to_cqi[4][16];
-extern const int cqi_to_mcs[16];
-
-//for MU-MIMO abstraction using MIESM
-//this 2D arrarays contains SINR, MI and RBIR in rows 1, 2, and 3 respectively
-extern double MI_map_4qam[3][162];
-extern double MI_map_16qam[3][197];
-extern double MI_map_64qam[3][227];
-
-extern const double beta1_dlsch_MI[6][MCS_COUNT];
-extern const double beta2_dlsch_MI[6][MCS_COUNT];
-
-extern const double q_qpsk[8];
-extern const double q_qam16[8];
-extern const double q_qam64[8];
-
-extern const double p_qpsk[8];
-extern const double p_qam16[8];
-extern const double p_qam64[8];
-
-extern const double beta1_dlsch[6][MCS_COUNT];
-extern const double beta2_dlsch[6][MCS_COUNT];
-
-extern const char NB_functions[7][20];
-extern const char NB_timing[2][20];
-extern const char ru_if_types[MAX_RU_IF_TYPES][20];
-
-extern int16_t unscrambling_lut[65536*16];
-extern uint8_t scrambling_lut[65536*16];
-
-extern unsigned short msrsb_6_40[8][4];
-extern unsigned short msrsb_41_60[8][4];
-extern unsigned short msrsb_61_80[8][4];
-extern unsigned short msrsb_81_110[8][4];
-extern unsigned short Nb_6_40[8][4];
-extern unsigned short Nb_41_60[8][4];
-extern unsigned short Nb_61_80[8][4];
-extern unsigned short Nb_81_110[8][4];
-
-extern uint8_t alpha_lut[8];
 extern uint8_t max_turbo_iterations;
+
 #endif /*__PHY_EXTERN_H__ */
 
diff --git a/openair1/PHY/phy_vars.h b/openair1/PHY/phy_vars.h
index b1899639fbd..89063c5be2f 100644
--- a/openair1/PHY/phy_vars.h
+++ b/openair1/PHY/phy_vars.h
@@ -22,104 +22,18 @@
 #ifndef __PHY_VARS_H__
 #define __PHY_VARS_H__
 
-#include "PHY/types.h"
-#include "PHY/defs_eNB.h"
-#include "PHY/defs_gNB.h"
 #include "PHY/defs_UE.h"
 
-char* namepointer_chMag ;
-char fmageren_name2[512];
-char* namepointer_log2;
-
-
-#include "PHY/LTE_REFSIG/primary_synch.h"
-
-#include "PHY/LTE_TRANSPORT/transport_vars.h"
-
-#include "nfapi/oai_integration/vendor_ext.h"
+#include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h"
+#include "openair2/PHY_INTERFACE/IF_Module.h"
 
 
 PHY_VARS_UE ***PHY_vars_UE_g;
 UL_RCC_IND_t UL_RCC_INFO;
 NR_UL_IND_t UL_INFO;
 
-unsigned short rev[2048],rev_times4[8192],rev_half[1024];
-unsigned short rev256[256],rev512[512],rev1024[1024],rev4096[4096],rev2048[2048],rev8192[8192];
-
-
-const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1};
-const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1};
-
 unsigned char NB_RU=0;
-
 int number_of_cards;
-
-
-int flag_LA=0;
-int flagMag;
-//extern  channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX];
-//extern  double ABS_SINR_eff_BLER_table[MCS_COUNT][9][9];
-//extern  double ABS_beta[MCS_COUNT];odi
-double sinr_bler_map[MCS_COUNT][2][MCS_TABLE_LENGTH_MAX];
-int table_length[MCS_COUNT];
-//double sinr_bler_map_up[MCS_COUNT][2][16];
-
-//for MU-MIMO abstraction using MIESM
-//this 2D arrarays contains SINR, MI and RBIR in rows 1, 2, and 3 respectively
-double MI_map_4qam[3][162];
-double MI_map_16qam[3][197];
-double MI_map_64qam[3][227];
-
-// here the first index is for transmission mode 1, 2, 5 and 6 whereas the second index is for the 16 sinr vaues corresponding to 16 CQIs
-const double sinr_to_cqi[4][16]= { {-2.5051, -2.5051, -1.7451, -0.3655, 1.0812, 2.4012, 3.6849, 6.6754, 8.3885, 8.7970, 12.0437, 14.4709, 15.7281,  17.2424,  17.2424, 17.2424},
-  {-2.2360, -2.2360, -1.3919, -0.0218, 1.5319,  2.9574,  4.3234, 6.3387, 8.9879, 9.5096, 12.6609, 14.0116, 16.4984, 18.1572, 18.1572, 18.1572},
-  {-1, -1.0000, -0.4198, -0.0140, 1.0362,  2.3520, 3.5793, 6.1136, 8.4836, 9.0858, 12.4723, 13.9128, 16.2054, 17.7392, 17.7392, 17.7392},
-  { -4.1057, -4.1057, -3.3768, -2.2916, -1.1392, 0.1236, 1.2849, 3.1933, 5.9298, 6.4052, 9.6245, 10.9414, 13.5166, 14.9545, 14.9545, 14.9545}
-};
-
-const int cqi_to_mcs[16]= {0, 0, 1, 2, 4, 6, 8, 11, 13, 16, 18, 20, 23, 25, 27, 28};
-
-//for SNR to MI conversion 7 th order Polynomial coeff
-const double q_qam16[8]= {3.21151853033897e-10,5.55435952230651e-09,-2.30760065362117e-07,-6.25587743817859e-06,4.62251036452795e-06,0.00224150813158937,0.0393723140344367,0.245486379182639};
-const double q_qpsk[8]= {1.94491167814437e-09,8.40494123817774e-08,4.75527131198034e-07,-2.48946285301621e-05,-0.000347614016158364,0.00209252225437100,0.0742986115462510,0.488297879889425};
-const double q_qam64[8]= {2.25934026232206e-11,-1.45992206328306e-10,-3.70861183071900e-08,-1.22206071019319e-06,6.49115500399637e-06,0.00129828997837433,0.0259669554914859,0.166602901214898};
-
-//for MI to SNR conversion 7 th order Polynomial coeff
-const double p_qpsk[8]= {5982.42405670359,-21568.1135917693,31293.9987036905,-23394.6795043871,9608.34750585489,-2158.15802349899,267.731968719036,-20.6145324295965};
-const double p_qam16[8]= {7862.12690694170,-28510.3207048338,41542.2150287122,-31088.3036957379,12690.1982361016,-2785.66604739984,326.595462489375,-18.9911849872089};
-const double p_qam64[8]= {8832.57933013696,-32119.1802555952,46914.2578990397,-35163.8150557183,14343.7419388853,-3126.61025510092,360.954930562237,-18.0358548533343};
-
-// ideal CE MIESM
-
-const double beta1_dlsch_MI[6][MCS_COUNT] = { {1.1188, 0.3720, 0.3755, 0.9453, 0.5799, 0.5256, 0.5485, 0.5340, 0.5165, 0.5300, 0.6594, 0.5962, 0.4884, 0.4927, 0.3687, 0.4614, 0.4081, 0.2639,0.2935,0.2520,0.3709,0.2906,0.2612,0.2390}, {0.7138, 0.5533, 0.5533, 0.4828, 0.4998, 0.4843, 0.4942, 0.5323, 0.5142, 0.4756, 0.5792, 0.4167, 0.4445, 0.3942, 0.3789, 0.2756, 0.4456, 0.1650, 0.2254, 0.2353, 0.2097,0.2517,0.3242,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, 1,1,1,1,1,1,1},{1.808065416202085, 1.754544945430673,1.902272019362616, 1.790054645392961, 1.563204092967629, 1.585258289348813, 1.579349443720310, 1.570650121437345, 1.545055626608596, 1.362229442426877, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33, 1,1,1,1,1,1,1},{0.7146, 0.4789, 0.5392, 0.5556, 0.4975, 0.4847, 0.4691, 0.5261, 0.5278, 0.4962, 0.4468, 0.4113, 0.4622, 0.4609, 0.3946, 0.3991, 0.3532, 0.2439, 0.1898, 0.2929, 0.2712, 0.3367, 0.3591, 0.2571}};
-const double beta2_dlsch_MI[6][MCS_COUNT] = { {1.1293, 0.3707, 0.3722, 0.9310, 0.5808, 0.5265, 0.5404, 0.5279, 0.5210, 0.5226, 0.6438, 0.5827, 0.4804, 0.4830, 0.3638, 0.4506, 0.4107, 0.2547, 0.2797, 0.2413, 0.3351, 0.2750, 0.2568, 0.2273}, {0.7028, 0.5503, 0.5503, 0.4815, 0.5006, 0.4764, 0.4810, 0.5124, 0.4964, 0.4485, 0.5497, 0.3971, 0.4239, 0.3701, 0.3494, 0.2630, 0.4053, 0.1505, 0.2001,0.2024,0.1788,0.2124,0.2668,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, 1, 1,1,1,1,1,1},{1.079518113138858, 1.105622953570353, 1.031337449900606, 1.073342032668810, 1.242636589110353, 1.255054927783647, 1.291463834317768, 1.317048698347491, 1.354485054187984, 0.338534029291017, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33,1, 1,1,1,1,1,1},{0.6980, 0.4694, 0.5379, 0.5483, 0.4982, 0.4737, 0.4611, 0.5051, 0.5020, 0.4672, 0.4357, 0.3957, 0.4389, 0.4344, 0.3645, 0.3661, 0.3301, 0.2179, 0.1730, 0.2536, 0.2389,0.2884,0.2936,0.2226}};
-
-//real CE MIESM
-/*
-double beta1_dlsch_MI[6][MCS_COUNT] = { {1.32955, 0.59522, 0.54024, 0.98698, 0.81305, 0.76976, 0.69258, 0.69713, 0.70546, 0.69111, 0.81904, 0.72664, 0.79491, 0.72562, 0.53980, 0.33134, 0.50550, 0.40602,0.40281,0.47012,0.50510,0.23540,0.32045,1}, {0.59632, 1.08475, 1.02431, 1.07020, 0.90170, 0.97719, 0.95464, 0.92764, 0.86721, 0.85986, 0.64558, 0.80631, 0.82673, 0.82888, 0.87122, 0.77245, 0.29771, 0.43477, 0.55321, 0.61027, 0.56111, 0.57292, 0.39737,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, 1,1,1,1,1,1,1},{1.808065416202085, 1.754544945430673,1.902272019362616, 1.790054645392961, 1.563204092967629, 1.585258289348813, 1.579349443720310, 1.570650121437345, 1.545055626608596, 1.362229442426877, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33, 1,1,1,1,1,1,1},{0.77532, 1.07544, 1.10571, 1.04099, 0.91638, 0.88644, 0.96405, 0.86709, 0.94066, 0.84430, 1.24478, 1.09665, 1.42604, 0.79541, 0.71847, 0.71604, 0.74561, 0.36431, 0.41536, 0.52175, 0.47096, 0.49977, 0.59728,1}};
-double beta2_dlsch_MI[6][MCS_COUNT] = { {1.36875, 0.59304, 0.53870, 0.98239, 0.81637, 0.76847, 0.69842, 0.69885, 0.69967, 0.69826, 0.82660, 0.70559, 0.78404, 0.70670, 0.55393, 0.36893, 0.52225, 0.39752, 0.40494, 0.46239, 0.49247,0.26900,0.34504,1}, {0.43775, 0.78208, 0.72875, 0.77458, 0.64485, 0.69174, 0.66097, 0.63289, 0.59652, 0.61175, 0.44551, 0.56047, 0.57314, 0.57553, 0.58849, 0.52159, 0.21241, 0.30139, 0.37373, 0.32029, 0.37067, 0.36706, 0.27118,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, 1, 1,1,1,1,1,1},{1.079518113138858, 1.105622953570353, 1.031337449900606, 1.073342032668810, 1.242636589110353, 1.255054927783647, 1.291463834317768, 1.317048698347491, 1.354485054187984, 0.338534029291017, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33,1, 1,1,1,1,1,1},{0.54448, 0.73731, 0.79165, 0.74407, 0.68042, 0.64906, 0.71349, 0.62109, 0.65815, 0.60940, 0.90549, 0.78708, 1.03176, 0.58431, 0.53379, 0.51224, 0.52767, 0.26848, 0.29642, 0.36879, 0.34148, 0.35279,0.40633,1}};
-*/
-//ideal channel estimation values
-//double beta1_dlsch[6][MCS_COUNT] = { {2.3814, 0.4956, 0.5273, 1.1708, 0.8014, 0.7889, 0.8111, 0.8139, 0.8124, 0.8479, 1.9280, 1.9664, 2.3857, 2.5147, 2.4511, 3.0158, 2.8643, 5.3013, 5.8594, 6.5372, 7.8073, 7.8030, 7.5295, 7.1320}, {0.5146, 0.5549, 0.7405, 0.6913, 0.7349, 0.7000, 0.7539, 0.7955, 0.8074, 0.7760, 1.8150, 1.6561, 1.9280, 2.3563, 2.6699, 2.3086, 3.1601, 4.5316, 5.2870, 6.0983, 6.5635, 7.7024, 9.9592, 6.6173}, {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, 1,1,1,1,1,1}, {1.79358, 1.17908, 2.02600, 1.72040, 1.58618, 1.59039, 1.68111, 1.67062, 1.64911, 1.33274, 4.87800, 3.58797, 3.72338, 5.35700, 2.81752, 1.93472, 2.23259, 1,1,1,1,1,1,1}, {0.4445, 0.5918, 0.7118, 0.7115, 0.7284, 0.7202, 0.7117, 0.8111, 0.8239, 0.7907, 1.8456, 1.8144, 2.3830, 2.6634, 2.6129, 2.8127, 2.7372, 4.9424, 4.8763, 6.8413, 7.1493, 9.4180, 10.1230, 8.9613}};
-//double beta2_dlsch[6][MCS_COUNT] = { {2.3639, 0.4952, 0.5207, 1.1572, 0.8026, 0.7864, 0.7996, 0.8034, 0.8200, 0.8367, 1.8701, 1.9212, 2.2947, 2.4472, 2.4091, 2.9479, 2.8973, 5.0591, 5.5134, 6.1483, 7.2166, 7.5177, 7.5704, 7.2248}, {0.5113, 0.5600, 0.7359, 0.6860, 0.7344, 0.6902, 0.7315, 0.7660, 0.7817, 0.7315, 1.7268, 1.5912, 1.8519, 2.2115, 2.4580, 2.1879, 2.9015, 4.1543, 4.6986, 5.3193, 5.6319, 6.5640, 8.2421, 5.6393}, {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, 1,1,1,1,1,1}, {0.79479, 0.52872, 0.90005, 0.77170, 0.73220, 0.72060, 0.75433, 0.75451, 0.75989, 0.67655, 1.68525, 1.31100, 1.46573, 1.99843, 1.57293, 1.62852, 2.10636, 1,1,1,1,1,1,1}, {0.4398, 0.5823, 0.7094, 0.7043, 0.7282, 0.7041, 0.6979, 0.7762, 0.7871, 0.7469, 1.7752, 1.7443, 2.2266, 2.4767, 2.4146, 2.6040, 2.5708, 4.4488, 4.4944, 5.9630, 6.3740, 8.1097, 8.4210, 7.8027}};
-const double beta1_dlsch[6][MCS_COUNT] = { {1.199175, 1.085656, 0.983872, 0.843789, 0.816093, 0.853078, 0.899236, 0.919665, 0.888673, 0.924181, 0.814176, 0.794108, 0.770653, 0.826266, 0.982043, 0.979621, 0.985176, 0.901741, 0.870311, 0.911303, 0.898923, 1.003359, 0.988535, 1.030639, 1.151038, 1.116939, 1.214118, 1.219148}, {0.5146, 0.5549, 0.7405, 0.6913, 0.7349, 0.7000, 0.7539, 0.7955, 0.8074, 0.7760, 1.8150, 1.6561, 1.9280, 2.3563, 2.6699, 2.3086, 3.1601, 4.5316, 5.2870, 6.0983, 6.5635, 7.7024, 9.9592, 6.6173}, {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, 1,1,1,1,1,1}, {1.79358, 1.17908, 2.02600, 1.72040, 1.58618, 1.59039, 1.68111, 1.67062, 1.64911, 1.33274, 4.87800, 3.58797, 3.72338, 5.35700, 2.81752, 1.93472, 2.23259, 1,1,1,1,1,1,1}, {0.4445, 0.5918, 0.7118, 0.7115, 0.7284, 0.7202, 0.7117, 0.8111, 0.8239, 0.7907, 1.8456, 1.8144, 2.3830, 2.6634, 2.6129, 2.8127, 2.7372, 4.9424, 4.8763, 6.8413, 7.1493, 9.4180, 10.1230, 8.9613}};
-const double beta2_dlsch[6][MCS_COUNT] = { {0.534622, 0.596561, 0.500838, 0.471721, 0.548218, 0.547974, 0.924245, 0.836484, 0.776917, 0.879691, 0.875722, 0.666933, 0.666393, 0.755377, 1.074985, 1.080290, 1.010914, 0.790892, 0.793435, 0.860249, 0.901508, 0.967060, 0.951372, 1.011493, 1.106151, 1.117076, 1.209397, 1.227790}, {0.5113, 0.5600, 0.7359, 0.6860, 0.7344, 0.6902, 0.7315, 0.7660, 0.7817, 0.7315, 1.7268, 1.5912, 1.8519, 2.2115, 2.4580, 2.1879, 2.9015, 4.1543, 4.6986, 5.3193, 5.6319, 6.5640, 8.2421, 5.6393}, {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, 1,1,1,1,1,1}, {0.79479, 0.52872, 0.90005, 0.77170, 0.73220, 0.72060, 0.75433, 0.75451, 0.75989, 0.67655, 1.68525, 1.31100, 1.46573, 1.99843, 1.57293, 1.62852, 2.10636, 1,1,1,1,1,1,1}, {0.4398, 0.5823, 0.7094, 0.7043, 0.7282, 0.7041, 0.6979, 0.7762, 0.7871, 0.7469, 1.7752, 1.7443, 2.2266, 2.4767, 2.4146, 2.6040, 2.5708, 4.4488, 4.4944, 5.9630, 6.3740, 8.1097, 8.4210, 7.8027}};
-
-//real channel estimation valus
-/*
-double beta1_dlsch[6][MCS_COUNT] = { {2.50200, 0.84047, 0.78195, 1.37929, 1.16871, 1.11906, 1.06303, 1.07447, 1.11403, 1.09223, 2.82502, 2.87556, 3.51254, 3.62920, 3.53638, 2.35980, 3.74126, 8.66532, 7.31772, 9.86882, 10.64939, 6.75208, 9.50664, 13.63057}, {0.92257, 1, 1.80445, 1.43175, 1.42093, 1.37381, 1.45392, 1.47255, 1.47451, 1.41235, 3.9079, 3.38557, 4.13059, 4.93355, 4.97277, 6.04951, 5.88896, 8.68076, 10.23746, 12.37069, 5.50538, 17.29612, 17.95050, 13.27095}, {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, 1,1,1,1,1,1}, {1.79255, 1.88213, 4.44226, 2.25150, 1.93710, 2.18504, 2.57389, 1.94322, 1.78515, 2.09265, 2.37459, 1.74442, 1.74346, 1.19705, 1.56149, 1.59604, 1.6, 1,1,1,1,1,1,1}, {0.93374, 1.40389, 1.36670, 1.38679, 1.35707, 1.26353, 1.32360, 1.40164, 1.51843, 1.34863, 3.45839, 3.13726, 3.94768, 4.21966, 4.60750, 4.97894, 5.40755, 8.12814, 10.59221, 12.96427, 13.37323, 14.27206, 16.61779, 17.19656}};
-double beta2_dlsch[6][MCS_COUNT] = { {2.52163, 0.83231, 0.77472, 1.36536, 1.16829, 1.11186, 1.06287, 1.07292, 1.09946, 1.10650, 2.79174, 2.75655, 3.36651, 3.49011, 3.60903, 2.73517, 3.84009, 8.20312, 7.41739, 9.64081, 10.40911, 8.11765, 10.41923, 9.34300}, {0.67252, 0.8600, 1.28633, 1.01624, 1.03066, 0.97590, 1.02560, 1.01840, 1.00547, 0.97093, 2.72573, 2.33283, 2.86181, 3.40452, 3.47957, 4.08916, 3.97628, 6.14541, 7.11017, 8.42369, 4.04812, 11.42082, 11.57171, 9.28462}, {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, 1,1,1,1,1,1}, {0.85784, 0.90361, 2.09766, 1.08385, 0.96300, 1.04432, 1.22763, 0.99249, 0.95544, 1.12333, 1.37924, 1.12913, 1.30644, 1.19253, 1.75488, 2.13813, 2.10636, 1,1,1,1,1,1,1}, {0.66288, 0.96402, 0.98545, 0.99386, 0.99981, 0.92678, 0.98978, 0.99600, 1.05538, 0.97777, 2.52504, 2.29338, 2.89631, 3.10812, 3.41916, 3.58671, 3.84166, 6.05254, 7.45821, 9.15812, 9.66330, 10.17852, 11.50519, 11.16299}};
-
-*/
-
-const char NB_functions[7][20]={"eNodeB_3GPP","eNodeB_3GPP_BBU","NGFI_RAU_IF4p5","NGFI_RRU_IF5","NGFI_RRU_IF4p5","gNodeB_3GPP",};
-const char NB_timing[2][20]={"synch_to_ext_device","synch_to_other"};
-const char ru_if_types[MAX_RU_IF_TYPES][20]={"local RF","IF5 RRU","IF5 Mobipass","IF4p5 RRU","IF1pp RRU"};
-
-/// lookup table for unscrambling in RX
-int16_t unscrambling_lut[65536*16] __attribute__((aligned(32)));
-/// lookup table for scrambling in TX
-uint8_t scrambling_lut[65536*16] __attribute__((aligned(32)));
-
 uint8_t max_turbo_iterations=4;
+
 #endif /*__PHY_VARS_H__ */
diff --git a/openair1/PHY/phy_vars_nr_ue.h b/openair1/PHY/phy_vars_nr_ue.h
index 99b22ab69d1..2201091270a 100644
--- a/openair1/PHY/phy_vars_nr_ue.h
+++ b/openair1/PHY/phy_vars_nr_ue.h
@@ -22,16 +22,8 @@
 #ifndef __PHY_VARS_NR_UE_H__
 #define __PHY_VARS_NR_UE_H__
 
-#include "PHY/types.h"
 #include "PHY/defs_nr_UE.h"
 
-#include "common/ran_context.h"
-
 PHY_VARS_NR_UE ***PHY_vars_UE_g;
 
-const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1};
-const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1};
-
-const char ru_if_types[MAX_RU_IF_TYPES][20]={"local RF","IF5 RRU","IF5 Mobipass","IF4p5 RRU","IF1pp RRU"};
-
 #endif
diff --git a/openair1/PHY/phy_vars_ue.h b/openair1/PHY/phy_vars_ue.h
index 92a135b44ea..12f49d6b0a6 100644
--- a/openair1/PHY/phy_vars_ue.h
+++ b/openair1/PHY/phy_vars_ue.h
@@ -22,95 +22,11 @@
 #ifndef __PHY_VARS_UE__H__
 #define __PHY_VARS_UE__H__
 
-#include "PHY/types.h"
 #include "PHY/defs_UE.h"
 
-#include "common/ran_context.h"
-
-char *namepointer_chMag ;
-char fmageren_name2[512];
-char *namepointer_log2;
-
-
-#include "PHY/LTE_REFSIG/primary_synch.h"
-
 PHY_VARS_UE ***PHY_vars_UE_g;
 
-unsigned short rev[2048],rev_times4[8192],rev_half[1024];
-unsigned short rev256[256],rev512[512],rev1024[1024],rev4096[4096],rev2048[2048],rev8192[8192];
-
-
-const short conjugate[8]__attribute__((aligned(16))) = {-1,1,-1,1,-1,1,-1,1};
-const short conjugate2[8]__attribute__((aligned(16))) = {1,-1,1,-1,1,-1,1,-1};
-
 int number_of_cards;
-
-
-int flag_LA=0;
-int flagMag;
-//extern  channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX];
-//extern  double ABS_SINR_eff_BLER_table[MCS_COUNT][9][9];
-//extern  double ABS_beta[MCS_COUNT];odi
-double sinr_bler_map[MCS_COUNT][2][MCS_TABLE_LENGTH_MAX];
-int table_length[MCS_COUNT];
-//double sinr_bler_map_up[MCS_COUNT][2][16];
-
-//for MU-MIMO abstraction using MIESM
-//this 2D arrarays contains SINR, MI and RBIR in rows 1, 2, and 3 respectively
-double MI_map_4qam[3][162];
-double MI_map_16qam[3][197];
-double MI_map_64qam[3][227];
-
-// here the first index is for transmission mode 1, 2, 5 and 6 whereas the second index is for the 16 sinr vaues corresponding to 16 CQIs
-const double sinr_to_cqi[4][16]= { {-2.5051, -2.5051, -1.7451, -0.3655, 1.0812, 2.4012, 3.6849, 6.6754, 8.3885, 8.7970, 12.0437, 14.4709, 15.7281,  17.2424,  17.2424, 17.2424},
-  {-2.2360, -2.2360, -1.3919, -0.0218, 1.5319,  2.9574,  4.3234, 6.3387, 8.9879, 9.5096, 12.6609, 14.0116, 16.4984, 18.1572, 18.1572, 18.1572},
-  {-1, -1.0000, -0.4198, -0.0140, 1.0362,  2.3520, 3.5793, 6.1136, 8.4836, 9.0858, 12.4723, 13.9128, 16.2054, 17.7392, 17.7392, 17.7392},
-  { -4.1057, -4.1057, -3.3768, -2.2916, -1.1392, 0.1236, 1.2849, 3.1933, 5.9298, 6.4052, 9.6245, 10.9414, 13.5166, 14.9545, 14.9545, 14.9545}
-};
-
-const int cqi_to_mcs[16]= {0, 0, 1, 2, 4, 6, 8, 11, 13, 16, 18, 20, 23, 25, 27, 28};
-
-//for SNR to MI conversion 7 th order Polynomial coeff
-const double q_qam16[8]= {3.21151853033897e-10,5.55435952230651e-09,-2.30760065362117e-07,-6.25587743817859e-06,4.62251036452795e-06,0.00224150813158937,0.0393723140344367,0.245486379182639};
-const double q_qpsk[8]= {1.94491167814437e-09,8.40494123817774e-08,4.75527131198034e-07,-2.48946285301621e-05,-0.000347614016158364,0.00209252225437100,0.0742986115462510,0.488297879889425};
-const double q_qam64[8]= {2.25934026232206e-11,-1.45992206328306e-10,-3.70861183071900e-08,-1.22206071019319e-06,6.49115500399637e-06,0.00129828997837433,0.0259669554914859,0.166602901214898};
-
-//for MI to SNR conversion 7 th order Polynomial coeff
-const double p_qpsk[8]= {5982.42405670359,-21568.1135917693,31293.9987036905,-23394.6795043871,9608.34750585489,-2158.15802349899,267.731968719036,-20.6145324295965};
-const double p_qam16[8]= {7862.12690694170,-28510.3207048338,41542.2150287122,-31088.3036957379,12690.1982361016,-2785.66604739984,326.595462489375,-18.9911849872089};
-const double p_qam64[8]= {8832.57933013696,-32119.1802555952,46914.2578990397,-35163.8150557183,14343.7419388853,-3126.61025510092,360.954930562237,-18.0358548533343};
-
-// ideal CE MIESM
-
-const double beta1_dlsch_MI[6][MCS_COUNT] = { {1.1188, 0.3720, 0.3755, 0.9453, 0.5799, 0.5256, 0.5485, 0.5340, 0.5165, 0.5300, 0.6594, 0.5962, 0.4884, 0.4927, 0.3687, 0.4614, 0.4081, 0.2639,0.2935,0.2520,0.3709,0.2906,0.2612,0.2390}, {0.7138, 0.5533, 0.5533, 0.4828, 0.4998, 0.4843, 0.4942, 0.5323, 0.5142, 0.4756, 0.5792, 0.4167, 0.4445, 0.3942, 0.3789, 0.2756, 0.4456, 0.1650, 0.2254, 0.2353, 0.2097,0.2517,0.3242,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, 1,1,1,1,1,1,1},{1.808065416202085, 1.754544945430673,1.902272019362616, 1.790054645392961, 1.563204092967629, 1.585258289348813, 1.579349443720310, 1.570650121437345, 1.545055626608596, 1.362229442426877, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33, 1,1,1,1,1,1,1},{0.7146, 0.4789, 0.5392, 0.5556, 0.4975, 0.4847, 0.4691, 0.5261, 0.5278, 0.4962, 0.4468, 0.4113, 0.4622, 0.4609, 0.3946, 0.3991, 0.3532, 0.2439, 0.1898, 0.2929, 0.2712, 0.3367, 0.3591, 0.2571}};
-const double beta2_dlsch_MI[6][MCS_COUNT] = { {1.1293, 0.3707, 0.3722, 0.9310, 0.5808, 0.5265, 0.5404, 0.5279, 0.5210, 0.5226, 0.6438, 0.5827, 0.4804, 0.4830, 0.3638, 0.4506, 0.4107, 0.2547, 0.2797, 0.2413, 0.3351, 0.2750, 0.2568, 0.2273}, {0.7028, 0.5503, 0.5503, 0.4815, 0.5006, 0.4764, 0.4810, 0.5124, 0.4964, 0.4485, 0.5497, 0.3971, 0.4239, 0.3701, 0.3494, 0.2630, 0.4053, 0.1505, 0.2001,0.2024,0.1788,0.2124,0.2668,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, 1, 1,1,1,1,1,1},{1.079518113138858, 1.105622953570353, 1.031337449900606, 1.073342032668810, 1.242636589110353, 1.255054927783647, 1.291463834317768, 1.317048698347491, 1.354485054187984, 0.338534029291017, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33,1, 1,1,1,1,1,1},{0.6980, 0.4694, 0.5379, 0.5483, 0.4982, 0.4737, 0.4611, 0.5051, 0.5020, 0.4672, 0.4357, 0.3957, 0.4389, 0.4344, 0.3645, 0.3661, 0.3301, 0.2179, 0.1730, 0.2536, 0.2389,0.2884,0.2936,0.2226}};
-
-//real CE MIESM
-/*
-double beta1_dlsch_MI[6][MCS_COUNT] = { {1.32955, 0.59522, 0.54024, 0.98698, 0.81305, 0.76976, 0.69258, 0.69713, 0.70546, 0.69111, 0.81904, 0.72664, 0.79491, 0.72562, 0.53980, 0.33134, 0.50550, 0.40602,0.40281,0.47012,0.50510,0.23540,0.32045,1}, {0.59632, 1.08475, 1.02431, 1.07020, 0.90170, 0.97719, 0.95464, 0.92764, 0.86721, 0.85986, 0.64558, 0.80631, 0.82673, 0.82888, 0.87122, 0.77245, 0.29771, 0.43477, 0.55321, 0.61027, 0.56111, 0.57292, 0.39737,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, 1,1,1,1,1,1,1},{1.808065416202085, 1.754544945430673,1.902272019362616, 1.790054645392961, 1.563204092967629, 1.585258289348813, 1.579349443720310, 1.570650121437345, 1.545055626608596, 1.362229442426877, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33, 1,1,1,1,1,1,1},{0.77532, 1.07544, 1.10571, 1.04099, 0.91638, 0.88644, 0.96405, 0.86709, 0.94066, 0.84430, 1.24478, 1.09665, 1.42604, 0.79541, 0.71847, 0.71604, 0.74561, 0.36431, 0.41536, 0.52175, 0.47096, 0.49977, 0.59728,1}};
-double beta2_dlsch_MI[6][MCS_COUNT] = { {1.36875, 0.59304, 0.53870, 0.98239, 0.81637, 0.76847, 0.69842, 0.69885, 0.69967, 0.69826, 0.82660, 0.70559, 0.78404, 0.70670, 0.55393, 0.36893, 0.52225, 0.39752, 0.40494, 0.46239, 0.49247,0.26900,0.34504,1}, {0.43775, 0.78208, 0.72875, 0.77458, 0.64485, 0.69174, 0.66097, 0.63289, 0.59652, 0.61175, 0.44551, 0.56047, 0.57314, 0.57553, 0.58849, 0.52159, 0.21241, 0.30139, 0.37373, 0.32029, 0.37067, 0.36706, 0.27118,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, 1, 1,1,1,1,1,1},{1.079518113138858, 1.105622953570353, 1.031337449900606, 1.073342032668810, 1.242636589110353, 1.255054927783647, 1.291463834317768, 1.317048698347491, 1.354485054187984, 0.338534029291017, 1.85, 1.79, 1.65, 1.54, 1.46, 1.39, 1.33,1, 1,1,1,1,1,1},{0.54448, 0.73731, 0.79165, 0.74407, 0.68042, 0.64906, 0.71349, 0.62109, 0.65815, 0.60940, 0.90549, 0.78708, 1.03176, 0.58431, 0.53379, 0.51224, 0.52767, 0.26848, 0.29642, 0.36879, 0.34148, 0.35279,0.40633,1}};
-*/
-//ideal channel estimation values
-//double beta1_dlsch[6][MCS_COUNT] = { {2.3814, 0.4956, 0.5273, 1.1708, 0.8014, 0.7889, 0.8111, 0.8139, 0.8124, 0.8479, 1.9280, 1.9664, 2.3857, 2.5147, 2.4511, 3.0158, 2.8643, 5.3013, 5.8594, 6.5372, 7.8073, 7.8030, 7.5295, 7.1320}, {0.5146, 0.5549, 0.7405, 0.6913, 0.7349, 0.7000, 0.7539, 0.7955, 0.8074, 0.7760, 1.8150, 1.6561, 1.9280, 2.3563, 2.6699, 2.3086, 3.1601, 4.5316, 5.2870, 6.0983, 6.5635, 7.7024, 9.9592, 6.6173}, {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, 1,1,1,1,1,1}, {1.79358, 1.17908, 2.02600, 1.72040, 1.58618, 1.59039, 1.68111, 1.67062, 1.64911, 1.33274, 4.87800, 3.58797, 3.72338, 5.35700, 2.81752, 1.93472, 2.23259, 1,1,1,1,1,1,1}, {0.4445, 0.5918, 0.7118, 0.7115, 0.7284, 0.7202, 0.7117, 0.8111, 0.8239, 0.7907, 1.8456, 1.8144, 2.3830, 2.6634, 2.6129, 2.8127, 2.7372, 4.9424, 4.8763, 6.8413, 7.1493, 9.4180, 10.1230, 8.9613}};
-//double beta2_dlsch[6][MCS_COUNT] = { {2.3639, 0.4952, 0.5207, 1.1572, 0.8026, 0.7864, 0.7996, 0.8034, 0.8200, 0.8367, 1.8701, 1.9212, 2.2947, 2.4472, 2.4091, 2.9479, 2.8973, 5.0591, 5.5134, 6.1483, 7.2166, 7.5177, 7.5704, 7.2248}, {0.5113, 0.5600, 0.7359, 0.6860, 0.7344, 0.6902, 0.7315, 0.7660, 0.7817, 0.7315, 1.7268, 1.5912, 1.8519, 2.2115, 2.4580, 2.1879, 2.9015, 4.1543, 4.6986, 5.3193, 5.6319, 6.5640, 8.2421, 5.6393}, {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, 1,1,1,1,1,1}, {0.79479, 0.52872, 0.90005, 0.77170, 0.73220, 0.72060, 0.75433, 0.75451, 0.75989, 0.67655, 1.68525, 1.31100, 1.46573, 1.99843, 1.57293, 1.62852, 2.10636, 1,1,1,1,1,1,1}, {0.4398, 0.5823, 0.7094, 0.7043, 0.7282, 0.7041, 0.6979, 0.7762, 0.7871, 0.7469, 1.7752, 1.7443, 2.2266, 2.4767, 2.4146, 2.6040, 2.5708, 4.4488, 4.4944, 5.9630, 6.3740, 8.1097, 8.4210, 7.8027}};
-const double beta1_dlsch[6][MCS_COUNT] = { {1.199175, 1.085656, 0.983872, 0.843789, 0.816093, 0.853078, 0.899236, 0.919665, 0.888673, 0.924181, 0.814176, 0.794108, 0.770653, 0.826266, 0.982043, 0.979621, 0.985176, 0.901741, 0.870311, 0.911303, 0.898923, 1.003359, 0.988535, 1.030639, 1.151038, 1.116939, 1.214118, 1.219148}, {0.5146, 0.5549, 0.7405, 0.6913, 0.7349, 0.7000, 0.7539, 0.7955, 0.8074, 0.7760, 1.8150, 1.6561, 1.9280, 2.3563, 2.6699, 2.3086, 3.1601, 4.5316, 5.2870, 6.0983, 6.5635, 7.7024, 9.9592, 6.6173}, {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, 1,1,1,1,1,1}, {1.79358, 1.17908, 2.02600, 1.72040, 1.58618, 1.59039, 1.68111, 1.67062, 1.64911, 1.33274, 4.87800, 3.58797, 3.72338, 5.35700, 2.81752, 1.93472, 2.23259, 1,1,1,1,1,1,1}, {0.4445, 0.5918, 0.7118, 0.7115, 0.7284, 0.7202, 0.7117, 0.8111, 0.8239, 0.7907, 1.8456, 1.8144, 2.3830, 2.6634, 2.6129, 2.8127, 2.7372, 4.9424, 4.8763, 6.8413, 7.1493, 9.4180, 10.1230, 8.9613}};
-const double beta2_dlsch[6][MCS_COUNT] = { {0.534622, 0.596561, 0.500838, 0.471721, 0.548218, 0.547974, 0.924245, 0.836484, 0.776917, 0.879691, 0.875722, 0.666933, 0.666393, 0.755377, 1.074985, 1.080290, 1.010914, 0.790892, 0.793435, 0.860249, 0.901508, 0.967060, 0.951372, 1.011493, 1.106151, 1.117076, 1.209397, 1.227790}, {0.5113, 0.5600, 0.7359, 0.6860, 0.7344, 0.6902, 0.7315, 0.7660, 0.7817, 0.7315, 1.7268, 1.5912, 1.8519, 2.2115, 2.4580, 2.1879, 2.9015, 4.1543, 4.6986, 5.3193, 5.6319, 6.5640, 8.2421, 5.6393}, {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, 1,1,1,1,1,1}, {0.79479, 0.52872, 0.90005, 0.77170, 0.73220, 0.72060, 0.75433, 0.75451, 0.75989, 0.67655, 1.68525, 1.31100, 1.46573, 1.99843, 1.57293, 1.62852, 2.10636, 1,1,1,1,1,1,1}, {0.4398, 0.5823, 0.7094, 0.7043, 0.7282, 0.7041, 0.6979, 0.7762, 0.7871, 0.7469, 1.7752, 1.7443, 2.2266, 2.4767, 2.4146, 2.6040, 2.5708, 4.4488, 4.4944, 5.9630, 6.3740, 8.1097, 8.4210, 7.8027}};
-
-//real channel estimation valus
-/*
-double beta1_dlsch[6][MCS_COUNT] = { {2.50200, 0.84047, 0.78195, 1.37929, 1.16871, 1.11906, 1.06303, 1.07447, 1.11403, 1.09223, 2.82502, 2.87556, 3.51254, 3.62920, 3.53638, 2.35980, 3.74126, 8.66532, 7.31772, 9.86882, 10.64939, 6.75208, 9.50664, 13.63057}, {0.92257, 1, 1.80445, 1.43175, 1.42093, 1.37381, 1.45392, 1.47255, 1.47451, 1.41235, 3.9079, 3.38557, 4.13059, 4.93355, 4.97277, 6.04951, 5.88896, 8.68076, 10.23746, 12.37069, 5.50538, 17.29612, 17.95050, 13.27095}, {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, 1,1,1,1,1,1}, {1.79255, 1.88213, 4.44226, 2.25150, 1.93710, 2.18504, 2.57389, 1.94322, 1.78515, 2.09265, 2.37459, 1.74442, 1.74346, 1.19705, 1.56149, 1.59604, 1.6, 1,1,1,1,1,1,1}, {0.93374, 1.40389, 1.36670, 1.38679, 1.35707, 1.26353, 1.32360, 1.40164, 1.51843, 1.34863, 3.45839, 3.13726, 3.94768, 4.21966, 4.60750, 4.97894, 5.40755, 8.12814, 10.59221, 12.96427, 13.37323, 14.27206, 16.61779, 17.19656}};
-double beta2_dlsch[6][MCS_COUNT] = { {2.52163, 0.83231, 0.77472, 1.36536, 1.16829, 1.11186, 1.06287, 1.07292, 1.09946, 1.10650, 2.79174, 2.75655, 3.36651, 3.49011, 3.60903, 2.73517, 3.84009, 8.20312, 7.41739, 9.64081, 10.40911, 8.11765, 10.41923, 9.34300}, {0.67252, 0.8600, 1.28633, 1.01624, 1.03066, 0.97590, 1.02560, 1.01840, 1.00547, 0.97093, 2.72573, 2.33283, 2.86181, 3.40452, 3.47957, 4.08916, 3.97628, 6.14541, 7.11017, 8.42369, 4.04812, 11.42082, 11.57171, 9.28462}, {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, 1,1,1,1,1,1}, {0.85784, 0.90361, 2.09766, 1.08385, 0.96300, 1.04432, 1.22763, 0.99249, 0.95544, 1.12333, 1.37924, 1.12913, 1.30644, 1.19253, 1.75488, 2.13813, 2.10636, 1,1,1,1,1,1,1}, {0.66288, 0.96402, 0.98545, 0.99386, 0.99981, 0.92678, 0.98978, 0.99600, 1.05538, 0.97777, 2.52504, 2.29338, 2.89631, 3.10812, 3.41916, 3.58671, 3.84166, 6.05254, 7.45821, 9.15812, 9.66330, 10.17852, 11.50519, 11.16299}};
-
-*/
-
-const char NB_functions[7][20]={"eNodeB_3GPP","eNodeB_3GPP_BBU","NGFI_RAU_IF4p5","NGFI_RRU_IF5","NGFI_RRU_IF4p5","gNodeB_3GPP",};
-const char NB_timing[2][20]={"synch_to_ext_device","synch_to_other"};
-const char ru_if_types[MAX_RU_IF_TYPES][20]={"local RF","IF5 RRU","IF5 Mobipass","IF4p5 RRU","IF1pp RRU"};
-
-/// lookup table for unscrambling in RX
-int16_t unscrambling_lut[65536*16] __attribute__((aligned(32)));
-/// lookup table for scrambling in TX
-uint8_t scrambling_lut[65536*16] __attribute__((aligned(32)));
-
 uint8_t max_turbo_iterations=4;
+
 #endif /* __PHY_VARS_UE__H__ */
diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c
index 7cff63b4bbf..47ab3c7a91c 100644
--- a/openair1/SCHED_UE/phy_procedures_lte_ue.c
+++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c
@@ -68,7 +68,7 @@
 
 #define NS_PER_SLOT 500000
 
-char mode_string[4][20] = {"NOT SYNCHED","PRACH","RAR","PUSCH"};
+static const char mode_string[4][20] = {"NOT SYNCHED","PRACH","RAR","PUSCH"};
 
 extern double cpuf;
 
diff --git a/openair1/SCHED_UE/pusch_pc.c b/openair1/SCHED_UE/pusch_pc.c
index 55c8c7c547c..831007c1388 100644
--- a/openair1/SCHED_UE/pusch_pc.c
+++ b/openair1/SCHED_UE/pusch_pc.c
@@ -35,6 +35,7 @@
 #include "PHY/defs_UE.h"
 #include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
 #include "PHY/phy_extern_ue.h"
+#include "PHY/phy_extern.h"
 #include "PHY/LTE_ESTIMATION/lte_estimation.h"
 #include "nfapi/oai_integration/vendor_ext.h"
 
@@ -62,8 +63,6 @@ int16_t get_hundred_times_delta_IF(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t harq_p
 
 
 
-uint8_t alpha_lut[8] = {0,40,50,60,70,80,90,100};
-
 void pusch_power_cntl(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t j, uint8_t abstraction_flag) {
   uint8_t harq_pid = subframe2harq_pid(&ue->frame_parms,
                                        proc->frame_tx,
diff --git a/openair1/SCHED_UE/srs_pc.c b/openair1/SCHED_UE/srs_pc.c
index 8026eb83079..ad3cde7609c 100644
--- a/openair1/SCHED_UE/srs_pc.c
+++ b/openair1/SCHED_UE/srs_pc.c
@@ -33,6 +33,7 @@
 #include "PHY/defs_UE.h"
 #include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
 #include "PHY/phy_extern_ue.h"
+#include "PHY/phy_extern.h"
 #include "PHY/LTE_ESTIMATION/lte_estimation.h"
 #include "openair1/SCHED/sched_common_extern.h"
 
diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c
index 05e42735771..dc83ce57bf5 100644
--- a/openair1/SIMULATION/LTE_PHY/ulsim.c
+++ b/openair1/SIMULATION/LTE_PHY/ulsim.c
@@ -54,6 +54,7 @@
 #include "executables/lte-softmodem.h"
 #include "common/ran_context.h"
 #include "PHY/LTE_ESTIMATION/lte_estimation.h"
+#include "openair1/PHY/LTE_TRANSPORT/dlsch_tbs.h"
 
 const char *__asan_default_options()
 {
@@ -69,10 +70,8 @@ channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX];
 channel_desc_t *UE2eNB[NUMBER_OF_UE_MAX][NUMBER_OF_eNB_MAX];
 node_desc_t *enb_data[NUMBER_OF_eNB_MAX];
 node_desc_t *ue_data[NUMBER_OF_UE_MAX];
-//double sinr_bler_map[MCS_COUNT][2][16];
 
 extern uint16_t beta_ack[16],beta_ri[16],beta_cqi[16];
-//extern  char* namepointer_chMag ;
 THREAD_STRUCT thread_struct;
 nfapi_ue_release_request_body_t release_rntis;
 
@@ -1005,14 +1004,11 @@ int main(int argc, char **argv) {
           if (abstx) {
             if (trials==0 && round==0 && SNR==snr0) { //generate a new channel
               hold_channel = 0;
-              flagMag=0;
             } else {
               hold_channel = 1;
-              flagMag = 1;
             }
           } else {
             hold_channel = 0;
-            flagMag=1;
           }
 
           ///////////////////////////////////////
diff --git a/openair2/LAYER2/MAC/mac.h b/openair2/LAYER2/MAC/mac.h
index c958d7cf859..c1f9a51335e 100644
--- a/openair2/LAYER2/MAC/mac.h
+++ b/openair2/LAYER2/MAC/mac.h
@@ -162,6 +162,8 @@
 
 #define U_PLANE_INACTIVITY_VALUE 0   /* defined 10ms order (zero means infinity) */
 
+static const int cqi_to_mcs[16]= {0, 0, 1, 2, 4, 6, 8, 11, 13, 16, 18, 20, 23, 25, 27, 28};
+
 /*
  * eNB part
  */
-- 
GitLab