From da62b92f6edf07d2b737b6e185d8bae674d284ba Mon Sep 17 00:00:00 2001
From: "NCTU OpinConnect Terng-Yin Hsu/WEI-YING,LIN" <tyhsu@cs.nctu.edu.tw>
Date: Wed, 13 May 2020 22:24:40 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/develop' into
 NCTU_OpinConnect_LDPC

---
 ci-scripts/rrc-files/rbconfig.raw             |  Bin 0 -> 8 bytes
 ci-scripts/rrc-files/reconfig.raw             |  Bin 0 -> 479 bytes
 common/utils/nr/nr_common.c                   |  150 ++
 common/utils/nr/nr_common.h                   |   65 +
 executables/uecap.raw                         |  Bin 0 -> 2056 bytes
 openair1/PHY/CODING/DOC/LDPCImplementation.md |   26 +
 .../nrLDPC_decoder/nrLDPCdecoder_defs.h       |  201 ++
 openair1/PHY/CODING/nrLDPC_defs.h             |   59 +
 .../nrLDPC_encoder/ldpc_encode_parity_check.c |  201 ++
 .../nrLDPC_encoder/ldpc_encoder_optim.c       |  146 ++
 .../nrLDPC_encoder/ldpc_encoder_optim8seg.c   |  225 ++
 .../ldpc_encoder_optim8segmulti.c             |  237 ++
 openair1/PHY/CODING/nrLDPC_extern.h           |   35 +
 openair1/PHY/CODING/nrLDPC_load.c             |   76 +
 openair1/PHY/NR_REFSIG/ptrs_nr.c              |  423 ++++
 openair1/PHY/NR_REFSIG/ptrs_nr.h              |   81 +
 .../PHY/NR_TRANSPORT/nr_dci_tools_common.c    |   62 +
 openair1/PHY/NR_TRANSPORT/nr_prach.c          |  650 +++++
 openair1/PHY/NR_TRANSPORT/nr_prach.h          |  891 +++++++
 openair1/PHY/NR_TRANSPORT/nr_prach_common.c   |  370 +++
 .../NR_TRANSPORT/nr_transport_proto_common.h  | 1760 ++++++++++++++
 openair1/SCHED_NR/nr_prach_procedures.c       |  141 ++
 openair1/SCHED_NR/phy_frame_config_nr.c       |  435 ++++
 openair1/SIMULATION/NR_PHY/prachsim.c         |  666 ++++++
 openair1/SIMULATION/NR_PHY/reconfig.raw       |  Bin 0 -> 479 bytes
 .../NR_MAC_UE/nr_ue_dci_configuration.c       |  183 ++
 .../LAYER2/NR_MAC_gNB/nr_compute_tbs_common.c |  153 ++
 openair2/LAYER2/NR_MAC_gNB/nr_mac_common.h    |   70 +
 openair2/RRC/LTE/rrc_eNB_endc.c               |  243 ++
 openair2/RRC/NR/rrc_gNB_UE_context.c          |  223 ++
 openair2/RRC/NR/rrc_gNB_UE_context.h          |   80 +
 openair2/RRC/NR/rrc_gNB_internode.c           |  127 +
 openair2/RRC/NR/rrc_gNB_nsa.c                 |  159 ++
 openair2/RRC/NR/rrc_gNB_reconfig.c            | 2085 +++++++++++++++++
 .../CONF/enb.band7.master.conf                |  298 +++
 .../CONF/gnb.band257.tm1.32PRB.usrpx300.conf  |  271 +++
 .../CONF/gnb.band257.tm1.66PRB.usrpn300.conf  |  270 +++
 .../CONF/gnb.band261.tm1.32PRB.usrpn300.conf  |  271 +++
 .../gnb.band78.106PRB.30kHz,usrpb2x0.conf     |  283 +++
 .../CONF/gnb.band78.slave.conf                |  284 +++
 40 files changed, 11900 insertions(+)
 create mode 100644 ci-scripts/rrc-files/rbconfig.raw
 create mode 100644 ci-scripts/rrc-files/reconfig.raw
 create mode 100644 common/utils/nr/nr_common.c
 create mode 100644 common/utils/nr/nr_common.h
 create mode 100644 executables/uecap.raw
 create mode 100644 openair1/PHY/CODING/DOC/LDPCImplementation.md
 create mode 100644 openair1/PHY/CODING/nrLDPC_decoder/nrLDPCdecoder_defs.h
 create mode 100644 openair1/PHY/CODING/nrLDPC_defs.h
 create mode 100644 openair1/PHY/CODING/nrLDPC_encoder/ldpc_encode_parity_check.c
 create mode 100644 openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim.c
 create mode 100644 openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim8seg.c
 create mode 100644 openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim8segmulti.c
 create mode 100644 openair1/PHY/CODING/nrLDPC_extern.h
 create mode 100644 openair1/PHY/CODING/nrLDPC_load.c
 create mode 100644 openair1/PHY/NR_REFSIG/ptrs_nr.c
 create mode 100644 openair1/PHY/NR_REFSIG/ptrs_nr.h
 create mode 100644 openair1/PHY/NR_TRANSPORT/nr_dci_tools_common.c
 create mode 100644 openair1/PHY/NR_TRANSPORT/nr_prach.c
 create mode 100644 openair1/PHY/NR_TRANSPORT/nr_prach.h
 create mode 100644 openair1/PHY/NR_TRANSPORT/nr_prach_common.c
 create mode 100644 openair1/PHY/NR_TRANSPORT/nr_transport_proto_common.h
 create mode 100644 openair1/SCHED_NR/nr_prach_procedures.c
 create mode 100644 openair1/SCHED_NR/phy_frame_config_nr.c
 create mode 100644 openair1/SIMULATION/NR_PHY/prachsim.c
 create mode 100644 openair1/SIMULATION/NR_PHY/reconfig.raw
 create mode 100644 openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c
 create mode 100644 openair2/LAYER2/NR_MAC_gNB/nr_compute_tbs_common.c
 create mode 100644 openair2/LAYER2/NR_MAC_gNB/nr_mac_common.h
 create mode 100644 openair2/RRC/LTE/rrc_eNB_endc.c
 create mode 100644 openair2/RRC/NR/rrc_gNB_UE_context.c
 create mode 100644 openair2/RRC/NR/rrc_gNB_UE_context.h
 create mode 100644 openair2/RRC/NR/rrc_gNB_internode.c
 create mode 100644 openair2/RRC/NR/rrc_gNB_nsa.c
 create mode 100644 openair2/RRC/NR/rrc_gNB_reconfig.c
 create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.master.conf
 create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf
 create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.66PRB.usrpn300.conf
 create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf
 create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.30kHz,usrpb2x0.conf
 create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.slave.conf

diff --git a/ci-scripts/rrc-files/rbconfig.raw b/ci-scripts/rrc-files/rbconfig.raw
new file mode 100644
index 0000000000000000000000000000000000000000..b03f18d1219201d789d1c70e1dced3e84a932990
GIT binary patch
literal 8
PcmWgP)DUkvz{3Cl2C4z8

literal 0
HcmV?d00001

diff --git a/ci-scripts/rrc-files/reconfig.raw b/ci-scripts/rrc-files/reconfig.raw
new file mode 100644
index 0000000000000000000000000000000000000000..97b41d9b6b0f0662487ca39848f85e9c1f7f8594
GIT binary patch
literal 479
zcmZvXK}Zx)0EYiJZ+7;%j_XKUh%ENXDK?21#KRUHp2H>+lyvMMF*~+WLFgem)aA{%
zl66`(S%faD6@&yyL3n&?+qPmv2;D@MEa;eCx>&Z|yM5p7`&hU&j$JjxrW$?heDiE#
zrp~RxosN$_z1U>h&8!6U&Bpv>RXxWN$<f>Vq{N}IvEipfZ!CNn4gOq0Wp{R}^Kf<?
zi^^fHx=ZZ*z~#5#+1O)Jfbgi&rR?Co?qx_hiDFTnI_8_+4O;Fex(e-Dm|F|4zYB}?
z@Y(yY-Uz>a2pe-7*}_6@%Q6AZjd^V@W_3Ne!j2yN1Yorg8CJ&MSq*vtF|z9Rf}kw9
zO<I}|C^?#)!g?I8D^jHu!yYE<-H3cq_SI5eyw0n&Kx_u;>x9^wP&>JogICi$s@0-2
zPoAI>dgr#}5FkI0;q=V(#{Xt(%cWbI-oqTJ2GB)JI7a5$XTEsf?jL>hsog_<GuP4x
zDsjeFru_$uJ`^nw?N^n-0`4Kfh|-PY%P(M&C@o@xvq!Y{9g>Mw{JWI@5GhC+Q#8h*
qJUD$YnWS13stM;DOiNO|EftB=CGW!CtAm++osPf`dKT!uA^!qOo0Vh$

literal 0
HcmV?d00001

diff --git a/common/utils/nr/nr_common.c b/common/utils/nr/nr_common.c
new file mode 100644
index 00000000000..8a236c49f99
--- /dev/null
+++ b/common/utils/nr/nr_common.c
@@ -0,0 +1,150 @@
+/*
+ * 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 config_ue.c
+ * \brief common utility functions for NR (gNB and UE)
+ * \author R. Knopp,
+ * \date 2019
+ * \version 0.1
+ * \company Eurecom
+ * \email: knopp@eurecom.fr
+ * \note
+ * \warning
+ */
+
+#include <stdint.h>
+#include "assertions.h"
+
+int NRRIV2BW(int locationAndBandwidth,int N_RB) {
+  int tmp = locationAndBandwidth/N_RB;
+  int tmp2 = locationAndBandwidth%N_RB;
+
+
+  if (tmp <= ((N_RB>>1)+1) && (tmp+tmp2)<N_RB) return(tmp+1);
+  else                      return(N_RB+1-tmp);
+
+}
+
+int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB) {
+  int tmp = locationAndBandwidth/N_RB;
+  int tmp2 = locationAndBandwidth%N_RB;
+
+
+  if (tmp <= ((N_RB>>1)+1) && (tmp+tmp2)<N_RB) return(tmp2);
+  else                      return(N_RB-1-tmp2);
+}
+
+int PRBalloc_to_locationandbandwidth0(int NPRB,int RBstart,int BWPsize) {
+  AssertFatal(NPRB>0 && (NPRB + RBstart <= BWPsize),"Illegal NPRB/RBstart Configuration (%d,%d) for BWPsize %d\n",NPRB,RBstart,BWPsize);
+
+  if (NPRB <= 1+(BWPsize>>1)) return(BWPsize*(NPRB-1)+RBstart);
+  else                        return(BWPsize*(BWPsize+1-NPRB) + (BWPsize-1-RBstart));
+}
+
+int PRBalloc_to_locationandbandwidth(int NPRB,int RBstart) {
+  return(PRBalloc_to_locationandbandwidth0(NPRB,RBstart,275));
+}
+/// Target code rate tables indexed by Imcs
+uint16_t nr_target_code_rate_table1[29] = {120, 157, 193, 251, 308, 379, 449, 526, 602, 679, 340, 378, 434, 490, 553, \
+                                            616, 658, 438, 466, 517, 567, 616, 666, 719, 772, 822, 873, 910, 948};
+  // Imcs values 20 and 26 have been multiplied by 2 to avoid the floating point
+uint16_t nr_target_code_rate_table2[28] = {120, 193, 308, 449, 602, 378, 434, 490, 553, 616, 658, 466, 517, 567, \
+                                            616, 666, 719, 772, 822, 873, 1365, 711, 754, 797, 841, 885, 1833, 948};
+uint16_t nr_target_code_rate_table3[29] = {30, 40, 50, 64, 78, 99, 120, 157, 193, 251, 308, 379, 449, 526, 602, 340, \
+                                            378, 434, 490, 553, 616, 438, 466, 517, 567, 616, 666, 719, 772};
+uint16_t nr_tbs_table[93] = {24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 160, 168, 176, 184, 192, 208, 224, 240, 256, 272, 288, 304, 320, \
+                              336, 352, 368, 384, 408, 432, 456, 480, 504, 528, 552, 576, 608, 640, 672, 704, 736, 768, 808, 848, 888, 928, 984, 1032, 1064, 1128, 1160, 1192, 1224, 1256, \
+                              1288, 1320, 1352, 1416, 1480, 1544, 1608, 1672, 1736, 1800, 1864, 1928, 2024, 2088, 2152, 2216, 2280, 2408, 2472, 2536, 2600, 2664, 2728, 2792, 2856, 2976, \
+                              3104, 3240, 3368, 3496, 3624, 3752, 3824};
+
+uint8_t nr_get_Qm(uint8_t Imcs, uint8_t table_idx) {
+  switch(table_idx) {
+    case 1:
+      return (((Imcs<10)||(Imcs==29))?2:((Imcs<17)||(Imcs==30))?4:((Imcs<29)||(Imcs==31))?6:-1);
+    break;
+
+    case 2:
+      return (((Imcs<5)||(Imcs==28))?2:((Imcs<11)||(Imcs==29))?4:((Imcs<20)||(Imcs==30))?6:((Imcs<28)||(Imcs==31))?8:-1);
+    break;
+
+    case 3:
+      return (((Imcs<15)||(Imcs==29))?2:((Imcs<21)||(Imcs==30))?4:((Imcs<29)||(Imcs==31))?6:-1);
+    break;
+
+    default:
+      AssertFatal(0, "Invalid MCS table index %d (expected in range [1,3])\n", table_idx);
+      return(0);
+      break;
+  }
+}
+
+uint32_t nr_get_code_rate(uint8_t Imcs, uint8_t table_idx) {
+  switch(table_idx) {
+    case 1:
+      return (nr_target_code_rate_table1[Imcs]);
+    break;
+
+    case 2:
+      return (nr_target_code_rate_table2[Imcs]);
+    break;
+
+    case 3:
+      return (nr_target_code_rate_table3[Imcs]);
+    break;
+
+    default:
+      AssertFatal(0, "Invalid MCS table index %d (expected in range [1,3])\n", table_idx);
+      return(0);
+      break;
+  }
+}
+
+int get_subband_size(int NPRB,int size) {
+  // implements table  5.2.1.4-2 from 36.214
+  //
+  //Bandwidth part (PRBs)	Subband size (PRBs)
+  // < 24	                   N/A
+  //24 – 72	                   4, 8
+  //73 – 144	                   8, 16
+  //145 – 275	                  16, 32
+
+  if (NPRB<24) return(1);
+  if (NPRB<72) return (size==0 ? 4 : 8);
+  if (NPRB<144) return (size==0 ? 8 : 16);
+  if (NPRB<275) return (size==0 ? 16 : 32);
+  AssertFatal(1==0,"Shouldn't get here, NPRB %d\n",NPRB);
+ 
+}
+
+void SLIV2SL(int SLIV,int *S,int *L) {
+
+  int SLIVdiv14 = SLIV/14;
+  int SLIVmod14 = SLIV%14;
+  // Either SLIV = 14*(L-1) + S, or SLIV = 14*(14-L+1) + (14-1-S). Condition is 0 <= L <= 14-S
+  if ((SLIVdiv14 + 1) >= 0 && (SLIVdiv14 <= 13-SLIVmod14)) {
+    *L=SLIVdiv14+1;
+    *S=SLIVmod14;
+  } else  {
+    *L=15-SLIVdiv14;
+    *S=13-SLIVmod14;
+  }
+
+}
diff --git a/common/utils/nr/nr_common.h b/common/utils/nr/nr_common.h
new file mode 100644
index 00000000000..979cf863436
--- /dev/null
+++ b/common/utils/nr/nr_common.h
@@ -0,0 +1,65 @@
+/*
+ * 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 config_ue.c
+ * \brief common utility functions for NR (gNB and UE)
+ * \author R. Knopp,
+ * \date 2019
+ * \version 0.1
+ * \company Eurecom
+ * \email: knopp@eurecom.fr
+ * \note
+ * \warning
+ */
+
+#include <stdint.h>
+#include "assertions.h"
+
+int NRRIV2BW(int locationAndBandwidth,int N_RB);
+int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB);
+int PRBalloc_to_locationandbandwidth0(int NPRB,int RBstart,int BWPsize);
+int PRBalloc_to_locationandbandwidth(int NPRB,int RBstart);
+extern uint16_t nr_target_code_rate_table1[29];
+extern uint16_t nr_target_code_rate_table2[28];
+extern uint16_t nr_target_code_rate_table3[29];
+extern uint16_t nr_tbs_table[93];
+uint8_t nr_get_Qm(uint8_t Imcs, uint8_t table_idx);
+uint32_t nr_get_code_rate(uint8_t Imcs, uint8_t table_idx);
+int get_subband_size(int NPRB,int size);
+void SLIV2SL(int SLIV,int *S,int *L);
+
+
+#define CEILIDIV(a,b) ((a+b-1)/b)
+#define ROUNDIDIV(a,b) (((a<<1)+b)/(b<<1))
+
+#define cmax(a,b)  ((a>b) ? (a) : (b))
+#define cmax3(a,b,c) ((cmax(a,b)>c) ? (cmax(a,b)) : (c))
+#define cmin(a,b)  ((a<b) ? (a) : (b))
+
+#ifdef __cplusplus
+#ifdef min
+#undef min
+#undef max
+#endif
+#else
+#define max(a,b) cmax(a,b)
+#define min(a,b) cmin(a,b)
+#endif
diff --git a/executables/uecap.raw b/executables/uecap.raw
new file mode 100644
index 0000000000000000000000000000000000000000..01c03d225a6a4662fe1994789783bea391d3c6aa
GIT binary patch
literal 2056
zcmeHIU1%It6#nM!P4@0~Vs5rUhjnf4)~G>ICy)mTYG*c}u|$m+F;8~WAO<ax)>87I
z?PQqlOCpW+r;%3JRS5Jc6eNf!PGYr1iirA9@S&#Ew;~$_L9Dr+xw{M279XV#9+sJJ
z&N<(A&pCJJ&R|N+y#7P*)NEjJTkV|`UA-f#Z@$o3+xhO`;pKDVTI;v<<wIJ3rGML@
z^-qWX=+XL@&;C53_3yhj&uD#RSx;)c`K&%gsrTsfbp0;~7k<^t@7tI^{Gfb(aO_x5
zJhcfj#y<@Jk-3oIpJN+U4vuO&hLtVbMT%RYTovWWEjh+9#ET(TQ4U<sI2<NFN69IR
zA=?rYLD6=3v4Y5rWkoW_6B8&#_y<gcuI9Cpd@;d`5m8IdRnV+ov}Fa?=!sTE{KMDA
z_G|<0o1KSHWia6=1nm-PwgQ3OU~qmU$2gR=NRBCT<dcjAax9T!4>@j49Ot3%k;E>6
z>42e7MVNLe=WCMPPqG~~bk^aeM<BaGarZ>Zf%MOS^KzJd!21$h?hULqp~87NO@ER?
z8NMgf2fP6I2}!bq1R|}0cO%S7KPJ+F*s_SUB3&Zg=E5rpbuzLQkqSf#Mc;Z#Kn{Ip
zR*G_?OuT5;9u0TG?-)_H^Mb--o+zG-sFWx-4U0cSI**7xzYVIgB>PQWRW83@V{UWx
z{Gv%nQ$3}Ybm?i~#2^U*Vl^$0YlUPhlmHWIv4U2}0171y8o{I4#bhcA8`PkqYDvp^
zGpBA926E`prVjNpwQdrUL2aR)yOPml3ThIp0ZfPf76-Y}FbhB9^sZCLfSMUEg`^or
z#!(caxe%!F6N#V+ndBtY01Z~!;Up;fR_~(u`c!JSI+~^VSbU*B@O$q~_9D|~@jKkv
z2n`T4#%n^N6>5MWlF8%?O44357dP7;4%4>NEIkrFzH%d-4L9I%^?ynK{@GYL031Bs
z@m>J_>Sf?#I=<(=xVSMxwr`uU9Y@w0Ai3Uu%iKb}Uf-Dc<hkUrVTHM%b3YNUYn)4N
z!Mo;?f(;jO^Twe5_LKa&?j*%X(E-~`Z#+IMn3q1cJRsOR^g57T`S#dMwFko6YMY|6
zwShMnL))b&cQIfu#WANhOM2)#OW&*jZR6{dW<7Z@#pvb@r`vDZZi8(t%U3R`Izq2s
zqB?%OT6}9j%%=Sck4s~|MJK!{6t<_%c0%RZ%Xik1Nfz6;6d(YzUF4r}ccUvFzS*`;
Xe?t+Er@Y54?)gugpbm&1NQS=v9x-kl

literal 0
HcmV?d00001

diff --git a/openair1/PHY/CODING/DOC/LDPCImplementation.md b/openair1/PHY/CODING/DOC/LDPCImplementation.md
new file mode 100644
index 00000000000..89ae6b4dbb6
--- /dev/null
+++ b/openair1/PHY/CODING/DOC/LDPCImplementation.md
@@ -0,0 +1,26 @@
+#LDPC coder/decoder implementation
+The LDPC coder and decoder are implemented in a shared library, dynamically loaded at run-time using the [oai shared library loader](file://../../../../common/utils/DOC/loader.md). The code loading the LDPC library is in [nrLDPC_load.c](file://../nrLDPC_load.c), in function `load_nrLDPClib`, which must be called at init time.
+
+## Selecting the LDPC library at run time
+
+By default the function `int load_nrLDPClib(void)` looks for `libldpc.so`, this default behavior can be changed using the oai loader configuration options in the configuration file or from the command line as shown below:
+
+>loading `libldpc_optim8seg.so` instead of `libldpc.so`
+
+```
+./nr-softmodem -O libconfig:gnb.band78.tm1.106PRB.usrpx300.conf:dbgl5  --loader.ldpc.shlibversion _optim8seg
+.......................
+[CONFIG] loader.ldpc.shlibversion set to default value ""
+[LIBCONFIG] loader.ldpc: 2/2 parameters successfully set, (1 to default value)
+[CONFIG] shlibversion set to  _optim8seg from command line
+[CONFIG] loader.ldpc 1 options set from command line
+[LOADER] library libldpc_optim8seg.so successfully loaded
+........................
+```
+
+Today, this mechanism is not available in the `ldpctest` phy simulator which doesn't initialize the [configuration module](file://../../../../common/config/DOC/config.md). loads `libldpc.so` and `libldpc_orig.so` to compare the performance of the two implementations.
+
+###LDPC libraries
+Libraries implementing the LDPC algorithms must be named `libldpc<_version>.so`, they must implement two functions: `nrLDPC_decod` and `nrLDPC_encod`. The prototypes for these functions is defined in [nrLDPC_defs.h](file://nrLDPC_defs.h).
+
+[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPCdecoder_defs.h b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPCdecoder_defs.h
new file mode 100644
index 00000000000..c35f93e0fe7
--- /dev/null
+++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPCdecoder_defs.h
@@ -0,0 +1,201 @@
+/*
+ * 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 nrLDPCdecoder_defs.h
+ * \brief Defines all constants and buffers for the LDPC decoder
+ * \author Sebastian Wagner (TCL Communications) Email: <mailto:sebastian.wagner@tcl.com>
+ * \date 27-03-2018
+ * \version 1.0
+ * \note
+ * \warning
+ */
+
+#ifndef __NR_LDPC_DEFS__H__
+#define __NR_LDPC_DEFS__H__
+
+// ==============================================================================
+// DEFINES
+
+/** Maximum lifting size */
+#define NR_LDPC_ZMAX 384
+
+/** Number of columns in BG1 */
+#define NR_LDPC_NCOL_BG1 68
+/** Number of rows in BG1 */
+#define NR_LDPC_NROW_BG1 46
+/** Number of edges/entries in BG1 */
+#define NR_LDPC_NUM_EDGE_BG1 316
+/** Number of check node (CN) groups in BG1
+ A CN group is defined by its number of connected bit nodes. */
+#define NR_LDPC_NUM_CN_GROUPS_BG1 9
+/** First column in BG1 that is connected to only a single CN */
+#define NR_LDPC_START_COL_PARITY_BG1 26
+
+/** Number of columns in BG1 for rate 1/3 = 22/(68-2) */
+#define NR_LDPC_NCOL_BG1_R13 NR_LDPC_NCOL_BG1
+/** Number of columns in BG1 for rate 2/3 = 22/(35-2) */
+#define NR_LDPC_NCOL_BG1_R23 35
+/** Number of columns in BG1 for rate 8/9 ~ 22/(27-2) */
+#define NR_LDPC_NCOL_BG1_R89 27
+
+/** Number of bit node (BN) groups in BG1 for rate 1/3
+ A BN group is defined by its number of connected CNs. */
+#define NR_LDPC_NUM_BN_GROUPS_BG1_R13 30
+/** Number of bit node (BN) groups in BG1 for rate 2/3 */
+#define NR_LDPC_NUM_BN_GROUPS_BG1_R23 8
+/** Number of bit node (BN) groups in BG1 for rate 8/9 */
+#define NR_LDPC_NUM_BN_GROUPS_BG1_R89 5
+
+/** Number of columns in BG2 */
+#define NR_LDPC_NCOL_BG2 52
+/** Number of rows in BG2 */
+#define NR_LDPC_NROW_BG2 42
+/** Number of edges/entries in BG2 */
+#define NR_LDPC_NUM_EDGE_BG2 197
+/** Number of check node (CN) groups in BG2
+ A CN group is defined by its number of connected bit nodes. */
+#define NR_LDPC_NUM_CN_GROUPS_BG2 6
+/** First column in BG2 that is connected to only a single CN */
+#define NR_LDPC_START_COL_PARITY_BG2 14
+
+/** Number of columns in BG2 for rate 1/5 = 10/(52-2) */
+#define NR_LDPC_NCOL_BG2_R15 NR_LDPC_NCOL_BG2
+/** Number of columns in BG2 for rate 1/3 = 10/(32-2) */
+#define NR_LDPC_NCOL_BG2_R13 32
+/** Number of columns in BG2 for rate 2/3 = 10/(17-2) */
+#define NR_LDPC_NCOL_BG2_R23 17
+
+/** Number of bit node (BN) groups in BG2 for rate 1/5
+ A BN group is defined by its number of connected CNs. */
+#define NR_LDPC_NUM_BN_GROUPS_BG2_R15 23
+/** Number of bit node (BN) groups in BG2 for rate 1/3 */
+#define NR_LDPC_NUM_BN_GROUPS_BG2_R13 10
+/** Number of bit node (BN) groups in BG2 for rate 2/3 */
+#define NR_LDPC_NUM_BN_GROUPS_BG2_R23  6
+
+/** Worst case size of the CN processing buffer */
+#define NR_LDPC_SIZE_CN_PROC_BUF NR_LDPC_NUM_EDGE_BG1*NR_LDPC_ZMAX
+/** Worst case size of the BN processing buffer */
+#define NR_LDPC_SIZE_BN_PROC_BUF NR_LDPC_NUM_EDGE_BG1*NR_LDPC_ZMAX
+
+/** Maximum number of possible input LLR = NR_LDPC_NCOL_BG1*NR_LDPC_ZMAX */
+#define NR_LDPC_MAX_NUM_LLR 27000
+
+// ==============================================================================
+// GLOBAL CONSTANT VARIABLES
+
+/** Start addresses for the cnProcBuf for each CN group in BG1*/
+static const uint32_t lut_startAddrCnGroups_BG1[NR_LDPC_NUM_CN_GROUPS_BG1] = {0, 1152, 8832, 43392, 61824, 75264, 81408, 88320, 92160};
+/** Start addresses for the cnProcBuf for each CN group in BG2*/
+static const uint32_t lut_startAddrCnGroups_BG2[NR_LDPC_NUM_CN_GROUPS_BG2] = {0, 6912, 37632, 54912, 61824, 67968};
+
+/** Number of BNs of CN group for BG1.
+  E.g. 10 means that there is a CN group where every CN is connected to 10 BNs */
+static const uint8_t lut_numBnInCnGroups_BG1_R13[NR_LDPC_NUM_CN_GROUPS_BG1] = {3, 4,  5, 6, 7, 8, 9, 10, 19};
+/** Number of rows/CNs in every CN group for rate = 1/3 BG1, e.g. 5 rows of CNs connected to 4 BNs */
+static const uint8_t lut_numCnInCnGroups_BG1_R13[NR_LDPC_NUM_CN_GROUPS_BG1] = {1, 5, 18, 8, 5, 2, 2,  1,  4};
+/** Number of rows/CNs in every CN group for rate = 2/3 BG1, e.g. 3 rows of CNs connected to 7 BNs */
+static const uint8_t lut_numCnInCnGroups_BG1_R23[NR_LDPC_NUM_CN_GROUPS_BG1] = {1, 0,  0, 0, 3, 2, 2,  1,  4};
+/** Number of rows/CNs in every CN group for rate = 8/9 BG1, e.g. 4 rows of CNs connected to 19 BNs */
+static const uint8_t lut_numCnInCnGroups_BG1_R89[NR_LDPC_NUM_CN_GROUPS_BG1] = {1, 0,  0, 0, 0, 0, 0,  0,  4};
+
+/** Number of connected BNs for every column in BG1 rate = 1/3, e.g. in first column all BNs are connected to 30 CNs */
+static const uint8_t lut_numEdgesPerBn_BG1_R13[NR_LDPC_START_COL_PARITY_BG1] = {30, 28, 7, 11, 9, 4, 8, 12, 8, 7, 12, 10, 12, 11, 10, 7, 10, 10, 13, 7, 8, 11, 12, 5, 6, 6};
+/** Number of connected BNs for every column in BG1 rate = 2/3, e.g. in first column all BNs are connected to 12 CNs */
+static const uint8_t lut_numEdgesPerBn_BG1_R23[NR_LDPC_START_COL_PARITY_BG1] = {12, 11, 4,  5, 5, 3, 4,  5, 5, 3,  6,  6,  6,  6,  5, 3,  6,  5,  6, 4, 5,  6,  6, 3, 3, 2};
+/** Number of connected BNs for every column in BG1 rate = 8/9, e.g. in first column all BNs are connected to 5 CNs */
+static const uint8_t lut_numEdgesPerBn_BG1_R89[NR_LDPC_START_COL_PARITY_BG1] = {5,   4, 3,  3, 3, 3, 3,  3, 3, 3,  3,  3,  3,  3,  3, 3,  3,  3,  3, 3, 3,  3,  3, 2, 2, 2};
+
+/** Number of BNs of CN group for BG2.
+  E.g. 3 means that there is a CN group where every CN is connected to 3 BNs */
+static const uint8_t lut_numBnInCnGroups_BG2_R15[NR_LDPC_NUM_CN_GROUPS_BG2] = {3,  4, 5, 6, 8, 10};
+/** Number of rows/CNs in every CN group for rate = 1/5 BG2, e.g. 6 rows of CNs connected to 3 BNs */
+static const uint8_t lut_numCnInCnGroups_BG2_R15[NR_LDPC_NUM_CN_GROUPS_BG2] = {6, 20, 9, 3, 2, 2};
+/** Number of rows/CNs in every CN group for rate = 1/3 BG2, e.g. 8 rows of CNs connected to 4 BNs */
+static const uint8_t lut_numCnInCnGroups_BG2_R13[NR_LDPC_NUM_CN_GROUPS_BG2] = {0,  8, 7, 3, 2, 2};
+/** Number of rows/CNs in every CN group for rate = 2/3 BG2, e.g. 1 row of CNs connected to 4 BNs */
+static const uint8_t lut_numCnInCnGroups_BG2_R23[NR_LDPC_NUM_CN_GROUPS_BG2] = {0,  1, 0, 2, 2, 2};
+
+/** Number of connected BNs for every column in BG2 rate = 1/5, e.g. in first column all BNs are connected to 22 CNs */
+static const uint8_t lut_numEdgesPerBn_BG2_R15[NR_LDPC_START_COL_PARITY_BG2] = {22, 23, 10, 5, 5, 14, 7, 13, 6, 8, 9, 16, 9, 12};
+/** Number of connected BNs for every column in BG2 rate = 1/3, e.g. in first column all BNs are connected to 14 CNs */
+static const uint8_t lut_numEdgesPerBn_BG2_R13[NR_LDPC_START_COL_PARITY_BG2] = {14, 16,  2, 4, 4,  6, 6,  8, 6, 6, 6, 13, 5,  7};
+/** Number of connected BNs for every column in BG2 rate = 2/3, e.g. in first column all BNs are connected to 6 CNs */
+static const uint8_t lut_numEdgesPerBn_BG2_R23[NR_LDPC_START_COL_PARITY_BG2] = { 6,  5,  2, 3, 3,  4, 3,  4, 3, 4, 3,  5, 2,  2};
+
+// Number of groups for bit node processing
+/** Number of connected CNs for every column/BN in BG1 for rate = 1/3, Worst case is BG1 with up to 30 CNs connected to one BN
+  E.g. 42 parity BNs connected to single CN */
+                                                                            // BG1: 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
+static const uint8_t lut_numBnInBnGroups_BG1_R13[NR_LDPC_NUM_BN_GROUPS_BG1_R13] = {42, 0, 0, 1, 1, 2, 4, 3, 1, 4, 3, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1};
+/** Number of connected CNs for every column/BN in BG1 for rate = 2/3 */
+static const uint8_t lut_numBnInBnGroups_BG1_R23[NR_LDPC_NUM_BN_GROUPS_BG1_R13] = { 9, 1, 5, 3, 7, 8, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+/** Number of connected CNs for every column/BN in BG1 for rate = 8/9 */
+static const uint8_t lut_numBnInBnGroups_BG1_R89[NR_LDPC_NUM_BN_GROUPS_BG1_R13] = { 1, 3,21, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+/** Number of connected CNs for every column/BN in BG2 for rate = 1/5, Worst case is BG1 with up to 30 CNs connected to one BN
+  E.g. 38 parity BNs connected to single CN */
+                                                                            // BG2: 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
+static const uint8_t lut_numBnInBnGroups_BG2_R15[NR_LDPC_NUM_BN_GROUPS_BG1_R13] = {38, 0, 0, 0, 2, 1, 1, 1, 2, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0};
+/** Number of connected CNs for every column/BN in BG2 for rate = 1/3 */
+static const uint8_t lut_numBnInBnGroups_BG2_R13[NR_LDPC_NUM_BN_GROUPS_BG1_R13] = {18, 1, 0, 2, 1, 5, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+/** Number of connected CNs for every column/BN in BG2 for rate = 2/3 */
+static const uint8_t lut_numBnInBnGroups_BG2_R23[NR_LDPC_NUM_BN_GROUPS_BG1_R13] = { 3, 3, 5, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+// Start addresses for the bnProcBuf for each BN group
+// BG1
+/** Start address for every BN group within the BN processing buffer for BG1 rate = 1/3 */
+static const uint32_t lut_startAddrBnGroups_BG1_R13[NR_LDPC_NUM_BN_GROUPS_BG1_R13] = {0, 16128, 17664, 19584, 24192, 34944, 44160, 47616, 62976, 75648, 94080, 99072, 109824};
+/** Start address for every BN group within the BN processing buffer for BG1 rate = 2/3 */
+static const uint32_t lut_startAddrBnGroups_BG1_R23[NR_LDPC_NUM_BN_GROUPS_BG1_R23] = {0, 3456, 4224, 9984, 14592, 28032, 46464, 50688};
+/** Start address for every BN group within the BN processing buffer for BG1 rate = 8/9 */
+static const uint32_t lut_startAddrBnGroups_BG1_R89[NR_LDPC_NUM_BN_GROUPS_BG1_R89] = {0, 384, 2688, 26880, 28416};
+
+/** Start address for every BN group within the LLR processing buffer for BG1 rate = 1/3 */
+static const uint16_t lut_startAddrBnGroupsLlr_BG1_R13[NR_LDPC_NUM_BN_GROUPS_BG1_R13] = {0, 16128, 16512, 16896, 17664, 19200, 20352, 20736, 22272, 23424, 24960, 25344, 25728};
+/** Start address for every BN group within the LLR processing buffer for BG1 rate = 2/3 */
+static const uint16_t lut_startAddrBnGroupsLlr_BG1_R23[NR_LDPC_NUM_BN_GROUPS_BG1_R23] = {0, 3456, 3840, 5760, 6912, 9600, 12672, 13056};
+/** Start address for every BN group within the LLR processing buffer for BG1 rate = 8/9 */
+static const uint16_t lut_startAddrBnGroupsLlr_BG1_R89[NR_LDPC_NUM_BN_GROUPS_BG1_R89] = {0, 384, 1536, 9600, 9984};
+
+// BG2
+/** Start address for every BN group within the BN processing buffer for BG2 rate = 1/5 */
+static const uint32_t lut_startAddrBnGroups_BG2_R15[NR_LDPC_NUM_BN_GROUPS_BG2_R15] = {0, 14592, 18432, 20736, 23424, 26496, 33408, 37248, 41856, 46848, 52224, 58368, 66816};
+/** Start address for every BN group within the BN processing buffer for BG2 rate = 1/3 */
+static const uint32_t lut_startAddrBnGroups_BG2_R13[NR_LDPC_NUM_BN_GROUPS_BG2_R13] = {0, 6912, 7680, 10752, 12672, 24192, 26880, 29952, 34944, 40320};
+/** Start address for every BN group within the BN processing buffer for BG2 rate = 2/3 */
+static const uint32_t lut_startAddrBnGroups_BG2_R23[NR_LDPC_NUM_BN_GROUPS_BG2_R23] = {0, 1152, 3456, 9216, 13824, 17664};
+
+/** Start address for every BN group within the LLR processing buffer for BG2 rate = 1/5 */
+static const uint16_t lut_startAddrBnGroupsLlr_BG2_R15[NR_LDPC_NUM_BN_GROUPS_BG2_R15] = {0, 14592, 15360, 15744, 16128, 16512, 17280, 17664, 18048, 18432, 18816, 19200, 19584};
+/** Start address for every BN group within the LLR processing buffer for BG2 rate = 1/3 */
+static const uint16_t lut_startAddrBnGroupsLlr_BG2_R13[NR_LDPC_NUM_BN_GROUPS_BG2_R13] = {0, 6912, 7296, 8064, 8448, 10368, 10752, 11136, 11520, 11904};
+/** Start address for every BN group within the LLR processing buffer for BG2 rate = 2/3 */
+static const uint16_t lut_startAddrBnGroupsLlr_BG2_R23[NR_LDPC_NUM_BN_GROUPS_BG2_R23] = {0,  1152,  2304,  4224,  5376, 6144};
+
+/** Vector of 32 '1' in int8 for application with AVX2 */
+static const int8_t ones256_epi8[32] __attribute__ ((aligned(32))) = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
+/** Vector of 32 '0' in int8 for application with AVX2 */
+static const int8_t zeros256_epi8[32] __attribute__ ((aligned(32))) = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+/** Vector of 32 '127' in int8 for application with AVX2 */
+static const int8_t maxLLR256_epi8[32] __attribute__ ((aligned(32))) = {127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127};
+
+#endif
diff --git a/openair1/PHY/CODING/nrLDPC_defs.h b/openair1/PHY/CODING/nrLDPC_defs.h
new file mode 100644
index 00000000000..b96067f4b6e
--- /dev/null
+++ b/openair1/PHY/CODING/nrLDPC_defs.h
@@ -0,0 +1,59 @@
+/*
+ * 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
+ */
+//============================================================================================================================
+// encoder interface
+#ifndef __NRLDPC_DEFS__H__
+#define __NRLDPC_DEFS__H__
+#include "openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_types.h"
+/**
+   \brief LDPC encoder
+   \param 1 input
+   \param 2 channel_input
+   \param 3 int Zc
+   \param 4 int Kb
+   \param 5 short block_length
+   \param 6 short BG
+   \param 7 int n_segment
+   \param 8 unsigned int macro_num
+   \param 9-12 time_stats_t *tinput,*tprep, *tparity,*toutput
+*/
+typedef struct {
+	int n_segments;          // optim8seg
+	unsigned int macro_num; // optim8segmulti
+	unsigned char gen_code; //orig
+	time_stats_t *tinput;
+	time_stats_t *tprep;
+	time_stats_t *tparity;
+	time_stats_t *toutput;
+}encoder_implemparams_t;
+#define INIT0_LDPCIMPLEMPARAMS {0,0,0,NULL,NULL,NULL,NULL}
+typedef int(*nrLDPC_encoderfunc_t)(unsigned char **,unsigned char **,int,int,short, short, encoder_implemparams_t*);
+//============================================================================================================================
+// decoder interface
+/**
+   \brief LDPC decoder API type definition
+   \param p_decParams LDPC decoder parameters
+   \param p_llr Input LLRs
+   \param p_llrOut Output vector
+   \param p_profiler LDPC profiler statistics
+*/
+typedef int32_t(*nrLDPC_decoderfunc_t)(t_nrLDPC_dec_params* , int8_t*, int8_t* , t_nrLDPC_procBuf* , t_nrLDPC_time_stats* );
+#endif
\ No newline at end of file
diff --git a/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encode_parity_check.c b/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encode_parity_check.c
new file mode 100644
index 00000000000..738fd49b7d3
--- /dev/null
+++ b/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encode_parity_check.c
@@ -0,0 +1,201 @@
+/*
+ * 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 ldpc_encode_parity_check.c
+ * \brief Parity check function used by ldpc encoders
+ * \author Florian Kaltenberger, Raymond Knopp, Kien le Trung (Eurecom)
+ * \email openair_tech@eurecom.fr
+ * \date 27-03-2018
+ * \version 1.0
+ * \note
+ * \warning
+ */
+
+#include <stdlib.h>
+#include <math.h>
+#include <stdio.h>
+#include <string.h>
+#include <types.h>
+#include "assertions.h"
+#include "common/utils/LOG/log.h"
+
+
+//#define DEBUG_LDPC
+
+#include "ldpc384_byte.c"
+#include "ldpc352_byte.c"
+#include "ldpc320_byte.c"
+#include "ldpc288_byte.c"
+#include "ldpc256_byte.c"
+#include "ldpc240_byte.c"
+#include "ldpc224_byte.c"
+#include "ldpc208_byte.c"
+#include "ldpc192_byte.c"
+#include "ldpc176_byte.c"
+#include "ldpc_BG2_Zc384_byte.c"
+#include "ldpc_BG2_Zc352_byte.c"
+#include "ldpc_BG2_Zc320_byte.c"
+#include "ldpc_BG2_Zc288_byte.c"
+#include "ldpc_BG2_Zc256_byte.c"
+#include "ldpc_BG2_Zc240_byte.c"
+#include "ldpc_BG2_Zc224_byte.c"
+#include "ldpc_BG2_Zc208_byte.c"
+#include "ldpc_BG2_Zc192_byte.c"
+#include "ldpc_BG2_Zc176_byte.c"
+#include "ldpc_BG2_Zc160_byte.c"
+#include "ldpc_BG2_Zc144_byte.c"
+#include "ldpc_BG2_Zc128_byte.c"
+#include "ldpc_BG2_Zc120_byte.c"
+#include "ldpc_BG2_Zc112_byte.c"
+#include "ldpc_BG2_Zc104_byte.c"
+#include "ldpc_BG2_Zc96_byte.c"
+#include "ldpc_BG2_Zc88_byte.c"
+#include "ldpc_BG2_Zc80_byte.c"
+#include "ldpc_BG2_Zc72_byte.c"
+
+
+
+static inline void encode_parity_check_part_optim(uint8_t *c,uint8_t *d, short BG,short Zc,short Kb)
+{
+
+  if (BG==1)
+  {
+    switch (Zc)
+    {
+    case 2: break;
+    case 3: break;
+    case 4: break;
+    case 5: break;
+    case 6: break;
+    case 7: break;
+    case 8: break;
+    case 9: break;
+    case 10: break;
+    case 11: break;
+    case 12: break;
+    case 13: break;
+    case 14: break;
+    case 15: break;
+    case 16: break;
+    case 18: break;
+    case 20: break;
+    case 22: break;
+    case 24: break;      
+    case 26: break;
+    case 28: break;
+    case 30: break;
+    case 32: break;
+    case 36: break;
+    case 40: break;
+    case 44: break;
+    case 48: break;
+    case 52: break;
+    case 56: break;
+    case 60: break;
+    case 64: break;
+    case 72: break;
+    case 80: break;   
+    case 88: break;   
+    case 96: break;
+    case 104: break;
+    case 112: break;
+    case 120: break;
+    case 128: break;
+    case 144: break;
+    case 160: break;
+    case 176: ldpc176_byte(c,d); break;
+    case 192: ldpc192_byte(c,d); break;
+    case 208: ldpc208_byte(c,d); break;
+    case 224: ldpc224_byte(c,d); break;
+    case 240: ldpc240_byte(c,d); break;
+    case 256: ldpc256_byte(c,d); break;
+    case 288: ldpc288_byte(c,d); break;
+    case 320: ldpc320_byte(c,d); break;
+    case 352: ldpc352_byte(c,d); break;
+    case 384: ldpc384_byte(c,d); break;
+    default: AssertFatal(0,"BG %d Zc %d is not supported yet\n",BG,Zc); break;
+    }
+  }
+  else if (BG==2) {
+    switch (Zc)
+    {
+    case 2: break;
+    case 3: break;
+    case 4: break;
+    case 5: break;
+    case 6: break;
+    case 7: break;
+    case 8: break;
+    case 9: break;
+    case 10: break;
+    case 11: break;
+    case 12: break;
+    case 13: break;
+    case 14: break;
+    case 15: break;
+    case 16: break;
+    case 18: break;
+    case 20: break;
+    case 22: break;
+    case 24: break;      
+    case 26: break;
+    case 28: break;
+    case 30: break;
+    case 32: break;
+    case 36: break;
+    case 40: break;
+    case 44: break;
+    case 48: break;
+    case 52: break;
+    case 56: break;
+    case 60: break;
+    case 64: break;
+    case 72: ldpc_BG2_Zc72_byte(c,d); break;
+    case 80: ldpc_BG2_Zc80_byte(c,d); break;   
+    case 88: ldpc_BG2_Zc88_byte(c,d); break;   
+    case 96: ldpc_BG2_Zc96_byte(c,d); break;
+    case 104: ldpc_BG2_Zc104_byte(c,d); break;
+    case 112: ldpc_BG2_Zc112_byte(c,d); break;
+    case 120: ldpc_BG2_Zc120_byte(c,d); break;
+    case 128: ldpc_BG2_Zc128_byte(c,d); break;
+    case 144: ldpc_BG2_Zc144_byte(c,d); break;
+    case 160: ldpc_BG2_Zc160_byte(c,d); break;
+    case 176: ldpc_BG2_Zc176_byte(c,d); break;
+    case 192: ldpc_BG2_Zc192_byte(c,d); break;
+    case 208: ldpc_BG2_Zc208_byte(c,d); break;
+    case 224: ldpc_BG2_Zc224_byte(c,d); break;
+    case 240: ldpc_BG2_Zc240_byte(c,d); break;
+    case 256: ldpc_BG2_Zc256_byte(c,d); break;
+    case 288: ldpc_BG2_Zc288_byte(c,d); break;
+    case 320: ldpc_BG2_Zc320_byte(c,d); break;
+    case 352: ldpc_BG2_Zc352_byte(c,d); break;
+    case 384: ldpc_BG2_Zc384_byte(c,d); break;
+    default: AssertFatal(0,"BG %d Zc %d is not supported yet\n",BG,Zc); break;
+    }
+  }
+  else {
+    AssertFatal(0,"BG %d is not supported yet\n",BG);
+  } 
+
+}
+
+
+
diff --git a/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim.c b/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim.c
new file mode 100644
index 00000000000..7da265494a0
--- /dev/null
+++ b/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim.c
@@ -0,0 +1,146 @@
+/*
+ * 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 ldpc_encoder2.c
+ * \brief Defines the optimized LDPC encoder
+ * \author Florian Kaltenberger, Raymond Knopp, Kien le Trung (Eurecom)
+ * \email openair_tech@eurecom.fr
+ * \date 27-03-2018
+ * \version 1.0
+ * \note
+ * \warning
+ */
+
+#include <stdlib.h>
+#include <math.h>
+#include <stdio.h>
+#include <string.h>
+#include <types.h>
+#include "assertions.h"
+#include "common/utils/LOG/log.h"
+#include "PHY/TOOLS/time_meas.h"
+#include "openair1/PHY/CODING/nrLDPC_defs.h"
+#include "ldpc_encode_parity_check.c"
+#include "ldpc_generate_coefficient.c"
+//#define DEBUG_LDPC
+
+
+
+
+
+int nrLDPC_encod(unsigned char **test_input,unsigned char **channel_input,int Zc,int Kb,short block_length, short BG, encoder_implemparams_t *impp)
+{
+
+  short nrows=0,ncols=0;
+  int i,i1,rate=3;
+  int no_punctured_columns,removed_bit;
+
+  int simd_size;
+
+  //determine number of bits in codeword
+   //if (block_length>3840)
+   if (BG==1)
+     {
+       //BG=1;
+       nrows=46; //parity check bits
+       ncols=22; //info bits
+       rate=3;
+     }
+     //else if (block_length<=3840)
+    else if	(BG==2)
+     {
+       //BG=2;
+       nrows=42; //parity check bits
+       ncols=10; // info bits
+       rate=5;
+
+       }
+
+
+#ifdef DEBUG_LDPC
+  LOG_D(PHY,"ldpc_encoder_optim_8seg: BG %d, Zc %d, Kb %d, block_length %d\n",BG,Zc,Kb,block_length);
+  LOG_D(PHY,"ldpc_encoder_optim_8seg: PDU %x %x %x %x\n",test_input[0][0],test_input[0][1],test_input[0][2],test_input[0][3]);
+#endif
+
+  if ((Zc&31) > 0) simd_size = 16;
+  else simd_size = 32;
+
+  unsigned char c[22*Zc] __attribute__((aligned(32))); //padded input, unpacked, max size
+  unsigned char d[46*Zc] __attribute__((aligned(32))); //coded parity part output, unpacked, max size
+
+  unsigned char c_extension[2*22*Zc*simd_size] __attribute__((aligned(32)));      //double size matrix of c
+
+  // calculate number of punctured bits
+  no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*rate)/Zc;
+  removed_bit=(nrows-no_punctured_columns-2) * Zc+block_length-(int)(block_length*rate);
+  // printf("%d\n",no_punctured_columns);
+  // printf("%d\n",removed_bit);
+  // unpack input
+  memset(c,0,sizeof(unsigned char) * ncols * Zc);
+  memset(d,0,sizeof(unsigned char) * nrows * Zc);
+
+  if(impp->tinput != NULL) start_meas(impp->tinput);
+  for (i=0; i<block_length; i++) {
+    c[i] = (test_input[0][i/8]&(128>>(i&7)))>>(7-(i&7));
+      //printf("c(%d,%d)=%d\n",j,i,temp);
+    }
+
+  if(impp->tinput != NULL) stop_meas(impp->tinput);
+
+  if ((BG==1 && Zc>176) || (BG==2 && Zc>64)) { 
+    // extend matrix
+    if(impp->tprep != NULL) start_meas(impp->tprep);
+    for (i1=0; i1 < ncols; i1++)
+      {
+	memcpy(&c_extension[2*i1*Zc], &c[i1*Zc], Zc*sizeof(unsigned char));
+	memcpy(&c_extension[(2*i1+1)*Zc], &c[i1*Zc], Zc*sizeof(unsigned char));
+      }
+    for (i1=1;i1<simd_size;i1++) {
+      memcpy(&c_extension[(2*ncols*Zc*i1)], &c_extension[i1], (2*ncols*Zc*sizeof(unsigned char))-i1);
+      //    memset(&c_extension[(2*ncols*Zc*i1)],0,i1);
+      /*
+	printf("shift %d: ",i1);
+	for (int j=0;j<64;j++) printf("%d ",c_extension[(2*ncols*Zc*i1)+j]);
+	printf("\n");
+      */
+    }
+    if(impp->tprep != NULL) stop_meas(impp->tprep);
+    //parity check part
+    if(impp->tparity != NULL) start_meas(impp->tparity);
+    encode_parity_check_part_optim(c_extension, d, BG, Zc, Kb);
+    if(impp->tparity != NULL) stop_meas(impp->tparity);
+  }
+  else {
+    if (encode_parity_check_part_orig(c, d, BG, Zc, Kb, block_length)!=0) {
+      printf("Problem with encoder\n");
+      return(-1);
+    }
+  }
+  if(impp->toutput != NULL) start_meas(impp->toutput);
+  // information part and puncture columns
+  memcpy(&channel_input[0][0], &c[2*Zc], (block_length-2*Zc)*sizeof(unsigned char));
+  memcpy(&channel_input[0][block_length-2*Zc], &d[0], ((nrows-no_punctured_columns) * Zc-removed_bit)*sizeof(unsigned char));
+
+  if(impp->toutput != NULL) stop_meas(impp->toutput);
+  return 0;
+}
+
+
diff --git a/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim8seg.c b/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim8seg.c
new file mode 100644
index 00000000000..a974e86e27c
--- /dev/null
+++ b/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim8seg.c
@@ -0,0 +1,225 @@
+/*
+ * 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 ldpc_encoder2.c
+ * \brief Defines the optimized LDPC encoder
+ * \author Florian Kaltenberger, Raymond Knopp, Kien le Trung (Eurecom)
+ * \email openair_tech@eurecom.fr
+ * \date 27-03-2018
+ * \version 1.0
+ * \note
+ * \warning
+ */
+
+#include <stdlib.h>
+#include <math.h>
+#include <stdio.h>
+#include <string.h>
+#include <types.h>
+#include "assertions.h"
+#include "common/utils/LOG/log.h"
+#include "PHY/TOOLS/time_meas.h"
+#include "openair1/PHY/CODING/nrLDPC_defs.h"
+//#define DEBUG_LDPC
+#include "ldpc_encode_parity_check.c" 
+#include "ldpc_generate_coefficient.c"
+
+
+
+int nrLDPC_encod(unsigned char **test_input,unsigned char **channel_input,int Zc,int Kb,short block_length, short BG, encoder_implemparams_t *impp)
+{
+
+  short nrows=0,ncols=0;
+  int i,i1,j,rate=3;
+  int no_punctured_columns,removed_bit;
+  char temp;
+  int simd_size;
+
+#ifdef __AVX2__
+  __m256i shufmask = _mm256_set_epi64x(0x0303030303030303, 0x0202020202020202,0x0101010101010101, 0x0000000000000000);
+  __m256i andmask  = _mm256_set1_epi64x(0x0102040810204080);  // every 8 bits -> 8 bytes, pattern repeats.
+  __m256i zero256   = _mm256_setzero_si256();
+  __m256i masks[8];
+  register __m256i c256;
+  masks[0] = _mm256_set1_epi8(0x1);
+  masks[1] = _mm256_set1_epi8(0x2);
+  masks[2] = _mm256_set1_epi8(0x4);
+  masks[3] = _mm256_set1_epi8(0x8);
+  masks[4] = _mm256_set1_epi8(0x10);
+  masks[5] = _mm256_set1_epi8(0x20);
+  masks[6] = _mm256_set1_epi8(0x40);
+  masks[7] = _mm256_set1_epi8(0x80);
+#endif
+
+  AssertFatal((impp->n_segments>0&&impp->n_segments<=8),"0 < n_segments %d <= 8\n",impp->n_segments);
+
+  //determine number of bits in codeword
+  //if (block_length>3840)
+  if (BG==1)
+    {
+      nrows=46; //parity check bits
+      ncols=22; //info bits
+      rate=3;
+    }
+    //else if (block_length<=3840)
+   else if	(BG==2)
+    {
+      //BG=2;
+      nrows=42; //parity check bits
+      ncols=10; // info bits
+      rate=5;
+
+      }
+
+#ifdef DEBUG_LDPC
+  LOG_D(PHY,"ldpc_encoder_optim_8seg: BG %d, Zc %d, Kb %d, block_length %d, segments %d\n",BG,Zc,Kb,block_length,n_segments);
+  LOG_D(PHY,"ldpc_encoder_optim_8seg: PDU (seg 0) %x %x %x %x\n",test_input[0][0],test_input[0][1],test_input[0][2],test_input[0][3]);
+#endif
+
+  AssertFatal(Zc>0,"no valid Zc found for block length %d\n",block_length);
+
+  if ((Zc&31) > 0) simd_size = 16;
+  else          simd_size = 32;
+
+  unsigned char c[22*Zc] __attribute__((aligned(32))); //padded input, unpacked, max size
+  unsigned char d[46*Zc] __attribute__((aligned(32))); //coded parity part output, unpacked, max size
+
+  unsigned char c_extension[2*22*Zc*simd_size] __attribute__((aligned(32)));      //double size matrix of c
+
+  // calculate number of punctured bits
+  no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*rate)/Zc;
+  removed_bit=(nrows-no_punctured_columns-2) * Zc+block_length-(int)(block_length*rate);
+  // printf("%d\n",no_punctured_columns);
+  // printf("%d\n",removed_bit);
+  // unpack input
+  memset(c,0,sizeof(unsigned char) * ncols * Zc);
+  memset(d,0,sizeof(unsigned char) * nrows * Zc);
+
+  if(impp->tinput != NULL) start_meas(impp->tinput);
+#if 0
+  for (i=0; i<block_length; i++) {
+    for (j=0; j<n_segments; j++) {
+
+      temp = (test_input[j][i/8]&(128>>(i&7)))>>(7-(i&7));
+      //printf("c(%d,%d)=%d\n",j,i,temp);
+      c[i] |= (temp << j);
+    }
+  }
+#else
+#ifdef __AVX2__
+  for (i=0; i<block_length>>5; i++) {
+    c256 = _mm256_and_si256(_mm256_cmpeq_epi8(_mm256_andnot_si256(_mm256_shuffle_epi8(_mm256_set1_epi32(((uint32_t*)test_input[0])[i]), shufmask),andmask),zero256),masks[0]);
+    for (j=1; j<impp->n_segments; j++) {
+      c256 = _mm256_or_si256(_mm256_and_si256(_mm256_cmpeq_epi8(_mm256_andnot_si256(_mm256_shuffle_epi8(_mm256_set1_epi32(((uint32_t*)test_input[j])[i]), shufmask),andmask),zero256),masks[j]),c256);
+    }
+    ((__m256i *)c)[i] = c256;
+  }
+
+  for (i=(block_length>>5)<<5;i<block_length;i++) {
+    for (j=0; j<impp->n_segments; j++) {
+
+      temp = (test_input[j][i/8]&(128>>(i&7)))>>(7-(i&7));
+      //printf("c(%d,%d)=%d\n",j,i,temp);
+      c[i] |= (temp << j);
+    }
+  }
+#else
+  AssertFatal(1==0,"Need AVX2 for this\n");
+#endif
+#endif
+
+  if(impp->tinput != NULL) stop_meas(impp->tinput);
+
+  if ((BG==1 && Zc>176) || (BG==2 && Zc>64)) { 
+    // extend matrix
+    if(impp->tprep != NULL) start_meas(impp->tprep);
+    for (i1=0; i1 < ncols; i1++)
+      {
+	memcpy(&c_extension[2*i1*Zc], &c[i1*Zc], Zc*sizeof(unsigned char));
+	memcpy(&c_extension[(2*i1+1)*Zc], &c[i1*Zc], Zc*sizeof(unsigned char));
+      }
+    for (i1=1;i1<simd_size;i1++) {
+      memcpy(&c_extension[(2*ncols*Zc*i1)], &c_extension[i1], (2*ncols*Zc*sizeof(unsigned char))-i1);
+      //    memset(&c_extension[(2*ncols*Zc*i1)],0,i1);
+      /*
+	printf("shift %d: ",i1);
+	for (int j=0;j<64;j++) printf("%d ",c_extension[(2*ncols*Zc*i1)+j]);
+	printf("\n");
+      */
+    }
+    if(impp->tprep != NULL) stop_meas(impp->tprep);
+    //parity check part
+    if(impp->tparity != NULL) start_meas(impp->tparity);
+    encode_parity_check_part_optim(c_extension, d, BG, Zc, Kb);
+    if(impp->tparity != NULL) stop_meas(impp->tparity);
+  }
+  else {
+    if (encode_parity_check_part_orig(c, d, BG, Zc, Kb, block_length)!=0) {
+      printf("Problem with encoder\n");
+      return(-1);
+    }
+  }
+  if(impp->toutput != NULL) start_meas(impp->toutput);
+  // information part and puncture columns
+  /*
+  memcpy(&channel_input[0], &c[2*Zc], (block_length-2*Zc)*sizeof(unsigned char));
+  memcpy(&channel_input[block_length-2*Zc], &d[0], ((nrows-no_punctured_columns) * Zc-removed_bit)*sizeof(unsigned char));
+  */
+#ifdef __AVX2__
+  if ((((2*Zc)&31) == 0) && (((block_length-(2*Zc))&31) == 0)) {
+    //AssertFatal(((2*Zc)&31) == 0,"2*Zc needs to be a multiple of 32 for now\n");
+    //AssertFatal(((block_length-(2*Zc))&31) == 0,"block_length-(2*Zc) needs to be a multiple of 32 for now\n");
+    uint32_t l1 = (block_length-(2*Zc))>>5;
+    uint32_t l2 = ((nrows-no_punctured_columns) * Zc-removed_bit)>>5;
+    __m256i *c256p = (__m256i *)&c[2*Zc];
+    __m256i *d256p = (__m256i *)&d[0];
+    //  if (((block_length-(2*Zc))&31)>0) l1++;
+    
+    for (i=0;i<l1;i++)
+      for (j=0;j<impp->n_segments;j++) ((__m256i *)channel_input[j])[i] = _mm256_and_si256(_mm256_srai_epi16(c256p[i],j),masks[0]);
+    
+    //  if ((((nrows-no_punctured_columns) * Zc-removed_bit)&31)>0) l2++;
+    
+    for (i1=0;i1<l2;i1++,i++)
+      for (j=0;j<impp->n_segments;j++) ((__m256i *)channel_input[j])[i] = _mm256_and_si256(_mm256_srai_epi16(d256p[i1],j),masks[0]);
+  }
+  else {
+#ifdef DEBUG_LDPC
+  LOG_W(PHY,"using non-optimized version\n");
+#endif
+    // do non-SIMD version
+    for (i=0;i<(block_length-2*Zc);i++) 
+      for (j=0; j<impp->n_segments; j++)
+	channel_input[j][i] = (c[2*Zc+i]>>j)&1;
+    for (i=0;i<((nrows-no_punctured_columns) * Zc-removed_bit);i++)
+      for (j=0; j<impp->n_segments; j++)
+	channel_input[j][block_length-2*Zc+i] = (d[i]>>j)&1;
+    }
+
+#else
+    AssertFatal(1==0,"Need AVX2 for now\n");
+#endif
+
+  if(impp->toutput != NULL) stop_meas(impp->toutput);
+  return 0;
+}
+
+
diff --git a/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim8segmulti.c b/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim8segmulti.c
new file mode 100644
index 00000000000..b21f875b325
--- /dev/null
+++ b/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim8segmulti.c
@@ -0,0 +1,237 @@
+/*
+ * 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 ldpc_encoder2.c
+ * \brief Defines the optimized LDPC encoder
+ * \author Florian Kaltenberger, Raymond Knopp, Kien le Trung (Eurecom)
+ * \email openair_tech@eurecom.fr
+ * \date 27-03-2018
+ * \version 1.0
+ * \note
+ * \warning
+ */
+
+#include <stdlib.h>
+#include <math.h>
+#include <stdio.h>
+#include <string.h>
+#include <types.h>
+#include "assertions.h"
+#include "common/utils/LOG/log.h"
+#include "PHY/TOOLS/time_meas.h"
+#include "openair1/PHY/CODING/nrLDPC_defs.h"
+
+//#define DEBUG_LDPC
+
+#include "ldpc_encode_parity_check.c"
+#include "ldpc_generate_coefficient.c"
+
+
+int nrLDPC_encod(unsigned char **test_input,unsigned char **channel_input,int Zc,int Kb,short block_length, short BG, encoder_implemparams_t *impp)
+{
+
+  short nrows=0,ncols=0;
+  int i,i1,j,rate=3;
+  int no_punctured_columns,removed_bit;
+  //Table of possible lifting sizes
+  char temp;
+  int simd_size;
+  unsigned int macro_segment, macro_segment_end;
+
+  
+  macro_segment = 8*impp->macro_num;
+  macro_segment_end = (impp->n_segments > 8*(impp->macro_num+1)) ? 8*(impp->macro_num+1) : impp->n_segments;
+  ///printf("macro_segment: %d\n", macro_segment);
+  ///printf("macro_segment_end: %d\n", macro_segment_end );
+
+#ifdef __AVX2__
+  __m256i shufmask = _mm256_set_epi64x(0x0303030303030303, 0x0202020202020202,0x0101010101010101, 0x0000000000000000);
+  __m256i andmask  = _mm256_set1_epi64x(0x0102040810204080);  // every 8 bits -> 8 bytes, pattern repeats.
+  __m256i zero256   = _mm256_setzero_si256();
+  __m256i masks[8];
+  register __m256i c256;
+  masks[0] = _mm256_set1_epi8(0x1);
+  masks[1] = _mm256_set1_epi8(0x2);
+  masks[2] = _mm256_set1_epi8(0x4);
+  masks[3] = _mm256_set1_epi8(0x8);
+  masks[4] = _mm256_set1_epi8(0x10);
+  masks[5] = _mm256_set1_epi8(0x20);
+  masks[6] = _mm256_set1_epi8(0x40);
+  masks[7] = _mm256_set1_epi8(0x80);
+#endif
+
+
+
+  //determine number of bits in codeword
+  if (BG==1)
+    {
+      nrows=46; //parity check bits
+      ncols=22; //info bits
+      rate=3;
+    }
+    else if (BG==2)
+    {
+      nrows=42; //parity check bits
+      ncols=10; // info bits
+      rate=5;
+    }
+
+#ifdef DEBUG_LDPC
+  LOG_D(PHY,"ldpc_encoder_optim_8seg: BG %d, Zc %d, Kb %d, block_length %d, segments %d\n",BG,Zc,Kb,block_length,n_segments);
+  LOG_D(PHY,"ldpc_encoder_optim_8seg: PDU (seg 0) %x %x %x %x\n",test_input[0][0],test_input[0][1],test_input[0][2],test_input[0][3]);
+#endif
+
+  AssertFatal(Zc>0,"no valid Zc found for block length %d\n",block_length);
+
+  if ((Zc&31) > 0) simd_size = 16;
+  else          simd_size = 32;
+
+  unsigned char c[22*Zc] __attribute__((aligned(32))); //padded input, unpacked, max size
+  unsigned char d[46*Zc] __attribute__((aligned(32))); //coded parity part output, unpacked, max size
+
+  unsigned char c_extension[2*22*Zc*simd_size] __attribute__((aligned(32)));      //double size matrix of c
+
+  // calculate number of punctured bits
+  no_punctured_columns=(int)((nrows-2)*Zc+block_length-block_length*rate)/Zc;
+  removed_bit=(nrows-no_punctured_columns-2) * Zc+block_length-(int)(block_length*rate);
+  //printf("%d\n",no_punctured_columns);
+  //printf("%d\n",removed_bit);
+  // unpack input
+  memset(c,0,sizeof(unsigned char) * ncols * Zc);
+  memset(d,0,sizeof(unsigned char) * nrows * Zc);
+
+  if(impp->tinput != NULL) start_meas(impp->tinput);
+#if 0
+  for (i=0; i<block_length; i++) {
+	//for (j=0; j<n_segments; j++) {
+    for (j=macro_segment; j < macro_segment_end; j++) {
+
+      temp = (test_input[j][i/8]&(1<<(i&7)))>>(i&7);
+      //printf("c(%d,%d)=%d\n",j,i,temp);
+      c[i] |= (temp << (j-macro_segment));
+    }
+  }
+#else
+#ifdef __AVX2__
+  for (i=0; i<block_length>>5; i++) {
+    c256 = _mm256_and_si256(_mm256_cmpeq_epi8(_mm256_andnot_si256(_mm256_shuffle_epi8(_mm256_set1_epi32(((uint32_t*)test_input[macro_segment])[i]), shufmask),andmask),zero256),masks[0]);
+    //for (j=1; j<n_segments; j++) {
+    for (j=macro_segment+1; j < macro_segment_end; j++) {    
+      c256 = _mm256_or_si256(_mm256_and_si256(_mm256_cmpeq_epi8(_mm256_andnot_si256(_mm256_shuffle_epi8(_mm256_set1_epi32(((uint32_t*)test_input[j])[i]), shufmask),andmask),zero256),masks[j-macro_segment]),c256);
+    }
+    ((__m256i *)c)[i] = c256;
+  }
+
+  for (i=(block_length>>5)<<5;i<block_length;i++) {
+    //for (j=0; j<n_segments; j++) {
+	  for (j=macro_segment; j < macro_segment_end; j++) {
+
+	    temp = (test_input[j][i/8]&(128>>(i&7)))>>(7-(i&7));
+      //printf("c(%d,%d)=%d\n",j,i,temp);
+      c[i] |= (temp << (j-macro_segment));
+    }
+  }
+#else
+  AssertFatal(1==0,"Need AVX2 for this\n");
+#endif
+#endif
+
+  if(impp->tinput != NULL) stop_meas(impp->tinput);
+
+  if ((BG==1 && Zc>176) || (BG==2 && Zc>64)) {
+    // extend matrix
+    if(impp->tprep != NULL) start_meas(impp->tprep);
+    for (i1=0; i1 < ncols; i1++)
+      {
+	memcpy(&c_extension[2*i1*Zc], &c[i1*Zc], Zc*sizeof(unsigned char));
+	memcpy(&c_extension[(2*i1+1)*Zc], &c[i1*Zc], Zc*sizeof(unsigned char));
+      }
+    for (i1=1;i1<simd_size;i1++) {
+      memcpy(&c_extension[(2*ncols*Zc*i1)], &c_extension[i1], (2*ncols*Zc*sizeof(unsigned char))-i1);
+      //    memset(&c_extension[(2*ncols*Zc*i1)],0,i1);
+      /*
+	printf("shift %d: ",i1);
+	for (int j=0;j<64;j++) printf("%d ",c_extension[(2*ncols*Zc*i1)+j]);
+	printf("\n");
+      */
+    }
+    if(impp->tprep != NULL) stop_meas(impp->tprep);
+    //parity check part
+    if(impp->tparity != NULL) start_meas(impp->tparity);
+    encode_parity_check_part_optim(c_extension, d, BG, Zc, Kb);
+    if(impp->tparity != NULL) stop_meas(impp->tparity);
+  }
+  else {
+    if (encode_parity_check_part_orig(c, d, BG, Zc, Kb, block_length)!=0) {
+      printf("Problem with encoder\n");
+      return(-1);
+    }
+  }
+  if(impp->toutput != NULL) start_meas(impp->toutput);
+  // information part and puncture columns
+  /*
+  memcpy(&channel_input[0], &c[2*Zc], (block_length-2*Zc)*sizeof(unsigned char));
+  memcpy(&channel_input[block_length-2*Zc], &d[0], ((nrows-no_punctured_columns) * Zc-removed_bit)*sizeof(unsigned char));
+  */
+#ifdef __AVX2__
+  if ((((2*Zc)&31) == 0) && (((block_length-(2*Zc))&31) == 0)) {
+    //AssertFatal(((2*Zc)&31) == 0,"2*Zc needs to be a multiple of 32 for now\n");
+    //AssertFatal(((block_length-(2*Zc))&31) == 0,"block_length-(2*Zc) needs to be a multiple of 32 for now\n");
+    uint32_t l1 = (block_length-(2*Zc))>>5;
+    uint32_t l2 = ((nrows-no_punctured_columns) * Zc-removed_bit)>>5;
+    __m256i *c256p = (__m256i *)&c[2*Zc];
+    __m256i *d256p = (__m256i *)&d[0];
+    //  if (((block_length-(2*Zc))&31)>0) l1++;
+
+    for (i=0;i<l1;i++)
+      //for (j=0;j<n_segments;j++) ((__m256i *)channel_input[j])[i] = _mm256_and_si256(_mm256_srai_epi16(c256p[i],j),masks[0]);
+    	for (j=macro_segment; j < macro_segment_end; j++) ((__m256i *)channel_input[j])[i] = _mm256_and_si256(_mm256_srai_epi16(c256p[i],j-macro_segment),masks[0]);
+
+
+    //  if ((((nrows-no_punctured_columns) * Zc-removed_bit)&31)>0) l2++;
+
+    for (i1=0;i1<l2;i1++,i++)
+      //for (j=0;j<n_segments;j++) ((__m256i *)channel_input[j])[i] = _mm256_and_si256(_mm256_srai_epi16(d256p[i1],j),masks[0]);
+    	for (j=macro_segment; j < macro_segment_end; j++)  ((__m256i *)channel_input[j])[i] = _mm256_and_si256(_mm256_srai_epi16(d256p[i1],j-macro_segment),masks[0]);
+  }
+  else {
+#ifdef DEBUG_LDPC
+  LOG_W(PHY,"using non-optimized version\n");
+#endif
+    // do non-SIMD version
+    for (i=0;i<(block_length-2*Zc);i++)
+      //for (j=0; j<n_segments; j++)
+      for (j=macro_segment; j < macro_segment_end; j++)
+	channel_input[j][i] = (c[2*Zc+i]>>(j-macro_segment))&1;
+    for (i=0;i<((nrows-no_punctured_columns) * Zc-removed_bit);i++)
+      //for (j=0; j<n_segments; j++)
+    	  for (j=macro_segment; j < macro_segment_end; j++)
+	channel_input[j][block_length-2*Zc+i] = (d[i]>>(j-macro_segment))&1;
+    }
+
+#else
+    AssertFatal(1==0,"Need AVX2 for now\n");
+#endif
+
+  if(impp->toutput != NULL) stop_meas(impp->toutput);
+  return 0;
+}
+
diff --git a/openair1/PHY/CODING/nrLDPC_extern.h b/openair1/PHY/CODING/nrLDPC_extern.h
new file mode 100644
index 00000000000..c0bfa0fdd8f
--- /dev/null
+++ b/openair1/PHY/CODING/nrLDPC_extern.h
@@ -0,0 +1,35 @@
+/*
+ * 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
+ */
+#include "openair1/PHY/CODING/nrLDPC_defs.h"
+
+#ifdef LDPC_LOADER
+nrLDPC_decoderfunc_t nrLDPC_decoder;
+nrLDPC_encoderfunc_t nrLDPC_encoder;
+#else
+/* functions to load the LDPC shared lib, implemented in openair1/PHY/CODING/nrLDPC_load.c */
+extern int load_nrLDPClib(void) ;
+extern int load_nrLDPClib_ref(char *libversion, nrLDPC_encoderfunc_t * nrLDPC_encoder_ptr); // for ldpctest
+/* ldpc coder/decoder functions, as loaded by load_nrLDPClib(). */
+extern nrLDPC_decoderfunc_t nrLDPC_decoder;
+extern nrLDPC_encoderfunc_t nrLDPC_encoder;
+// inline functions:
+#include "openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_init_mem.h"
+#endif
\ No newline at end of file
diff --git a/openair1/PHY/CODING/nrLDPC_load.c b/openair1/PHY/CODING/nrLDPC_load.c
new file mode 100644
index 00000000000..a74bdf7bd12
--- /dev/null
+++ b/openair1/PHY/CODING/nrLDPC_load.c
@@ -0,0 +1,76 @@
+/*
+ * 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 openair1/PHY/CODING/coding_nr_load.c
+ * \brief: load library implementing coding/decoding algorithms
+ * \author Francois TABURET
+ * \date 2020
+ * \version 0.1
+ * \company NOKIA BellLabs France
+ * \email: francois.taburet@nokia-bell-labs.com
+ * \note
+ * \warning
+ */
+#define _GNU_SOURCE 
+#include <sys/types.h>
+#include <stdlib.h>
+#include <malloc.h>
+#include "assertions.h"
+#include "common/utils/LOG/log.h"
+#define LDPC_LOADER
+#include "PHY/CODING/nrLDPC_extern.h"
+#include "common/config/config_userapi.h" 
+#include "common/utils/load_module_shlib.h" 
+
+
+/* function description array, to be used when loading the encoding/decoding shared lib */
+static loader_shlibfunc_t shlib_fdesc[2];
+
+char *arg[64]={"ldpctest","-O","cmdlineonly::dbgl0"};
+
+int load_nrLDPClib(void) {
+	 char *ptr = (char*)config_get_if();
+     if ( ptr==NULL )  {// phy simulators, config module possibly not loaded
+     	 load_configmodule(3,(char **)arg,CONFIG_ENABLECMDLINEONLY) ;
+     	 logInit();
+     }	 
+     shlib_fdesc[0].fname = "nrLDPC_decod";
+     shlib_fdesc[1].fname = "nrLDPC_encod";
+     int ret=load_module_shlib("ldpc",shlib_fdesc,sizeof(shlib_fdesc)/sizeof(loader_shlibfunc_t),NULL);
+     AssertFatal( (ret >= 0),"Error loading ldpc decoder");
+     nrLDPC_decoder = (nrLDPC_decoderfunc_t)shlib_fdesc[0].fptr;
+     nrLDPC_encoder = (nrLDPC_encoderfunc_t)shlib_fdesc[1].fptr;
+return 0;
+}
+
+int load_nrLDPClib_ref(char *libversion, nrLDPC_encoderfunc_t * nrLDPC_encoder_ptr) {
+	loader_shlibfunc_t shlib_encoder_fdesc;
+
+     shlib_encoder_fdesc.fname = "nrLDPC_encod";
+     char libpath[64];
+     sprintf(libpath,"ldpc%s",libversion);
+     int ret=load_module_shlib(libpath,&shlib_encoder_fdesc,1,NULL);
+     AssertFatal( (ret >= 0),"Error loading ldpc encoder %s\n",libpath);
+     *nrLDPC_encoder_ptr = (nrLDPC_encoderfunc_t)shlib_encoder_fdesc.fptr;
+return 0;
+}
+
+
diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.c b/openair1/PHY/NR_REFSIG/ptrs_nr.c
new file mode 100644
index 00000000000..12f76b950f1
--- /dev/null
+++ b/openair1/PHY/NR_REFSIG/ptrs_nr.c
@@ -0,0 +1,423 @@
+/*
+ * 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
+ */
+
+/**********************************************************************
+*
+* FILENAME    :  ptrs_nr.c
+*
+* MODULE      :  phase tracking reference signals
+*
+* DESCRIPTION :  resource element mapping of ptrs sequences
+*                3GPP TS 38.211 and 3GPP TS 38.214
+*
+************************************************************************/
+
+#include <stdint.h>
+#include <stdio.h>
+#include "dmrs_nr.h"
+#include "PHY/NR_REFSIG/ptrs_nr.h"
+
+/***********************************************************************/
+
+
+ //#define max(a,b) (((a) > (b)) ? (a) : (b))
+
+// TS 38.211 Table 6.4.1.2.2.1-1: The parameter kRE_ref.
+// The first 4 colomns are DM-RS Configuration type 1 and the last 4 colomns are DM-RS Configuration type 2.
+
+int16_t table_6_4_1_2_2_1_1_pusch_ptrs_kRE_ref [6][8] = {
+{ 0,            2,           6,          8,          0,          1,         6,         7},
+{ 2,            4,           8,         10,          1,          6,         7,         0},
+{ 1,            3,           7,          9,          2,          3,         8,         9},
+{ 3,            5,           9,         11,          3,          8,         9,         2},
+{-1,           -1,          -1,         -1,          4,          5,        10,        11},
+{-1,           -1,          -1,         -1,          5,         10,        11,         4},
+};
+
+
+/*******************************************************************
+*
+* NAME :         get_kRE_ref
+*
+* PARAMETERS :   dmrs_antenna_port      DMRS antenna port
+*                pusch_dmrs_type        PUSCH DMRS type
+*                resourceElementOffset  the parameter resourceElementOffset
+*
+* RETURN :       the parameter k_RE_ref
+*
+* DESCRIPTION :  3GPP TS 38.211 Table 6.4.1.2.2.1-1
+*
+*********************************************************************/
+
+int16_t get_kRE_ref(uint8_t dmrs_antenna_port, uint8_t pusch_dmrs_type, uint8_t resourceElementOffset) {
+
+  uint8_t colomn;
+  int16_t k_RE_ref;
+
+  colomn = resourceElementOffset;
+
+  if (pusch_dmrs_type == 2)
+    colomn += 4;
+
+  k_RE_ref = table_6_4_1_2_2_1_1_pusch_ptrs_kRE_ref[dmrs_antenna_port][colomn];
+
+  AssertFatal(k_RE_ref>=0,"invalid k_RE_ref < 0. Check PTRS Configuration\n");
+
+  return k_RE_ref;
+}
+
+
+/*******************************************************************
+*
+* NAME :         get_K_ptrs
+*
+* PARAMETERS :   ptrs_UplinkConfig      PTRS uplink configuration
+*                N_RB                   number of RBs scheduled for PUSCH
+*
+* RETURN :       the parameter K_ptrs
+*
+* DESCRIPTION :  3GPP TS 38.214 6.2.3 Table 6.2.3.1-2
+*
+*********************************************************************/
+
+uint8_t get_K_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint16_t N_RB){
+
+	uint16_t nrb0, nrb1;
+
+	nrb0 = ptrs_UplinkConfig->frequencyDensity.n_rb0;
+	nrb1 = ptrs_UplinkConfig->frequencyDensity.n_rb1;
+
+	if (nrb0 == 0 || nrb0 == 0)
+		return 2;
+
+	if (N_RB < nrb0){
+		LOG_I(PHY,"PUSH PT-RS is not present.\n");
+		return 0;
+	}
+	else if (N_RB >= nrb0 && N_RB < nrb1)
+		return 2;
+	else
+		return 4;
+}
+
+/*******************************************************************
+*
+* NAME :         set_ptrs_symb_idx
+*
+* PARAMETERS :   ptrs_symbols           PTRS OFDM symbol indicies bit mask
+*                duration_in_symbols    number of scheduled PUSCH ofdm symbols
+*                start_symbol           first ofdm symbol of PUSCH within slot
+*                L_ptrs                 the parameter L_ptrs
+*                ofdm_symbol_size       FFT size
+*
+* RETURN :       sets the bit map of PTRS ofdm symbol indicies
+*
+* DESCRIPTION :  3GPP TS 38.211 6.4.1.2.2.1
+*
+*********************************************************************/
+
+void set_ptrs_symb_idx(uint16_t *ptrs_symbols,
+                       uint8_t duration_in_symbols,
+                       uint8_t start_symbol,
+                       uint8_t dmrs_type,
+                       uint8_t L_ptrs,
+                       uint8_t pusch_maxLength,
+                       uint16_t ofdm_symbol_size) {
+
+  uint8_t i, last_symbol, is_dmrs_symbol1, is_dmrs_symbol2;
+  int16_t l_ref;
+
+  *ptrs_symbols = 0;
+  i = 0;
+  is_dmrs_symbol1 = 0;
+  is_dmrs_symbol2 = 0;
+  l_ref = start_symbol;
+  last_symbol = start_symbol + duration_in_symbols - 1;
+
+  while ( (l_ref + i*L_ptrs) <= last_symbol) {
+
+    is_dmrs_symbol1 = is_dmrs_symbol(max((l_ref + (i-1)*L_ptrs + 1), l_ref),
+                                     0,
+                                     0,
+                                     0,
+                                     0,
+                                     0,
+                                     duration_in_symbols,
+                                     dmrs_type,
+                                     ofdm_symbol_size);
+
+    is_dmrs_symbol2 = is_dmrs_symbol(l_ref + i*L_ptrs,
+                                     0,
+                                     0,
+                                     0,
+                                     0,
+                                     0,
+                                     duration_in_symbols,
+                                     dmrs_type,
+                                     ofdm_symbol_size);
+
+    if ( is_dmrs_symbol1 + is_dmrs_symbol2 > 0 ) {
+
+      if (pusch_maxLength == 2)
+        l_ref = l_ref + i*L_ptrs + 1;
+      else
+        l_ref = l_ref + i*L_ptrs;
+
+       i = 1;
+
+       continue;
+
+    }
+
+    *ptrs_symbols = *ptrs_symbols | (1<<(l_ref + i*L_ptrs));
+    i++;
+  }
+}
+
+/*******************************************************************
+*
+* NAME :         get_L_ptrs
+*
+* PARAMETERS :   ptrs_UplinkConfig      PTRS uplink configuration
+*                I_mcs                  MCS index used for PUSCH
+*
+* RETURN :       the parameter L_ptrs
+*
+* DESCRIPTION :  3GPP TS 38.214 6.2.3 Table 6.2.3.1-1
+*
+*********************************************************************/
+
+uint8_t get_L_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint8_t I_mcs) {
+
+	uint8_t mcs1, mcs2, mcs3;
+
+	mcs1 = ptrs_UplinkConfig->timeDensity.ptrs_mcs1;
+	mcs2 = ptrs_UplinkConfig->timeDensity.ptrs_mcs2;
+	mcs3 = ptrs_UplinkConfig->timeDensity.ptrs_mcs3;
+
+	if (mcs1 == 0 || mcs2 == 0 || mcs3 == 0)
+		return 1;
+
+	if (I_mcs < mcs1){
+		LOG_I(PHY,"PUSH PT-RS is not present.\n");
+		return 0;
+	}
+	else if (I_mcs >= mcs1 && I_mcs < mcs2)
+		return 4;
+	else if (I_mcs >= mcs2 && I_mcs < mcs3)
+		return 2;
+	else
+		return 1;
+}
+
+/*******************************************************************
+*
+* NAME :         is_ptrs_subcarrier
+*
+* PARAMETERS : k                      subcarrier index
+*              K_ptrs                 the parameter K_ptrs
+*              n_rnti                 UE CRNTI
+*              N_RB                   number of RBs scheduled for PUSCH
+*              k_RE_ref               the parameter k_RE_ref
+*              start_sc               first subcarrier index
+*              ofdm_symbol_size       FFT size
+*
+* RETURN :       1 if subcarrier k is PTRS, or 0 otherwise
+*
+* DESCRIPTION :  3GPP TS 38.211 6.4.1.2 Phase-tracking reference signal for PUSCH
+*
+*********************************************************************/
+
+uint8_t is_ptrs_subcarrier(uint16_t k, uint8_t K_ptrs, uint16_t n_rnti, uint16_t N_RB, int16_t k_RE_ref, uint16_t start_sc, uint16_t ofdm_symbol_size) {
+
+	uint16_t k_RB_ref, i, sc;
+
+	i = 0;
+	sc = 0;
+	k_RB_ref = 0;
+
+	if (N_RB % K_ptrs == 0)
+		k_RB_ref = n_rnti % K_ptrs;
+	else
+		k_RB_ref = n_rnti % (N_RB % K_ptrs);
+
+	while (k > sc){
+
+		sc = (start_sc + k_RE_ref + (i*K_ptrs + k_RB_ref)*NR_NB_SC_PER_RB)%ofdm_symbol_size;
+		i++;
+
+	}
+
+	if (k == sc)
+        return 1;
+	else
+        return 0;
+
+}
+
+/*******************************************************************
+*
+* NAME :         is_ptrs_symbol
+*
+* PARAMETERS : l                      ofdm symbol index within slot
+*              k                      subcarrier index
+*              n_rnti                 UE CRNTI
+*              N_RB                   number of RBs scheduled for PUSCH
+*              duration_in_symbols    number of scheduled PUSCH ofdm symbols
+*              dmrs_antenna_port      DMRS antenna port
+*              K_ptrs                 the parameter K_ptrs
+*              ptrs_symbols           bit mask of ptrs
+*              start_sc               first subcarrier index
+*              ofdm_symbol_size       FFT size
+*              pusch_dmrs_type        PUSCH DMRS type (1 or 2)
+*              ptrs_UplinkConfig      PTRS uplink configuration
+*
+* RETURN :       0 if symbol(k,l) is data, or 1 if symbol(k,l) is ptrs
+*
+* DESCRIPTION :  3GPP TS 38.211 6.4.1.2 Phase-tracking reference signal for PUSCH
+*
+*********************************************************************/
+
+uint8_t is_ptrs_symbol(uint8_t l,
+                       uint16_t k,
+                       uint16_t n_rnti,
+                       uint16_t N_RB,
+                       uint8_t duration_in_symbols,
+                       uint8_t dmrs_antenna_port,
+                       uint8_t K_ptrs,
+                       uint16_t ptrs_symbols,
+                       uint16_t start_sc,
+                       uint16_t ofdm_symbol_size,
+                       pusch_dmrs_type_t pusch_dmrs_type,
+                       uint8_t resourceElementOffset) {
+
+  uint8_t is_ptrs_freq, is_ptrs_time;
+  int16_t k_RE_ref;
+
+  is_ptrs_freq = 0;
+  is_ptrs_time = 0;
+
+  k_RE_ref = get_kRE_ref(dmrs_antenna_port, pusch_dmrs_type, resourceElementOffset);
+
+  is_ptrs_freq = is_ptrs_subcarrier(k, K_ptrs, n_rnti, N_RB, k_RE_ref, start_sc, ofdm_symbol_size);
+
+  if (is_ptrs_freq == 0)
+    return 0;
+
+  if (((ptrs_symbols>>l)&1) == 1)
+    is_ptrs_time = 1;
+
+  if (is_ptrs_time && is_ptrs_freq)
+    return 1;
+  else
+    return 0;
+
+}
+
+/*
+int main(int argc, char const *argv[])
+{
+
+	dmrs_UplinkConfig_t dmrs_Uplink_Config;
+	ptrs_UplinkConfig_t ptrs_Uplink_Config;
+	uint8_t resourceElementOffset;
+	uint8_t dmrs_antenna_port;
+	uint8_t L_ptrs, K_ptrs;
+	int16_t k_RE_ref;
+	uint16_t N_RB, ptrs_symbols, ofdm_symbol_size, k;
+	uint8_t duration_in_symbols, I_mcs;
+	uint8_t start_symbol, l;
+	uint8_t ptrs_symbol_flag;
+	uint16_t n_rnti;
+
+    dmrs_Uplink_Config.pusch_dmrs_type = pusch_dmrs_type1;
+    dmrs_Uplink_Config.pusch_dmrs_AdditionalPosition = pusch_dmrs_pos1;
+    dmrs_Uplink_Config.pusch_maxLength = pusch_len2;
+
+    ptrs_Uplink_Config.timeDensity.ptrs_mcs1 = 0; // setting MCS values to 0 indicate abscence of time_density field in the configuration
+    ptrs_Uplink_Config.timeDensity.ptrs_mcs2 = 0;
+    ptrs_Uplink_Config.timeDensity.ptrs_mcs3 = 0;
+    ptrs_Uplink_Config.frequencyDensity.n_rb0 = 0;     // setting N_RB values to 0 indicate abscence of frequency_density field in the configuration
+    ptrs_Uplink_Config.frequencyDensity.n_rb1 = 0;
+    ptrs_Uplink_Config.resourceElementOffset = 0;
+
+    n_rnti = 0x1234;
+    resourceElementOffset = 0;
+    ptrs_symbols = 0;
+	dmrs_antenna_port = 0;
+	N_RB = 50;
+	duration_in_symbols = 14;
+	ofdm_symbol_size = 2048;
+	I_mcs = 9;
+	start_symbol = 0;
+	ptrs_symbol_flag = 0;
+
+    k_RE_ref = get_kRE_ref(dmrs_antenna_port, dmrs_Uplink_Config.pusch_dmrs_type, resourceElementOffset);
+
+    K_ptrs = get_K_ptrs(&ptrs_Uplink_Config, N_RB);
+
+    L_ptrs = get_L_ptrs(&ptrs_Uplink_Config, I_mcs);
+
+    set_ptrs_symb_idx(&ptrs_symbols,
+                      &ptrs_Uplink_Config,
+                      &dmrs_Uplink_Config,
+                      1,
+                      duration_in_symbols,
+                      start_symbol,
+                      L_ptrs,
+                      ofdm_symbol_size);
+
+    printf("PTRS OFDM symbol indicies: ");
+
+    for (l = start_symbol; l < start_symbol + duration_in_symbols; l++){
+
+        ptrs_symbol_flag = is_ptrs_symbol(l,
+                                          0,
+                                          n_rnti,
+                                          N_RB,
+                                          duration_in_symbols,
+                                          dmrs_antenna_port,
+                                          K_ptrs,
+                                          ptrs_symbols,
+                                          dmrs_Uplink_Config.pusch_dmrs_type,
+                                          &ptrs_Uplink_Config);
+
+        if (ptrs_symbol_flag == 1)
+            printf(" %d ", l);
+
+    }
+
+    printf("\n");
+
+    printf("PTRS subcarrier indicies: ");
+
+    for (k = 0; k < N_RB*12; k++){
+
+        if (is_ptrs_subcarrier(k, K_ptrs, n_rnti, N_RB, k_RE_ref) == 1)
+            printf(" %d ", k);
+
+    }
+
+    printf("\n");
+
+	return 0;
+}
+*/
diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.h b/openair1/PHY/NR_REFSIG/ptrs_nr.h
new file mode 100644
index 00000000000..291ff4a5558
--- /dev/null
+++ b/openair1/PHY/NR_REFSIG/ptrs_nr.h
@@ -0,0 +1,81 @@
+/*
+ * 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
+ */
+
+/**********************************************************************
+*
+* FILENAME    :  dmrs.h
+*
+* MODULE      :  demodulation reference signals
+*
+* DESCRIPTION :  generation of dmrs sequences for NR 5G
+*                3GPP TS 38.211
+*
+************************************************************************/
+
+#ifndef PTRS_NR_H
+#define PTRS_NR_H
+
+#include "PHY/defs_nr_UE.h"
+
+/************** CODE GENERATION ***********************************/
+
+/************** DEFINE ********************************************/
+
+
+/************* STRUCTURES *****************************************/
+
+
+/************** VARIABLES *****************************************/
+
+/************** FUNCTION ******************************************/
+
+int16_t get_kRE_ref(uint8_t dmrs_antenna_port, uint8_t pusch_dmrs_type, uint8_t resourceElementOffset);
+
+uint8_t get_K_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint16_t N_RB);
+
+void set_ptrs_symb_idx(uint16_t *ptrs_symbols,
+                       uint8_t duration_in_symbols,
+                       uint8_t start_symbol,
+                       uint8_t dmrs_type,
+                       uint8_t L_ptrs,
+                       uint8_t pusch_maxLength,
+                       uint16_t ofdm_symbol_size);
+
+uint8_t get_L_ptrs(ptrs_UplinkConfig_t *ptrs_UplinkConfig, uint8_t I_mcs);
+
+uint8_t is_ptrs_subcarrier(uint16_t k, uint8_t K_ptrs, uint16_t n_rnti, uint16_t N_RB, int16_t k_RE_ref, uint16_t start_sc, uint16_t ofdm_symbol_size);
+
+uint8_t is_ptrs_symbol(uint8_t l,
+                       uint16_t k,
+                       uint16_t n_rnti,
+                       uint16_t N_RB,
+                       uint8_t duration_in_symbols,
+                       uint8_t dmrs_antenna_port,
+                       uint8_t K_ptrs,
+                       uint16_t ptrs_symbols,
+                       uint16_t start_sc,
+                       uint16_t ofdm_symbol_size,
+                       pusch_dmrs_type_t pusch_dmrs_type,
+                       uint8_t resourceElementOffset);
+
+
+
+#endif /* PTRS_NR_H */
diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci_tools_common.c b/openair1/PHY/NR_TRANSPORT/nr_dci_tools_common.c
new file mode 100644
index 00000000000..d26a52f157c
--- /dev/null
+++ b/openair1/PHY/NR_TRANSPORT/nr_dci_tools_common.c
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file PHY/NR_TRANSPORT/nr_dci_tools_common.c
+ * \brief
+ * \author
+ * \date 2018
+ * \version 0.1
+ * \company Eurecom
+ * \email:
+ * \note
+ * \warning
+ */
+
+#include "nr_dci.h"
+
+//#define DEBUG_FILL_DCI
+
+#include "nr_dlsch.h"
+
+
+void get_coreset_rballoc(uint8_t *FreqDomainResource,int *n_rb,int *rb_offset) {
+
+  uint8_t count=0, start=0, start_set=0;
+
+  uint64_t bitmap = (((uint64_t)FreqDomainResource[0])<<37)|
+    (((uint64_t)FreqDomainResource[1])<<29)|
+    (((uint64_t)FreqDomainResource[2])<<21)|
+    (((uint64_t)FreqDomainResource[3])<<13)|
+    (((uint64_t)FreqDomainResource[4])<<5)|
+    (((uint64_t)FreqDomainResource[5])>>3);
+  
+  for (int i=0; i<45; i++)
+    if ((bitmap>>(44-i))&1) {
+      count++;
+      if (!start_set) {
+        start = i;
+        start_set = 1;
+      }
+    }
+  *rb_offset = 6*start;
+  *n_rb = 6*count;
+}
+
diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.c b/openair1/PHY/NR_TRANSPORT/nr_prach.c
new file mode 100644
index 00000000000..5710499e1ae
--- /dev/null
+++ b/openair1/PHY/NR_TRANSPORT/nr_prach.c
@@ -0,0 +1,650 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file PHY/NR_TRANSPORT/nr_prach.c
+ * \brief Top-level routines for generating and decoding the PRACH physical channel V15.4 2018-12
+ * \author R. Knopp
+ * \date 2019
+ * \version 0.1
+ * \company Eurecom
+ * \email: knopp@eurecom.fr
+ * \note
+ * \warning
+ */
+
+#include "PHY/defs_gNB.h"
+#include "PHY/NR_TRANSPORT/nr_transport.h"
+#include "PHY/NR_TRANSPORT/nr_transport_proto_common.h"
+
+extern uint16_t NCS_unrestricted_delta_f_RA_125[16];
+extern uint16_t NCS_restricted_TypeA_delta_f_RA_125[15];
+extern uint16_t NCS_restricted_TypeB_delta_f_RA_125[13];
+extern uint16_t NCS_unrestricted_delta_f_RA_5[16];
+extern uint16_t NCS_restricted_TypeA_delta_f_RA_5[16];
+extern uint16_t NCS_restricted_TypeB_delta_f_RA_5[14];
+extern uint16_t NCS_unrestricted_delta_f_RA_15[16];
+extern uint16_t prach_root_sequence_map_0_3[838];
+extern uint16_t prach_root_sequence_map_abc[138];
+extern int64_t table_6_3_3_2_2_prachConfig_Index [256][9];
+extern int64_t table_6_3_3_2_3_prachConfig_Index [256][9];
+extern int64_t table_6_3_3_2_4_prachConfig_Index [256][10];
+extern uint16_t nr_du[838];
+extern int16_t nr_ru[2*839];
+
+void rx_nr_prach_ru(RU_t *ru,
+		    int frame,
+		    int subframe) {
+
+  AssertFatal(ru!=NULL,"ru is null\n");
+
+  int16_t            **rxsigF=NULL;
+  NR_DL_FRAME_PARMS *fp=ru->nr_frame_parms;
+  int16_t prach_ConfigIndex   = fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
+  int16_t *prach[ru->nb_rx];
+  uint8_t prach_fmt = get_nr_prach_fmt(prach_ConfigIndex,fp->frame_type,fp->freq_range);
+
+  rxsigF            = ru->prach_rxsigF;
+
+  AssertFatal(ru->if_south == LOCAL_RF,"we shouldn't call this if if_south != LOCAL_RF\n");
+  for (int aa=0; aa<ru->nb_rx; aa++) 
+    prach[aa] = (int16_t*)&ru->common.rxdata[aa][(subframe*fp->samples_per_subframe)-ru->N_TA_offset];
+  
+
+
+  int mu = fp->numerology_index;
+  int Ncp;
+  int16_t *prach2;
+
+
+  switch (prach_fmt) {
+  case 0:
+    Ncp = 3168;
+    break;
+
+  case 1:
+    Ncp = 21024;
+    break;
+
+  case 2:
+    Ncp = 4688;
+    break;
+
+  case 3:
+    Ncp = 3168;
+    break;
+
+  case 0xa1:
+    Ncp = 288/(1<<mu);
+    break;
+
+  case 0xa2:
+    Ncp = 576/(1<<mu);
+    break;
+
+  case 0xa3:
+    Ncp = 864/(1<<mu);
+    break;
+
+  case 0xb1:
+    Ncp = 216/(1<<mu);
+    break;
+
+  case 0xb2:
+    Ncp = 360/(1<<mu);
+    break;
+
+  case 0xb3:
+    Ncp = 504/(1<<mu);
+    break;
+
+  case 0xb4:
+    Ncp = 936/(1<<mu);
+    break;
+
+  case 0xc0:
+    Ncp = 1240/(1<<mu);
+    break;
+
+  case 0xc2:
+    Ncp = 2048/(1<<mu);
+    break;
+
+  default:
+    AssertFatal(1==0,"unknown prach format %x\n",prach_fmt);
+    break;
+  }
+
+  // Do forward transform
+  if (LOG_DEBUGFLAG(PRACH)) {
+    LOG_D(PHY,"rx_prach: Doing FFT for N_RB_UL %d nb_rx:%d Ncp:%d\n",fp->N_RB_UL, ru->nb_rx, Ncp);
+  }
+  AssertFatal(mu==1,"only 30 kHz SCS handled for now\n");
+
+  // Note: Assumes PUSCH SCS @ 30 kHz, take values for formats 0-2 and adjust for others below
+  int kbar = 1;
+  int K    = 24;
+  if (prach_fmt == 3) { 
+    K=4;
+    kbar=10;
+  }
+  else if (prach_fmt > 3) {
+    // Note: Assumes that PRACH SCS is same as PUSCH SCS
+    K=1;
+    kbar=2;
+  }
+  int n_ra_prb            = fp->prach_config_common.prach_ConfigInfo.msg1_frequencystart;
+  int k                   = (12*n_ra_prb) - 6*fp->N_RB_UL;
+
+  int N_ZC = (prach_fmt<4)?839:139;
+
+  if (k<0) k+=(fp->ofdm_symbol_size);
+  
+  k*=K;
+  k+=kbar; 
+  int reps=1;
+  int dftlen=0;
+
+  for (int aa=0; aa<ru->nb_rx; aa++) {
+    AssertFatal(prach[aa]!=NULL,"prach[%d] is null\n",aa);
+
+  
+    // do DFT
+    if (fp->N_RB_UL <= 100)
+      AssertFatal(1==0,"N_RB_UL %d not support for NR PRACH yet\n",fp->N_RB_UL);
+    else if (fp->N_RB_UL < 137) {
+      if (fp->threequarter_fs==0) { 
+	//40 MHz @ 61.44 Ms/s 
+	//50 MHz @ 61.44 Ms/s
+	prach2 = prach[aa] + (Ncp<<2);
+	if (prach_fmt == 0 || prach_fmt == 1 || prach_fmt == 2)
+	  dft49152(prach2,rxsigF[aa],1);
+	if (prach_fmt == 1 || prach_fmt == 2) {
+	  dft49152(prach2+98304,rxsigF[aa]+98304,1);
+	  reps++;
+	}
+	if (prach_fmt == 2) {
+	  dft49152(prach2+(98304*2),rxsigF[aa]+(98304*2),1);
+	  dft49152(prach2+(98304*3),rxsigF[aa]+(98304*3),1);
+	  reps+=2;
+	}
+	if (prach_fmt == 3) { 
+	  for (int i=0;i<4;i++) dft12288(prach2+(i*12288*2),rxsigF[aa]+(i*12288*2),1);
+	  reps=4;
+	}
+	if (prach_fmt >3) {
+	  dft2048(prach2,rxsigF[aa],1);
+	  if (prach_fmt != 0xc0) {
+	    dft2048(prach2+4096,rxsigF[aa]+4096,1);
+	    reps++;
+	  }
+	} 
+	if (prach_fmt == 0xa2 || prach_fmt == 0xa3 || prach_fmt == 0xb2 || prach_fmt == 0xb3 || prach_fmt == 0xb4 || prach_fmt == 0xc2) {     
+	  dft2048(prach2+4096*2,rxsigF[aa]+4096*2,1);
+	  dft2048(prach2+4096*3,rxsigF[aa]+4096*3,1);
+	  reps+=2;
+	} 
+	if (prach_fmt == 0xa3 || prach_fmt == 0xb3 || prach_fmt == 0xc2) {     
+	  dft2048(prach2+4096*4,rxsigF[aa]+4096*4,1);
+	  dft2048(prach2+4096*5,rxsigF[aa]+4096*5,1);
+	  reps+=2;
+	} 
+	if (prach_fmt == 0xc2) {
+	  for (int i=6;i<11;i++) dft2048(prach2+(3072*i),rxsigF[aa]+(3072*i),1);
+	  reps+=6;
+	}
+      } else {
+	//	40 MHz @ 46.08 Ms/s
+	prach2 = prach[aa] + (3*Ncp);
+	AssertFatal(fp->N_RB_UL <= 107,"cannot do 108..136 PRBs with 3/4 sampling\n");
+	if (prach_fmt == 0 || prach_fmt == 1 || prach_fmt == 2) {
+	  dft36864(prach2,rxsigF[aa],1);
+	  reps++;
+	}
+	if (prach_fmt == 1 || prach_fmt == 2) {
+	  dft36864(prach2+73728,rxsigF[aa]+73728,1);
+	  reps++;
+	}
+	if (prach_fmt == 2) {
+	  dft36864(prach2+(98304*2),rxsigF[aa]+(98304*2),1);
+	  dft36864(prach2+(98304*3),rxsigF[aa]+(98304*3),1);
+	  reps+=2;
+	}
+	if (prach_fmt == 3) {
+	  for (int i=0;i<4;i++) dft9216(prach2+(i*9216*2),rxsigF[aa]+(i*9216*2),1);
+	  reps=4;
+	}
+	if (prach_fmt >3) {
+	  dft1536(prach2,rxsigF[aa],1);
+	  if (prach_fmt != 0xc0) {
+	    dft1536(prach2+3072,rxsigF[aa]+3072,1);
+	    reps++;
+	  }
+	}  
+	if (prach_fmt == 0xa2 || prach_fmt == 0xa3 || prach_fmt == 0xb2 || prach_fmt == 0xb3 || prach_fmt == 0xb4 || prach_fmt == 0xc2) {     
+	  dft1536(prach2+3072*2,rxsigF[aa]+3072*2,1);
+	  dft1536(prach2+3072*3,rxsigF[aa]+3072*3,1);
+	  reps+=2;
+	} 
+	if (prach_fmt == 0xa3 || prach_fmt == 0xb3 || prach_fmt == 0xc2) {     
+	  dft1536(prach2+3072*4,rxsigF[aa]+3072*4,1);
+	  dft1536(prach2+3072*5,rxsigF[aa]+3072*5,1);
+	  reps+=2;
+	} 
+	if (prach_fmt == 0xc2) {
+	  for (int i=6;i<11;i++) dft1536(prach2+(3072*i),rxsigF[aa]+(3072*i),1);
+	  reps+=6;
+	}
+      }
+    }
+    else if (fp->N_RB_UL <= 273) {
+      if (fp->threequarter_fs==0) {
+	prach2 = prach[aa] + (Ncp<<3); 
+	dftlen=98304;
+	//80,90,100 MHz @ 61.44 Ms/s 
+	if (prach_fmt == 0 || prach_fmt == 1 || prach_fmt == 2)
+	  dft98304(prach2,rxsigF[aa],1);
+	if (prach_fmt == 1 || prach_fmt == 2) {
+	  dft98304(prach2+196608,rxsigF[aa]+196608,1);
+	  reps++;
+	}
+	if (prach_fmt == 1 || prach_fmt == 2) {
+	  dft98304(prach2+196608,rxsigF[aa]+196608,1);
+	  dft98304(prach2+(196608*2),rxsigF[aa]+(196608*2),1);
+	  reps+=2;
+	}
+	if (prach_fmt == 3) {
+	  dft24576(prach2+(2*49152),rxsigF[aa]+(2*49152),1);
+	  reps=4;
+	  dftlen=24576;
+	}
+	if (prach_fmt >3) {
+	  dftlen=4096;
+	  dft4096(prach2,rxsigF[aa],1);
+	  if (prach_fmt != 0xc0) { 
+	    dft4096(prach2+8192,rxsigF[aa]+8192,1);
+	    reps++;
+	  }
+	} 
+	if (prach_fmt == 0xa2 || prach_fmt == 0xa3 || prach_fmt == 0xb2 || prach_fmt == 0xb3 || prach_fmt == 0xb4 || prach_fmt == 0xc2) {     
+	  dft4096(prach2+8192*2,rxsigF[aa]+8192*2,1);
+	  dft4096(prach2+8192*3,rxsigF[aa]+8192*3,1);
+	  reps+=2;
+	} 
+	if (prach_fmt == 0xa3 || prach_fmt == 0xb3 || prach_fmt == 0xc2) {     
+	  dft4096(prach2+8192*4,rxsigF[aa]+8192*4,1);
+	  dft4096(prach2+8192*5,rxsigF[aa]+8192*5,1);
+	  reps+=2;
+	} 
+	if (prach_fmt == 0xc2) {
+	  for (int i=6;i<11;i++) dft4096(prach2+(8192*i),rxsigF[aa]+(8192*i),1);
+	  reps+=6;
+	}
+      } else {
+	AssertFatal(fp->N_RB_UL <= 217,"cannot do more than 217 PRBs with 3/4 sampling\n");
+	prach2 = prach[aa] + (6*Ncp);
+	//	80 MHz @ 46.08 Ms/s
+	dftlen=73728;
+	if (prach_fmt == 0 || prach_fmt == 1 || prach_fmt == 2) {
+	  dft73728(prach2,rxsigF[aa],1);
+	  reps++;
+	}
+	if (prach_fmt == 1 || prach_fmt == 2) {
+	  dft73728(prach2+(2*73728),rxsigF[aa]+(2*73728),1);
+	  reps++;
+	}
+	if (prach_fmt == 3) {
+	  dft73728(prach2+(4*73728),rxsigF[aa]+(4*73728),1);
+	  reps=4;
+	  dftlen=18432;
+	}
+
+	if (prach_fmt >3) {
+	  dftlen=3072;
+	  dft3072(prach2,rxsigF[aa],1);
+	  if (prach_fmt != 0xc0) {
+	    dft3072(prach2+6144,rxsigF[aa]+6144,1);
+	    reps++;
+	  }
+	} 
+	if (prach_fmt == 0xa2 || prach_fmt == 0xa3 || prach_fmt == 0xb2 || prach_fmt == 0xb3 || prach_fmt == 0xb4 || prach_fmt == 0xc2) {     
+	  dft3072(prach2+6144*2,rxsigF[aa]+6144*2,1);
+	  dft3072(prach2+6144*3,rxsigF[aa]+6144*3,1);
+	  reps+=2;
+	} 
+	if (prach_fmt == 0xa3 || prach_fmt == 0xb3 || prach_fmt == 0xc2) {     
+	  dft3072(prach2+6144*4,rxsigF[aa]+6144*4,1);
+	  dft3072(prach2+6144*5,rxsigF[aa]+6144*5,1);
+	  reps+=2;
+	} 
+	if (prach_fmt == 0xc2) {
+	  for (int i=6;i<11;i++) dft3072(prach2+(6144*i),rxsigF[aa]+(6144*i),1);
+	  reps+=6;
+	}
+      }
+    }
+
+    //Coherent combining of PRACH repetitions (assumes channel does not change, to be revisted for "long" PRACH)
+    int16_t rxsigF_tmp[N_ZC<<1];
+    //    if (k+N_ZC > dftlen) { // PRACH signal is split around DC 
+    int16_t *rxsigF2=rxsigF[aa];
+    int k2=k<<1;
+
+    for (int j=0;j<N_ZC<<1;j++,k2++) {
+      if (k2==(dftlen<<1)) k2=0;
+      rxsigF_tmp[j] = rxsigF2[k2];
+      for (int i=1;i<reps;i++) rxsigF_tmp[j] += rxsigF2[k2+(i*N_ZC<<1)];
+    }
+    memcpy((void*)rxsigF2,(void *)rxsigF_tmp,N_ZC<<2);
+
+  }
+
+}
+
+void rx_nr_prach(PHY_VARS_gNB *gNB,
+		 int frame,
+		 int subframe,
+		 uint16_t *max_preamble,
+		 uint16_t *max_preamble_energy,
+		 uint16_t *max_preamble_delay
+		 )
+{
+
+  int i;
+
+  NR_DL_FRAME_PARMS *fp;
+  lte_frame_type_t   frame_type;
+  uint16_t           rootSequenceIndex;  
+  uint8_t            prach_ConfigIndex;   
+  uint8_t            Ncs_config;          
+  uint8_t            restricted_set;      
+  uint8_t            n_ra_prb;
+  int16_t            *prachF=NULL;
+  int                nb_rx;
+
+  int16_t **rxsigF            = gNB->prach_vars.rxsigF;
+
+  uint8_t preamble_index;
+  uint16_t NCS=99,NCS2;
+  uint16_t preamble_offset=0,preamble_offset_old;
+  int16_t preamble_shift=0;
+  uint32_t preamble_shift2;
+  uint16_t preamble_index0=0,n_shift_ra=0,n_shift_ra_bar;
+  uint16_t d_start=0;
+  uint16_t numshift=0;
+  uint16_t *prach_root_sequence_map;
+  uint8_t not_found;
+  uint16_t u;
+  int16_t *Xu=0;
+  uint16_t offset;
+  uint16_t first_nonzero_root_idx=0;
+  uint8_t new_dft=0;
+  uint8_t aa;
+  int32_t lev;
+  int16_t levdB;
+  int log2_ifft_size=10;
+  int16_t prach_ifft_tmp[2048*2] __attribute__((aligned(32)));
+  int32_t *prach_ifft=(int32_t*)NULL;
+  
+  nr_frequency_range_e freq_range;
+
+  AssertFatal(gNB!=NULL,"Can only be called from gNB\n");
+  fp    = &gNB->frame_parms;
+  nb_rx = fp->nb_antennas_rx;
+  
+  frame_type          = fp->frame_type;
+  freq_range          = fp->freq_range;
+  rootSequenceIndex   = fp->prach_config_common.rootSequenceIndex;
+  prach_ConfigIndex   = fp->prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
+  Ncs_config          = fp->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig;
+  restricted_set      = fp->prach_config_common.prach_ConfigInfo.highSpeedFlag;
+   
+
+  uint8_t prach_fmt = get_nr_prach_fmt(prach_ConfigIndex,frame_type,freq_range);
+  uint16_t N_ZC = (prach_fmt <4)?839:139;
+
+  AssertFatal(gNB!=NULL,"gNB is null\n");
+
+  prach_ifft        = gNB->prach_vars.prach_ifft;
+  prachF            = gNB->prach_vars.prachF;
+  if (LOG_DEBUGFLAG(PRACH)){
+    if ((frame&1023) < 20) LOG_D(PHY,"PRACH (gNB) : running rx_prach for subframe %d, msg1_frequencystart %d, prach_ConfigIndex %d , rootSequenceIndex %d\n", subframe,fp->prach_config_common.prach_ConfigInfo.msg1_frequencystart,prach_ConfigIndex,rootSequenceIndex);
+  }
+
+
+
+
+
+
+  int restricted_Type = 0; //this is hardcoded ('0' for restricted_TypeA; and '1' for restricted_TypeB). FIXME
+  if (prach_fmt<3){
+    if (restricted_set == 0) {
+      NCS = NCS_unrestricted_delta_f_RA_125[Ncs_config];
+    } else {
+      if (restricted_Type == 0) NCS = NCS_restricted_TypeA_delta_f_RA_125[Ncs_config]; // for TypeA, this is hardcoded. FIXME
+      if (restricted_Type == 1) NCS = NCS_restricted_TypeB_delta_f_RA_125[Ncs_config]; // for TypeB, this is hardcoded. FIXME
+    }
+  }
+  if (prach_fmt==3){
+    if (restricted_set == 0) {
+      NCS = NCS_unrestricted_delta_f_RA_5[Ncs_config];
+    } else {
+      if (restricted_Type == 0) NCS = NCS_restricted_TypeA_delta_f_RA_5[Ncs_config]; // for TypeA, this is hardcoded. FIXME
+      if (restricted_Type == 1) NCS = NCS_restricted_TypeB_delta_f_RA_5[Ncs_config]; // for TypeB, this is hardcoded. FIXME
+    }
+  }
+  if (prach_fmt>3){
+    NCS = NCS_unrestricted_delta_f_RA_15[Ncs_config];
+  }
+
+  AssertFatal(NCS!=99,"NCS has not been set\n");
+
+  if (gNB) start_meas(&gNB->rx_prach);
+
+
+  prach_root_sequence_map = (prach_fmt<4) ? prach_root_sequence_map_0_3 : prach_root_sequence_map_abc;
+
+  // PDP is oversampled, e.g. 1024 sample instead of 839
+  // Adapt the NCS (zero-correlation zones) with oversampling factor e.g. 1024/839
+  NCS2 = (N_ZC==839) ? ((NCS<<10)/839) : ((NCS<<8)/139);
+
+  if (NCS2==0) NCS2 = N_ZC;
+
+
+  preamble_offset_old = 99;
+
+  
+  *max_preamble_energy=0;
+  for (preamble_index=0 ; preamble_index<64 ; preamble_index++) {
+
+    if (LOG_DEBUGFLAG(PRACH)){
+      int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],(N_ZC==839) ? 840: 140));
+      if (en>60) LOG_I(PHY,"frame %d, subframe %d : Trying preamble %d \n",frame,subframe,preamble_index);
+    }
+    if (restricted_set == 0) {
+      // This is the relative offset in the root sequence table (5.7.2-4 from 36.211) for the given preamble index
+      preamble_offset = ((NCS==0)? preamble_index : (preamble_index/(N_ZC/NCS)));
+      
+      if (preamble_offset != preamble_offset_old) {
+        preamble_offset_old = preamble_offset;
+        new_dft = 1;
+        // This is the \nu corresponding to the preamble index
+        preamble_shift  = 0;
+      }
+      
+      else {
+        preamble_shift  -= NCS;
+	
+        if (preamble_shift < 0)
+          preamble_shift+=N_ZC;
+      }
+    } else { // This is the high-speed case
+      new_dft = 0;
+
+      // set preamble_offset to initial rootSequenceIndex and look if we need more root sequences for this
+      // preamble index and find the corresponding cyclic shift
+      // Check if all shifts for that root have been processed
+      if (preamble_index0 == numshift) {
+        not_found = 1;
+        new_dft   = 1;
+        preamble_index0 -= numshift;
+        (preamble_offset==0 && numshift==0) ? (preamble_offset) : (preamble_offset++);
+
+        while (not_found == 1) {
+          // current root depending on rootSequenceIndex
+          int index = (rootSequenceIndex + preamble_offset) % N_ZC;
+
+	  if (prach_fmt<4) {
+	    // prach_root_sequence_map points to prach_root_sequence_map0_3
+	    DevAssert( index < sizeof(prach_root_sequence_map_0_3) / sizeof(prach_root_sequence_map_0_3[0]) );
+	  } else {
+	    // prach_root_sequence_map points to prach_root_sequence_map4
+	    DevAssert( index < sizeof(prach_root_sequence_map_abc) / sizeof(prach_root_sequence_map_abc[0]) );
+	  }
+	  u = prach_root_sequence_map[index];
+	  
+	  uint16_t n_group_ra = 0;
+	  
+	  if ( (nr_du[u]<(N_ZC/3)) && (nr_du[u]>=NCS) ) {
+	    n_shift_ra     = nr_du[u]/NCS;
+	    d_start        = (nr_du[u]<<1) + (n_shift_ra * NCS);
+	    n_group_ra     = N_ZC/d_start;
+	    n_shift_ra_bar = max(0,(N_ZC-(nr_du[u]<<1)-(n_group_ra*d_start))/N_ZC);
+	  } else if  ( (nr_du[u]>=(N_ZC/3)) && (nr_du[u]<=((N_ZC - NCS)>>1)) ) {
+	    n_shift_ra     = (N_ZC - (nr_du[u]<<1))/NCS;
+	    d_start        = N_ZC - (nr_du[u]<<1) + (n_shift_ra * NCS);
+	    n_group_ra     = nr_du[u]/d_start;
+	    n_shift_ra_bar = min(n_shift_ra,max(0,(nr_du[u]- (n_group_ra*d_start))/NCS));
+	  } else {
+	    n_shift_ra     = 0;
+	    n_shift_ra_bar = 0;
+	  }
+	  
+	  // This is the number of cyclic shifts for the current root u
+	  numshift = (n_shift_ra*n_group_ra) + n_shift_ra_bar;
+	  // skip to next root and recompute parameters if numshift==0
+	  (numshift>0) ? (not_found = 0) : (preamble_offset++);
+	}
+      }        
+      
+      
+      if (n_shift_ra>0)
+        preamble_shift = -((d_start * (preamble_index0/n_shift_ra)) + ((preamble_index0%n_shift_ra)*NCS)); // minus because the channel is h(t -\tau + Cv)
+      else
+        preamble_shift = 0;
+
+      if (preamble_shift < 0)
+        preamble_shift+=N_ZC;
+
+      preamble_index0++;
+
+      if (preamble_index == 0)
+        first_nonzero_root_idx = preamble_offset;
+    }
+
+    // Compute DFT of RX signal (conjugate input, results in conjugate output) for each new rootSequenceIndex
+    if (LOG_DEBUGFLAG(PRACH)) {
+      int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));
+      if (en>60) LOG_I(PHY,"frame %d, subframe %d : preamble index %d, NCS %d, NCS_config %d, N_ZC/NCS %d: offset %d, preamble shift %d , en %d)\n",
+		       frame,subframe,preamble_index,NCS,Ncs_config,N_ZC/NCS,preamble_offset,preamble_shift,en);
+    }
+
+    if (new_dft == 1) {
+      new_dft = 0;
+
+      Xu=(int16_t*)gNB->X_u[preamble_offset-first_nonzero_root_idx];
+      memset(prach_ifft,0,((N_ZC==839) ? 2048 : 256)*sizeof(int32_t));
+    
+
+      memset(prachF, 0, sizeof(int16_t)*2*1024 );
+      if (LOG_DUMPFLAG(PRACH)) {      
+	LOG_M("prach_rxF0.m","prach_rxF0",rxsigF[0],N_ZC,1,1);
+	LOG_M("prach_rxF1.m","prach_rxF1",rxsigF[1],6144,1,1);
+      }
+   
+      for (aa=0;aa<nb_rx; aa++) {
+	// Do componentwise product with Xu* on each antenna 
+
+	for (offset=0; offset<(N_ZC<<1); offset+=2) {
+	  prachF[offset]   = (int16_t)(((int32_t)Xu[offset]*rxsigF[aa][offset]   + (int32_t)Xu[offset+1]*rxsigF[aa][offset+1])>>15);
+	  prachF[offset+1] = (int16_t)(((int32_t)Xu[offset]*rxsigF[aa][offset+1] - (int32_t)Xu[offset+1]*rxsigF[aa][offset])>>15);
+	}
+	
+	// Now do IFFT of size 1024 (N_ZC=839) or 256 (N_ZC=139)
+	if (N_ZC == 839) {
+	  log2_ifft_size = 10;
+	  idft1024(prachF,prach_ifft_tmp,1);
+	  // compute energy and accumulate over receive antennas
+	  for (i=0;i<2048;i++)
+	    prach_ifft[i] += (prach_ifft_tmp[i<<1]*prach_ifft_tmp[i<<1] + prach_ifft_tmp[1+(i<<1)]*prach_ifft_tmp[1+(i<<1)])>>10;
+	} else {
+	  idft256(prachF,prach_ifft_tmp,1);
+	  log2_ifft_size = 8;
+	  // compute energy and accumulate over receive antennas and repetitions for BR
+	  for (i=0;i<256;i++)
+	    prach_ifft[i] += (prach_ifft_tmp[i<<1]*prach_ifft_tmp[(i<<1)] + prach_ifft_tmp[1+(i<<1)]*prach_ifft_tmp[1+(i<<1)])>>10;
+	}
+
+        if (LOG_DUMPFLAG(PRACH)) {	
+	  if (aa==0) LOG_M("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1);
+          if (aa==1) LOG_M("prach_rxF_comp1.m","prach_rxF_comp1",prachF,1024,1,1);
+        }
+      }// antennas_rx
+    } // new dft
+    
+    // check energy in nth time shift, for 
+
+    preamble_shift2 = ((preamble_shift==0) ? 0 : ((preamble_shift<<log2_ifft_size)/N_ZC));
+    
+    
+    for (i=0; i<NCS2; i++) {
+      lev = (int32_t)prach_ifft[(preamble_shift2+i)];
+      levdB = dB_fixed_times10(lev);
+      
+      if (levdB>*max_preamble_energy) {
+	*max_preamble_energy  = levdB;
+	*max_preamble_delay   = i; // Note: This has to be normalized to the 30.72 Ms/s sampling rate 
+	*max_preamble         = preamble_index;
+      }
+    }
+  }// preamble_index
+
+  if (LOG_DUMPFLAG(PRACH)) {
+    int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840));  
+    if (en>60) {
+      int k = (12*n_ra_prb) - 6*fp->N_RB_UL;
+      
+      if (k<0) k+=fp->ofdm_symbol_size;
+      
+      k*=12;
+      k+=13;
+      k*=2;
+      
+
+      LOG_M("rxsigF.m","prach_rxF",&rxsigF[0][0],12288,1,1);
+      LOG_M("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1);
+      LOG_M("Xu.m","xu",Xu,N_ZC,1,1);
+      LOG_M("prach_ifft0.m","prach_t0",prach_ifft,1024,1,1);
+    }
+  } /* LOG_DUMPFLAG(PRACH) */
+  if (gNB) stop_meas(&gNB->rx_prach);
+
+}
+
diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.h b/openair1/PHY/NR_TRANSPORT/nr_prach.h
new file mode 100644
index 00000000000..1e2b7580358
--- /dev/null
+++ b/openair1/PHY/NR_TRANSPORT/nr_prach.h
@@ -0,0 +1,891 @@
+/*
+ * 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/prach_common.c
+ * \brief Common routines for UE/eNB PRACH physical channel V8.6 2009-03
+ * \author Agustin Mico Pereperez
+ * \date 2018
+ * \version 0.1
+ * \company 
+ * \email: 
+ * \note
+ * \warning
+ */
+
+int16_t nr_ru[2*839]; // quantized roots of unity
+uint32_t nr_ZC_inv[839]; // multiplicative inverse for roots u
+uint16_t nr_du[838];
+
+/*************************************
+* The following tables defined for NR
+**************************************/
+// Table 6.3.3.1-5 (38.211) NCS for preamble formats with delta_f_RA = 1.25 KHz
+uint16_t NCS_unrestricted_delta_f_RA_125[16] = {0,13,15,18,22,26,32,38,46,59,76,93,119,167,279,419};
+uint16_t NCS_restricted_TypeA_delta_f_RA_125[15]   = {15,18,22,26,32,38,46,55,68,82,100,128,158,202,237}; // high-speed case set Type A
+uint16_t NCS_restricted_TypeB_delta_f_RA_125[13]   = {15,18,22,26,32,38,46,55,68,82,100,118,137}; // high-speed case set Type B
+
+// Table 6.3.3.1-6 (38.211) NCS for preamble formats with delta_f_RA = 5 KHz
+uint16_t NCS_unrestricted_delta_f_RA_5[16] = {0,13,26,33,38,41,49,55,64,76,93,119,139,209,279,419};
+uint16_t NCS_restricted_TypeA_delta_f_RA_5[16]   = {36,57,72,81,89,94,103,112,121,132,137,152,173,195,216,237}; // high-speed case set Type A
+uint16_t NCS_restricted_TypeB_delta_f_RA_5[14]   = {36,57,60,63,65,68,71,77,81,85,97,109,122,137}; // high-speed case set Type B
+
+// Table 6.3.3.1-7 (38.211) NCS for preamble formats with delta_f_RA = 15 * 2mu KHz where mu = {0,1,2,3}
+uint16_t NCS_unrestricted_delta_f_RA_15[16] = {0,2,4,6,8,10,12,13,15,17,19,23,27,34,46,69};
+
+//Table 6.3.3.1-3: Mapping from logical index i to sequence number u for preamble formats with L_RA = 839
+uint16_t prach_root_sequence_map_0_3[838] = {
+129, 710, 140, 699, 120, 719, 210, 629, 168, 671, 84 , 755, 105, 734, 93 , 746, 70 , 769, 60 , 779,
+2  , 837, 1  , 838, 56 , 783, 112, 727, 148, 691, 80 , 759, 42 , 797, 40 , 799, 35 , 804, 73 , 766,
+146, 693, 31 , 808, 28 , 811, 30 , 809, 27 , 812, 29 , 810, 24 , 815, 48 , 791, 68 , 771, 74 , 765,
+178, 661, 136, 703, 86 , 753, 78 , 761, 43 , 796, 39 , 800, 20 , 819, 21 , 818, 95 , 744, 202, 637,
+190, 649, 181, 658, 137, 702, 125, 714, 151, 688, 217, 622, 128, 711, 142, 697, 122, 717, 203, 636,
+118, 721, 110, 729, 89 , 750, 103, 736, 61 , 778, 55 , 784, 15 , 824, 14 , 825, 12 , 827, 23 , 816,
+34 , 805, 37 , 802, 46 , 793, 207, 632, 179, 660, 145, 694, 130, 709, 223, 616, 228, 611, 227, 612,
+132, 707, 133, 706, 143, 696, 135, 704, 161, 678, 201, 638, 173, 666, 106, 733, 83 , 756, 91 , 748,
+66 , 773, 53 , 786, 10 , 829, 9  , 830, 7  , 832, 8  , 831, 16 , 823, 47 , 792, 64 , 775, 57 , 782,
+104, 735, 101, 738, 108, 731, 208, 631, 184, 655, 197, 642, 191, 648, 121, 718, 141, 698, 149, 690,
+216, 623, 218, 621, 152, 687, 144, 695, 134, 705, 138, 701, 199, 640, 162, 677, 176, 663, 119, 720,
+158, 681, 164, 675, 174, 665, 171, 668, 170, 669, 87 , 752, 169, 670, 88 , 751, 107, 732, 81 , 758,
+82 , 757, 100, 739, 98 , 741, 71 , 768, 59 , 780, 65 , 774, 50 , 789, 49 , 790, 26 , 813, 17 , 822,
+13 , 826, 6  , 833, 5  , 834, 33 , 806, 51 , 788, 75 , 764, 99 , 740, 96 , 743, 97 , 742, 166, 673,
+172, 667, 175, 664, 187, 652, 163, 676, 185, 654, 200, 639, 114, 725, 189, 650, 115, 724, 194, 645,
+195, 644, 192, 647, 182, 657, 157, 682, 156, 683, 211, 628, 154, 685, 123, 716, 139, 700, 212, 627,
+153, 686, 213, 626, 215, 624, 150, 689, 225, 614, 224, 615, 221, 618, 220, 619, 127, 712, 147, 692,
+124, 715, 193, 646, 205, 634, 206, 633, 116, 723, 160, 679, 186, 653, 167, 672, 79 , 760, 85 , 754,
+77 , 762, 92 , 747, 58 , 781, 62 , 777, 69 , 770, 54 , 785, 36 , 803, 32 , 807, 25 , 814, 18 , 821,
+11 , 828, 4  , 835, 3  , 836, 19 , 820, 22 , 817, 41 , 798, 38 , 801, 44 , 795, 52 , 787, 45 , 794,
+63 , 776, 67 , 772, 72 , 767, 76 , 763, 94 , 745, 102, 737, 90 , 749, 109, 730, 165, 674, 111, 728,
+209, 630, 204, 635, 117, 722, 188, 651, 159, 680, 198, 641, 113, 726, 183, 656, 180, 659, 177, 662,
+196, 643, 155, 684, 214, 625, 126, 713, 131, 708, 219, 620, 222, 617, 226, 613, 230, 609, 232, 607,
+262, 577, 252, 587, 418, 421, 416, 423, 413, 426, 411, 428, 376, 463, 395, 444, 283, 556, 285, 554,
+379, 460, 390, 449, 363, 476, 384, 455, 388, 451, 386, 453, 361, 478, 387, 452, 360, 479, 310, 529,
+354, 485, 328, 511, 315, 524, 337, 502, 349, 490, 335, 504, 324, 515, 323, 516, 320, 519, 334, 505,
+359, 480, 295, 544, 385, 454, 292, 547, 291, 548, 381, 458, 399, 440, 380, 459, 397, 442, 369, 470,
+377, 462, 410, 429, 407, 432, 281, 558, 414, 425, 247, 592, 277, 562, 271, 568, 272, 567, 264, 575,
+259, 580, 237, 602, 239, 600, 244, 595, 243, 596, 275, 564, 278, 561, 250, 589, 246, 593, 417, 422,
+248, 591, 394, 445, 393, 446, 370, 469, 365, 474, 300, 539, 299, 540, 364, 475, 362, 477, 298, 541,
+312, 527, 313, 526, 314, 525, 353, 486, 352, 487, 343, 496, 327, 512, 350, 489, 326, 513, 319, 520,
+332, 507, 333, 506, 348, 491, 347, 492, 322, 517, 330, 509, 338, 501, 341, 498, 340, 499, 342, 497,
+301, 538, 366, 473, 401, 438, 371, 468, 408, 431, 375, 464, 249, 590, 269, 570, 238, 601, 234, 605,
+257, 582, 273, 566, 255, 584, 254, 585, 245, 594, 251, 588, 412, 427, 372, 467, 282, 557, 403, 436,
+396, 443, 392, 447, 391, 448, 382, 457, 389, 450, 294, 545, 297, 542, 311, 528, 344, 495, 345, 494,
+318, 521, 331, 508, 325, 514, 321, 518, 346, 493, 339, 500, 351, 488, 306, 533, 289, 550, 400, 439,
+378, 461, 374, 465, 415, 424, 270, 569, 241, 598, 231, 608, 260, 579, 268, 571, 276, 563, 409, 430,
+398, 441, 290, 549, 304, 535, 308, 531, 358, 481, 316, 523, 293, 546, 288, 551, 284, 555, 368, 471,
+253, 586, 256, 583, 263, 576, 242, 597, 274, 565, 402, 437, 383, 456, 357, 482, 329, 510, 317, 522,
+307, 532, 286, 553, 287, 552, 266, 573, 261, 578, 236, 603, 303, 536, 356, 483, 355, 484, 405, 434,
+404, 435, 406, 433, 235, 604, 267, 572, 302, 537, 309, 530, 265, 574, 233, 606, 367, 472, 296, 543,
+336, 503, 305, 534, 373, 466, 280, 559, 279, 560, 419, 420, 240, 599, 258, 581, 229, 610
+};
+// Table 6.3.3.1-4: Mapping from logical index i to sequence number u for preamble formats with L_RA = 139
+uint16_t prach_root_sequence_map_abc[138] = {
+1 , 138, 2 , 137, 3 , 136, 4 , 135, 5 , 134, 6 , 133, 7 , 132, 8 , 131, 9 , 130, 10, 129,
+11, 128, 12, 127, 13, 126, 14, 125, 15, 124, 16, 123, 17, 122, 18, 121, 19, 120, 20, 119,
+21, 118, 22, 117, 23, 116, 24, 115, 25, 114, 26, 113, 27, 112, 28, 111, 29, 110, 30, 109,
+31, 108, 32, 107, 33, 106, 34, 105, 35, 104, 36, 103, 37, 102, 38, 101, 39, 100, 40, 99 ,
+41, 98 , 42, 97 , 43, 96 , 44, 95 , 45, 94 , 46, 93 , 47, 92 , 48, 91 , 49, 90 , 50, 89 ,
+51, 88 , 52, 87 , 53, 86 , 54, 85 , 55, 84 , 56, 83 , 57, 82 , 58, 81 , 59, 80 , 60, 79 ,
+61, 78 , 62, 77 , 63, 76 , 64, 75 , 65, 74 , 66, 73 , 67, 72 , 68, 71 , 69, 70
+};
+
+// Table 6.3.3.2-2: Random access configurations for FR1 and paired spectrum/supplementary uplink
+// the column 5, (SFN_nbr is a bitmap where we set bit to '1' in the position of the subframe where the RACH can be sent.
+// E.g. in row 4, and column 5 we have set value 512 ('1000000000') which means RACH can be sent at subframe 9.
+// E.g. in row 20 and column 5 we have set value 66  ('0001000010') which means RACH can be sent at subframe 1 or 6
+int64_t table_6_3_3_2_2_prachConfig_Index [256][9] = {
+//format,   format,       x,          y,        SFN_nbr,   star_symb,   slots_sfn,    occ_slot,  duration
+{0,          -1,          16,         1,          2,          0,         -1,         -1,          0},          // (subframe number)           1
+{0,          -1,          16,         1,          16,         0,         -1,         -1,          0},          // (subframe number)           4
+{0,          -1,          16,         1,          128,        0,         -1,         -1,          0},          // (subframe number)           7
+{0,          -1,          16,         1,          512,        0,         -1,         -1,          0},          // (subframe number)           9
+{0,          -1,          8,          1,          2,          0,         -1,         -1,          0},          // (subframe number)           1
+{0,          -1,          8,          1,          16,         0,         -1,         -1,          0},          // (subframe number)           4
+{0,          -1,          8,          1,          128,        0,         -1,         -1,          0},          // (subframe number)           7
+{0,          -1,          8,          1,          512,        0,         -1,         -1,          0},          // (subframe number)           9
+{0,          -1,          4,          1,          2,          0,         -1,         -1,          0},          // (subframe number)           1
+{0,          -1,          4,          1,          16,         0,         -1,         -1,          0},          // (subframe number)           4
+{0,          -1,          4,          1,          128,        0,         -1,         -1,          0},          // (subframe number)           7
+{0,          -1,          4,          1,          512,        0,         -1,         -1,          0},          // (subframe number)           9
+{0,          -1,          2,          1,          2,          0,         -1,         -1,          0},          // (subframe number)           1
+{0,          -1,          2,          1,          16,         0,         -1,         -1,          0},          // (subframe number)           4
+{0,          -1,          2,          1,          128,        0,         -1,         -1,          0},          // (subframe number)           7
+{0,          -1,          2,          1,          512,        0,         -1,         -1,          0},          // (subframe number)           9
+{0,          -1,          1,          0,          2,          0,         -1,         -1,          0},          // (subframe number)           1
+{0,          -1,          1,          0,          16,         0,         -1,         -1,          0},          // (subframe number)           4
+{0,          -1,          1,          0,          128,        0,         -1,         -1,          0},          // (subframe number)           7
+{0,          -1,          1,          0,          66,         0,         -1,         -1,          0},          // (subframe number)           1,6
+{0,          -1,          1,          0,          132,        0,         -1,         -1,          0},          // (subframe number)           2,7
+{0,          -1,          1,          0,          264,        0,         -1,         -1,          0},          // (subframe number)           3,8
+{0,          -1,          1,          0,          146,        0,         -1,         -1,          0},          // (subframe number)           1,4,7
+{0,          -1,          1,          0,          292,        0,         -1,         -1,          0},          // (subframe number)           2,5,8
+{0,          -1,          1,          0,          584,        0,         -1,         -1,          0},          // (subframe number)           3, 6, 9
+{0,          -1,          1,          0,          341,        0,         -1,         -1,          0},          // (subframe number)           0,2,4,6,8
+{0,          -1,          1,          0,          682,        0,         -1,         -1,          0},          // (subframe number)           1,3,5,7,9
+{0,          -1,          1,          0,          1023,       0,         -1,         -1,          0},          // (subframe number)           0,1,2,3,4,5,6,7,8,9
+{1,          -1,          16,         1,          2,          0,         -1,         -1,          0},          // (subframe number)           1
+{1,          -1,          16,         1,          16,         0,         -1,         -1,          0},          // (subframe number)           4
+{1,          -1,          16,         1,          128,        0,         -1,         -1,          0},          // (subframe number)           7
+{1,          -1,          16,         1,          512,        0,         -1,         -1,          0},          // (subframe number)           9
+{1,          -1,          8,          1,          2,          0,         -1,         -1,          0},          // (subframe number)           1
+{1,          -1,          8,          1,          16,         0,         -1,         -1,          0},          // (subframe number)           4
+{1,          -1,          8,          1,          128,        0,         -1,         -1,          0},          // (subframe number)           7
+{1,          -1,          8,          1,          512,        0,         -1,         -1,          0},          // (subframe number)           9
+{1,          -1,          4,          1,          2,          0,         -1,         -1,          0},          // (subframe number)           1
+{1,          -1,          4,          1,          16,         0,         -1,         -1,          0},          // (subframe number)           4
+{1,          -1,          4,          1,          128,        0,         -1,         -1,          0},          // (subframe number)           7
+{1,          -1,          4,          1,          512,        0,         -1,         -1,          0},          // (subframe number)           9
+{1,          -1,          2,          1,          2,          0,         -1,         -1,          0},          // (subframe number)           1
+{1,          -1,          2,          1,          16,         0,         -1,         -1,          0},          // (subframe number)           4
+{1,          -1,          2,          1,          128,        0,         -1,         -1,          0},          // (subframe number)           7
+{1,          -1,          2,          1,          512,        0,         -1,         -1,          0},          // (subframe number)           9
+{1,          -1,          1,          0,          2,          0,         -1,         -1,          0},          // (subframe number)           1
+{1,          -1,          1,          0,          16,         0,         -1,         -1,          0},          // (subframe number)           4
+{1,          -1,          1,          0,          128,        0,         -1,         -1,          0},          // (subframe number)           7
+{1,          -1,          1,          0,          66,         0,         -1,         -1,          0},          // (subframe number)           1,6
+{1,          -1,          1,          0,          132,        0,         -1,         -1,          0},          // (subframe number)           2,7
+{1,          -1,          1,          0,          264,        0,         -1,         -1,          0},          // (subframe number)           3,8
+{1,          -1,          1,          0,          146,        0,         -1,         -1,          0},          // (subframe number)           1,4,7
+{1,          -1,          1,          0,          292,        0,         -1,         -1,          0},          // (subframe number)           2,5,8
+{1,          -1,          1,          0,          584,        0,         -1,         -1,          0},          // (subframe number)           3,6,9
+{2,          -1,          16,         1,          2,          0,         -1,         -1,          0},          // (subframe number)           1
+{2,          -1,          8,          1,          2,          0,         -1,         -1,          0},          // (subframe number)           1
+{2,          -1,          4,          0,          2,          0,         -1,         -1,          0},          // (subframe number)           1
+{2,          -1,          2,          0,          2,          0,         -1,         -1,          0},          // (subframe number)           1
+{2,          -1,          2,          0,          32,         0,         -1,         -1,          0},          // (subframe number)           5
+{2,          -1,          1,          0,          2,          0,         -1,         -1,          0},          // (subframe number)           1
+{2,          -1,          1,          0,          32,         0,         -1,         -1,          0},          // (subframe number)           5
+{3,          -1,          16,         1,          2,          0,         -1,         -1,          0},          // (subframe number)           1
+{3,          -1,          16,         1,          16,         0,         -1,         -1,          0},          // (subframe number)           4
+{3,          -1,          16,         1,          128,        0,         -1,         -1,          0},          // (subframe number)           7
+{3,          -1,          16,         1,          512,        0,         -1,         -1,          0},          // (subframe number)           9
+{3,          -1,          8,          1,          2,          0,         -1,         -1,          0},          // (subframe number)           1
+{3,          -1,          8,          1,          16,         0,         -1,         -1,          0},          // (subframe number)           4
+{3,          -1,          8,          1,          128,        0,         -1,         -1,          0},          // (subframe number)           7
+{3,          -1,          4,          1,          2,          0,         -1,         -1,          0},          // (subframe number)           1
+{3,          -1,          4,          1,          16,         0,         -1,         -1,          0},          // (subframe number)           4
+{3,          -1,          4,          1,          128,        0,         -1,         -1,          0},          // (subframe number)           7
+{3,          -1,          4,          1,          512,        0,         -1,         -1,          0},          // (subframe number)           9
+{3,          -1,          2,          1,          2,          0,         -1,         -1,          0},          // (subframe number)           1
+{3,          -1,          2,          1,          16,         0,         -1,         -1,          0},          // (subframe number)           4
+{3,          -1,          2,          1,          128,        0,         -1,         -1,          0},          // (subframe number)           7
+{3,          -1,          2,          1,          512,        0,         -1,         -1,          0},          // (subframe number)           9
+{3,          -1,          1,          0,          2,          0,         -1,         -1,          0},          // (subframe number)           1
+{3,          -1,          1,          0,          16,         0,         -1,         -1,          0},          // (subframe number)           4
+{3,          -1,          1,          0,          128,        0,         -1,         -1,          0},          // (subframe number)           7
+{3,          -1,          1,          0,          66,         0,         -1,         -1,          0},          // (subframe number)           1,6
+{3,          -1,          1,          0,          132,        0,         -1,         -1,          0},          // (subframe number)           2,7
+{3,          -1,          1,          0,          264,        0,         -1,         -1,          0},          // (subframe number)           3,8
+{3,          -1,          1,          0,          146,        0,         -1,         -1,          0},          // (subframe number)           1,4,7
+{3,          -1,          1,          0,          292,        0,         -1,         -1,          0},          // (subframe number)           2,5,8
+{3,          -1,          1,          0,          584,        0,         -1,         -1,          0},          // (subframe number)           3, 6, 9
+{3,          -1,          1,          0,          341,        0,         -1,         -1,          0},          // (subframe number)           0,2,4,6,8
+{3,          -1,          1,          0,          682,        0,         -1,         -1,          0},          // (subframe number)           1,3,5,7,9
+{3,          -1,          1,          0,          1023,       0,         -1,         -1,          0},          // (subframe number)           0,1,2,3,4,5,6,7,8,9
+{0xa1,       -1,          16,         0,          528,        0,          1,          6,          2},          // (subframe number)           4,9
+{0xa1,       -1,          16,         1,          16,         0,          2,          6,          2},          // (subframe number)           4
+{0xa1,       -1,          8,          0,          528,        0,          1,          6,          2},          // (subframe number)           4,9
+{0xa1,       -1,          8,          1,          16,         0,          2,          6,          2},          // (subframe number)           4
+{0xa1,       -1,          4,          0,          528,        0,          1,          6,          2},          // (subframe number)           4,9
+{0xa1,       -1,          4,          1,          528,        0,          1,          6,          2},          // (subframe number)           4,9
+{0xa1,       -1,          4,          0,          16,         0,          2,          6,          2},          // (subframe number)           4
+{0xa1,       -1,          2,          0,          528,        0,          1,          6,          2},          // (subframe number)           4,9
+{0xa1,       -1,          2,          0,          2,          0,          2,          6,          2},          // (subframe number)           1
+{0xa1,       -1,          2,          0,          16,         0,          2,          6,          2},          // (subframe number)           4
+{0xa1,       -1,          2,          0,          128,        0,          2,          6,          2},          // (subframe number)           7
+{0xa1,       -1,          1,          0,          16,         0,          1,          6,          2},          // (subframe number)           4
+{0xa1,       -1,          1,          0,          66,         0,          1,          6,          2},          // (subframe number)           1,6
+{0xa1,       -1,          1,          0,          528,        0,          1,          6,          2},          // (subframe number)           4,9
+{0xa1,       -1,          1,          0,          2,          0,          2,          6,          2},          // (subframe number)           1
+{0xa1,       -1,          1,          0,          128,        0,          2,          6,          2},          // (subframe number)           7
+{0xa1,       -1,          1,          0,          132,        0,          2,          6,          2},          // (subframe number)           2,7
+{0xa1,       -1,          1,          0,          146,        0,          2,          6,          2},          // (subframe number)           1,4,7
+{0xa1,       -1,          1,          0,          341,        0,          2,          6,          2},          // (subframe number)           0,2,4,6,8
+{0xa1,       -1,          1,          0,          1023,       0,          2,          6,          2},          // (subframe number)           0,1,2,3,4,5,6,7,8,9
+{0xa1,       -1,          1,          0,          682,        0,          2,          6,          2},          // (subframe number)           1,3,5,7,9
+{0xa1,       0xb1,        2,          0,          528,        0,          1,          7,          2},          // (subframe number)           4,9
+{0xa1,       0xb1,        2,          0,          16,         0,          2,          7,          2},          // (subframe number)           4
+{0xa1,       0xb1,        1,          0,          16,         0,          1,          7,          2},          // (subframe number)           4
+{0xa1,       0xb1,        1,          0,          66,         0,          1,          7,          2},          // (subframe number)           1,6
+{0xa1,       0xb1,        1,          0,          528,        0,          1,          7,          2},          // (subframe number)           4,9
+{0xa1,       0xb1,        1,          0,          2,          0,          2,          7,          2},          // (subframe number)           1
+{0xa1,       0xb1,        1,          0,          128,        0,          2,          7,          2},          // (subframe number)           7
+{0xa1,       0xb1,        1,          0,          146,        0,          2,          7,          2},          // (subframe number)           1,4,7
+{0xa1,       0xb1,        1,          0,          341,        0,          2,          7,          2},          // (subframe number)           0,2,4,6,8
+{0xa2,       -1,          16,         1,          580,        0,          1,          3,          4},          // (subframe number)           2,6,9
+{0xa2,       -1,          16,         1,          16,         0,          2,          3,          4},          // (subframe number)           4
+{0xa2,       -1,          8,          1,          580,        0,          1,          3,          4},          // (subframe number)           2,6,9
+{0xa2,       -1,          8,          1,          16,         0,          2,          3,          4},          // (subframe number)           4
+{0xa2,       -1,          4,          0,          580,        0,          1,          3,          4},          // (subframe number)           2,6,9
+{0xa2,       -1,          4,          0,          16,         0,          2,          3,          4},          // (subframe number)           4
+{0xa2,       -1,          2,          1,          580,        0,          1,          3,          4},          // (subframe number)           2,6,9
+{0xa2,       -1,          2,          0,          2,          0,          2,          3,          4},          // (subframe number)           1
+{0xa2,       -1,          2,          0,          16,         0,          2,          3,          4},          // (subframe number)           4
+{0xa2,       -1,          2,          0,          128,        0,          2,          3,          4},          // (subframe number)           7
+{0xa2,       -1,          1,          0,          16,         0,          1,          3,          4},          // (subframe number)           4
+{0xa2,       -1,          1,          0,          66,         0,          1,          3,          4},          // (subframe number)           1,6
+{0xa2,       -1,          1,          0,          528,        0,          1,          3,          4},          // (subframe number)           4,9
+{0xa2,       -1,          1,          0,          2,          0,          2,          3,          4},          // (subframe number)           1
+{0xa2,       -1,          1,          0,          128,        0,          2,          3,          4},          // (subframe number)           7
+{0xa2,       -1,          1,          0,          132,        0,          2,          3,          4},          // (subframe number)           2,7
+{0xa2,       -1,          1,          0,          146,        0,          2,          3,          4},          // (subframe number)           1,4,7
+{0xa2,       -1,          1,          0,          341,        0,          2,          3,          4},          // (subframe number)           0,2,4,6,8
+{0xa2,       -1,          1,          0,          1023,       0,          2,          3,          4},          // (subframe number)           0,1,2,3,4,5,6,7,8,9
+{0xa2,       -1,          1,          0,          682,        0,          2,          3,          4},          // (subframe number)           1,3,5,7,9
+{0xa2,       0xb2,        2,          1,          580,        0,          1,          3,          4},          // (subframe number)           2,6,9
+{0xa2,       0xb2,        2,          0,          16,         0,          2,          3,          4},          // (subframe number)           4
+{0xa2,       0xb2,        1,          0,          16,         0,          1,          3,          4},          // (subframe number)           4
+{0xa2,       0xb2,        1,          0,          66,         0,          1,          3,          4},          // (subframe number)           1,6
+{0xa2,       0xb2,        1,          0,          528,        0,          1,          3,          4},          // (subframe number)           4,9
+{0xa2,       0xb2,        1,          0,          2,          0,          2,          3,          4},          // (subframe number)           1
+{0xa2,       0xb2,        1,          0,          128,        0,          2,          3,          4},          // (subframe number)           7
+{0xa2,       0xb2,        1,          0,          146,        0,          2,          3,          4},          // (subframe number)           1,4,7
+{0xa2,       0xb2,        1,          0,          341,        0,          2,          3,          4},          // (subframe number)           0,2,4,6,8
+{0xa2,       0xb2,        1,          0,          1023,       0,          2,          3,          4},          // (subframe number)           0,1,2,3,4,5,6,7,8,9
+{0xa3,       -1,          16,         1,          528,        0,          1,          2,          6},          // (subframe number)           4,9
+{0xa3,       -1,          16,         1,          16,         0,          2,          2,          6},          // (subframe number)           4
+{0xa3,       -1,          8,          1,          528,        0,          1,          2,          6},          // (subframe number)           4,9
+{0xa3,       -1,          8,          1,          16,         0,          2,          2,          6},          // (subframe number)           4
+{0xa3,       -1,          4,          0,          528,        0,          1,          2,          6},          // (subframe number)           4,9
+{0xa3,       -1,          4,          0,          16,         0,          2,          2,          6},          // (subframe number)           4
+{0xa3,       -1,          2,          1,          580,        0,          2,          2,          6},          // (subframe number)           2,6,9
+{0xa3,       -1,          2,          0,          2,          0,          2,          2,          6},          // (subframe number)           1
+{0xa3,       -1,          2,          0,          16,         0,          2,          2,          6},          // (subframe number)           4
+{0xa3,       -1,          2,          0,          128,        0,          2,          2,          6},          // (subframe number)           7
+{0xa3,       -1,          1,          0,          16,         0,          1,          2,          6},          // (subframe number)           4
+{0xa3,       -1,          1,          0,          66,         0,          1,          2,          6},          // (subframe number)           1,6
+{0xa3,       -1,          1,          0,          528,        0,          1,          2,          6},          // (subframe number)           4,9
+{0xa3,       -1,          1,          0,          2,          0,          2,          2,          6},          // (subframe number)           1
+{0xa3,       -1,          1,          0,          128,        0,          2,          2,          6},          // (subframe number)           7
+{0xa3,       -1,          1,          0,          132,        0,          2,          2,          6},          // (subframe number)           2,7
+{0xa3,       -1,          1,          0,          146,        0,          2,          2,          6},          // (subframe number)           1,4,7
+{0xa3,       -1,          1,          0,          341,        0,          2,          2,          6},          // (subframe number)           0,2,4,6,8
+{0xa3,       -1,          1,          0,          1023,       0,          2,          2,          6},          // (subframe number)           0,1,2,3,4,5,6,7,8,9
+{0xa3,       -1,          1,          0,          682,        0,          2,          2,          6},          // (subframe number)           1,3,5,7,9
+{0xa3,       0xb3,        2,          1,          580,        0,          2,          2,          6},          // (subframe number)           2,6,9
+{0xa3,       0xb3,        2,          0,          16,         0,          2,          2,          6},          // (subframe number)           4
+{0xa3,       0xb3,        1,          0,          16,         0,          1,          2,          6},          // (subframe number)           4
+{0xa3,       0xb3,        1,          0,          66,         0,          1,          2,          6},          // (subframe number)           1,6
+{0xa3,       0xb3,        1,          0,          528,        0,          1,          2,          6},          // (subframe number)           4,9
+{0xa3,       0xb3,        1,          0,          2,          0,          2,          2,          6},          // (subframe number)           1
+{0xa3,       0xb3,        1,          0,          128,        0,          2,          2,          6},          // (subframe number)           7
+{0xa3,       0xb3,        1,          0,          146,        0,          2,          2,          6},          // (subframe number)           1,4,7
+{0xa3,       0xb3,        1,          0,          341,        0,          2,          2,          6},          // (subframe number)           0,2,4,6,8
+{0xa3,       0xb3,        1,          0,          1023,       0,          2,          2,          6},          // (subframe number)           0,1,2,3,4,5,6,7,8,9
+{0xb1,       -1,          16,         0,          528,        0,          1,          7,          2},          // (subframe number)           4,9
+{0xb1,       -1,          16,         1,          16,         0,          2,          7,          2},          // (subframe number)           4
+{0xb1,       -1,          8,          0,          528,        0,          1,          7,          2},          // (subframe number)           4,9
+{0xb1,       -1,          8,          1,          16,         0,          2,          7,          2},          // (subframe number)           4
+{0xb1,       -1,          4,          0,          528,        0,          1,          7,          2},          // (subframe number)           4,9
+{0xb1,       -1,          4,          1,          528,        0,          1,          7,          2},          // (subframe number)           4,9
+{0xb1,       -1,          4,          0,          16,         0,          2,          7,          2},          // (subframe number)           4
+{0xb1,       -1,          2,          0,          528,        0,          1,          7,          2},          // (subframe number)           4,9
+{0xb1,       -1,          2,          0,          2,          0,          2,          7,          2},          // (subframe number)           1
+{0xb1,       -1,          2,          0,          16,         0,          2,          7,          2},          // (subframe number)           4
+{0xb1,       -1,          2,          0,          128,        0,          2,          7,          2},          // (subframe number)           7
+{0xb1,       -1,          1,          0,          16,         0,          1,          7,          2},          // (subframe number)           4
+{0xb1,       -1,          1,          0,          66,         0,          1,          7,          2},          // (subframe number)           1,6
+{0xb1,       -1,          1,          0,          528,        0,          1,          7,          2},          // (subframe number)           4,9
+{0xb1,       -1,          1,          0,          2,          0,          2,          7,          2},          // (subframe number)           1
+{0xb1,       -1,          1,          0,          128,        0,          2,          7,          2},          // (subframe number)           7
+{0xb1,       -1,          1,          0,          132,        0,          2,          7,          2},          // (subframe number)           2,7
+{0xb1,       -1,          1,          0,          146,        0,          2,          7,          2},          // (subframe number)           1,4,7
+{0xb1,       -1,          1,          0,          341,        0,          2,          7,          2},          // (subframe number)           0,2,4,6,8
+{0xb1,       -1,          1,          0,          1023,       0,          2,          7,          2},          // (subframe number)           0,1,2,3,4,5,6,7,8,9
+{0xb1,       -1,          1,          0,          682,        0,          2,          7,          2},          // (subframe number)           1,3,5,7,9
+{0xb4,       -1,          16,         0,          528,        0,          2,          1,          12},         // (subframe number)           4,9
+{0xb4,       -1,          16,         1,          16,         0,          2,          1,          12},         // (subframe number)           4
+{0xb4,       -1,          8,          0,          528,        0,          2,          1,          12},         // (subframe number)           4,9
+{0xb4,       -1,          8,          1,          16,         0,          2,          1,          12},         // (subframe number)           4
+{0xb4,       -1,          4,          0,          528,        0,          2,          1,          12},         // (subframe number)           4,9
+{0xb4,       -1,          4,          0,          16,         0,          2,          1,          12},         // (subframe number)           4
+{0xb4,       -1,          4,          1,          528,        0,          2,          1,          12},         // (subframe number)           4,9
+{0xb4,       -1,          2,          0,          528,        0,          2,          1,          12},         // (subframe number)           4,9
+{0xb4,       -1,          2,          0,          2,          0,          2,          1,          12},         // (subframe number)           1
+{0xb4,       -1,          2,          0,          16,         0,          2,          1,          12},         // (subframe number)           4
+{0xb4,       -1,          2,          0,          128,        0,          2,          1,          12},         // (subframe number)           7
+{0xb4,       -1,          1,          0,          2,          0,          2,          1,          12},         // (subframe number)           1
+{0xb4,       -1,          1,          0,          16,         0,          2,          1,          12},         // (subframe number)           4
+{0xb4,       -1,          1,          0,          128,        0,          2,          1,          12},         // (subframe number)           7
+{0xb4,       -1,          1,          0,          66,         0,          2,          1,          12},         // (subframe number)           1,6
+{0xb4,       -1,          1,          0,          132,        0,          2,          1,          12},         // (subframe number)           2,7
+{0xb4,       -1,          1,          0,          528,        0,          2,          1,          12},         // (subframe number)           4,9
+{0xb4,       -1,          1,          0,          146,        0,          2,          1,          12},         // (subframe number)           1,4,7
+{0xb4,       -1,          1,          0,          341,        0,          2,          1,          12},         // (subframe number)           0,2,4,6,8
+{0xb4,       -1,          1,          0,          1023,       0,          2,          1,          12},         // (subframe number)           0,1,2,3,4,5,6,7,8,9
+{0xb4,       -1,          1,          0,          682,        0,          2,          1,          12},         // (subframe number)           1,3,5,7,9
+{0xc0,       -1,          8,          1,          16,         0,          2,          7,          2},          // (subframe number)           4
+{0xc0,       -1,          4,          1,          528,        0,          1,          7,          2},          // (subframe number)           4,9
+{0xc0,       -1,          4,          0,          16,         0,          2,          7,          2},          // (subframe number)           4
+{0xc0,       -1,          2,          0,          528,        0,          1,          7,          2},          // (subframe number)           4,9
+{0xc0,       -1,          2,          0,          2,          0,          2,          7,          2},          // (subframe number)           1
+{0xc0,       -1,          2,          0,          16,         0,          2,          7,          2},          // (subframe number)           4
+{0xc0,       -1,          2,          0,          128,        0,          2,          7,          2},          // (subframe number)           7
+{0xc0,       -1,          1,          0,          16,         0,          1,          7,          2},          // (subframe number)           4
+{0xc0,       -1,          1,          0,          66,         0,          1,          7,          2},          // (subframe number)           1,6
+{0xc0,       -1,          1,          0,          528,        0,          1,          7,          2},          // (subframe number)           4,9
+{0xc0,       -1,          1,          0,          2,          0,          2,          7,          2},          // (subframe number)           1
+{0xc0,       -1,          1,          0,          128,        0,          2,          7,          2},          // (subframe number)           7
+{0xc0,       -1,          1,          0,          132,        0,          2,          7,          2},          // (subframe number)           2,7
+{0xc0,       -1,          1,          0,          146,        0,          2,          7,          2},          // (subframe number)           1,4,7
+{0xc0,       -1,          1,          0,          341,        0,          2,          7,          2},          // (subframe number)           0,2,4,6,8
+{0xc0,       -1,          1,          0,          1023,       0,          2,          7,          2},          // (subframe number)           0,1,2,3,4,5,6,7,8,9
+{0xc0,       -1,          1,          0,          682,        0,          2,          7,          2},          // (subframe number)           1,3,5,7,9
+{0xc2,       -1,          16,         1,          528,        0,          1,          2,          6},          // (subframe number)           4,9
+{0xc2,       -1,          16,         1,          16,         0,          2,          2,          6},          // (subframe number)           4
+{0xc2,       -1,          8,          1,          528,        0,          1,          2,          6},          // (subframe number)           4,9
+{0xc2,       -1,          8,          1,          16,         0,          2,          2,          6},          // (subframe number)           4
+{0xc2,       -1,          4,          0,          528,        0,          1,          2,          6},          // (subframe number)           4,9
+{0xc2,       -1,          4,          0,          16,         0,          2,          2,          6},          // (subframe number)           4
+{0xc2,       -1,          2,          1,          580,        0,          2,          2,          6},          // (subframe number)           2,6,9
+{0xc2,       -1,          2,          0,          2,          0,          2,          2,          6},          // (subframe number)           1
+{0xc2,       -1,          2,          0,          16,         0,          2,          2,          6},          // (subframe number)           4
+{0xc2,       -1,          2,          0,          128,        0,          2,          2,          6},          // (subframe number)           7
+{0xc2,       -1,          1,          0,          16,         0,          1,          2,          6},          // (subframe number)           4
+{0xc2,       -1,          1,          0,          66,         0,          1,          2,          6},          // (subframe number)           1,6
+{0xc2,       -1,          1,          0,          528,        0,          1,          2,          6},          // (subframe number)           4,9
+{0xc2,       -1,          1,          0,          2,          0,          2,          2,          6},          // (subframe number)           1
+{0xc2,       -1,          1,          0,          128,        0,          2,          2,          6},          // (subframe number)           7
+{0xc2,       -1,          1,          0,          132,        0,          2,          2,          6},          // (subframe number)           2,7
+{0xc2,       -1,          1,          0,          146,        0,          2,          2,          6},          // (subframe number)           1,4,7
+{0xc2,       -1,          1,          0,          341,        0,          2,          2,          6},          // (subframe number)           0,2,4,6,8
+{0xc2,       -1,          1,          0,          1023,       0,          2,          2,          6},          // (subframe number)           0,1,2,3,4,5,6,7,8,9
+{0xc2,       -1,          1,          0,          682,        0,          2,          2,          6}                    // (subframe number)           1,3,5,7,9
+};
+// Table 6.3.3.2-3: Random access configurations for FR1 and unpaired spectrum
+int64_t table_6_3_3_2_3_prachConfig_Index [256][9] = {
+//format,     format,      x,         y,     SFN_nbr,   star_symb,   slots_sfn,  occ_slot,  duration
+{0,            -1,         16,        1,         512,         0,        -1,        -1,         0},         // (subrame number 9)
+{0,            -1,         8,         1,         512,         0,        -1,        -1,         0},         // (subrame number 9)
+{0,            -1,         4,         1,         512,         0,        -1,        -1,         0},         // (subrame number 9)
+{0,            -1,         2,         0,         512,         0,        -1,        -1,         0},         // (subrame number 9)
+{0,            -1,         2,         1,         512,         0,        -1,        -1,         0},         // (subrame number 9)
+{0,            -1,         2,         0,         16,          0,        -1,        -1,         0},         // (subrame number 4)
+{0,            -1,         2,         1,         16,          0,        -1,        -1,         0},         // (subrame number 4)
+{0,            -1,         1,         0,         512,         0,        -1,        -1,         0},         // (subrame number 9)
+{0,            -1,         1,         0,         256,         0,        -1,        -1,         0},         // (subrame number 8)
+{0,            -1,         1,         0,         128,         0,        -1,        -1,         0},         // (subrame number 7)
+{0,            -1,         1,         0,         64,          0,        -1,        -1,         0},         // (subrame number 6)
+{0,            -1,         1,         0,         32,          0,        -1,        -1,         0},         // (subrame number 5)
+{0,            -1,         1,         0,         16,          0,        -1,        -1,         0},         // (subrame number 4)
+{0,            -1,         1,         0,         8,           0,        -1,        -1,         0},         // (subrame number 3)
+{0,            -1,         1,         0,         4,           0,        -1,        -1,         0},         // (subrame number 2)
+{0,            -1,         1,         0,         66,          0,        -1,        -1,         0},         // (subrame number 1,6)
+{0,            -1,         1,         0,         66,          7,        -1,        -1,         0},         // (subrame number 1,6)
+{0,            -1,         1,         0,         528,         0,        -1,        -1,         0},         // (subrame number 4,9)
+{0,            -1,         1,         0,         264,         0,        -1,        -1,         0},         // (subrame number 3,8)
+{0,            -1,         1,         0,         132,         0,        -1,        -1,         0},         // (subrame number 2,7)
+{0,            -1,         1,         0,         768,         0,        -1,        -1,         0},         // (subrame number 8,9)
+{0,            -1,         1,         0,         784,         0,        -1,        -1,         0},         // (subrame number 4,8,9)
+{0,            -1,         1,         0,         536,         0,        -1,        -1,         0},         // (subrame number 3,4,9)
+{0,            -1,         1,         0,         896,         0,        -1,        -1,         0},         // (subrame number 7,8,9)
+{0,            -1,         1,         0,         792,         0,        -1,        -1,         0},         // (subrame number 3,4,8,9)
+{0,            -1,         1,         0,         960,         0,        -1,        -1,         0},         // (subrame number 6,7,8,9)
+{0,            -1,         1,         0,         594,         0,        -1,        -1,         0},         // (subrame number 1,4,6,9)
+{0,            -1,         1,         0,         682,         0,        -1,        -1,         0},         // (subrame number 1,3,5,7,9)
+{1,            -1,         16,        1,         128,         0,        -1,        -1,         0},         // (subrame number 7)
+{1,            -1,         8,         1,         128,         0,        -1,        -1,         0},         // (subrame number 7)
+{1,            -1,         4,         1,         128,         0,        -1,        -1,         0},         // (subrame number 7)
+{1,            -1,         2,         0,         128,         0,        -1,        -1,         0},         // (subrame number 7)
+{1,            -1,         2,         1,         128,         0,        -1,        -1,         0},         // (subrame number 7)
+{1,            -1,         1,         0,         128,         0,        -1,        -1,         0},         // (subrame number 7)
+{2,            -1,         16,        1,         64,          0,        -1,        -1,         0},         // (subrame number 6)
+{2,            -1,         8,         1,         64,          0,        -1,        -1,         0},         // (subrame number 6)
+{2,            -1,         4,         1,         64,          0,        -1,        -1,         0},         // (subrame number 6)
+{2,            -1,         2,         0,         64,          7,        -1,        -1,         0},         // (subrame number 6)
+{2,            -1,         2,         1,         64,          7,        -1,        -1,         0},         // (subrame number 6)
+{2,            -1,         1,         0,         64,          7,        -1,        -1,         0},         // (subrame number 6)
+{3,            -1,         16,        1,         512,         0,        -1,        -1,         0},         // (subrame number 9)
+{3,            -1,         8,         1,         512,         0,        -1,        -1,         0},         // (subrame number 9)
+{3,            -1,         4,         1,         512,         0,        -1,        -1,         0},         // (subrame number 9)
+{3,            -1,         2,         0,         512,         0,        -1,        -1,         0},         // (subrame number 9)
+{3,            -1,         2,         1,         512,         0,        -1,        -1,         0},         // (subrame number 9)
+{3,            -1,         2,         0,         16,          0,        -1,        -1,         0},         // (subrame number 4)
+{3,            -1,         2,         1,         16,          0,        -1,        -1,         0},         // (subrame number 4)
+{3,            -1,         1,         0,         512,         0,        -1,        -1,         0},         // (subrame number 9)
+{3,            -1,         1,         0,         256,         0,        -1,        -1,         0},         // (subrame number 8)
+{3,            -1,         1,         0,         128,         0,        -1,        -1,         0},         // (subrame number 7)
+{3,            -1,         1,         0,         64,          0,        -1,        -1,         0},         // (subrame number 6)
+{3,            -1,         1,         0,         32,          0,        -1,        -1,         0},         // (subrame number 5)
+{3,            -1,         1,         0,         16,          0,        -1,        -1,         0},         // (subrame number 4)
+{3,            -1,         1,         0,         8,           0,        -1,        -1,         0},         // (subrame number 3)
+{3,            -1,         1,         0,         4,           0,        -1,        -1,         0},         // (subrame number 2)
+{3,            -1,         1,         0,         66,          0,        -1,        -1,         0},         // (subrame number 1,6)
+{3,            -1,         1,         0,         66,          7,        -1,        -1,         0},         // (subrame number 1,6)
+{3,            -1,         1,         0,         528,         0,        -1,        -1,         0},         // (subrame number 4,9)
+{3,            -1,         1,         0,         264,         0,        -1,        -1,         0},         // (subrame number 3,8)
+{3,            -1,         1,         0,         132,         0,        -1,        -1,         0},         // (subrame number 2,7)
+{3,            -1,         1,         0,         768,         0,        -1,        -1,         0},         // (subrame number 8,9)
+{3,            -1,         1,         0,         784,         0,        -1,        -1,         0},         // (subrame number 4,8,9)
+{3,            -1,         1,         0,         536,         0,        -1,        -1,         0},         // (subrame number 3,4,9)
+{3,            -1,         1,         0,         896,         0,        -1,        -1,         0},         // (subrame number 7,8,9)
+{3,            -1,         1,         0,         792,         0,        -1,        -1,         0},         // (subrame number 3,4,8,9)
+{3,            -1,         1,         0,         594,         0,        -1,        -1,         0},         // (subrame number 1,4,6,9)
+{3,            -1,         1,         0,         682,         0,        -1,        -1,         0},         // (subrame number 1,3,5,7,9)
+{0xa1,         -1,         16,        1,         512,         0,         2,         6,         2},         // (subrame number 9)
+{0xa1,         -1,         8,         1,         512,         0,         2,         6,         2},         // (subrame number 9)
+{0xa1,         -1,         4,         1,         512,         0,         1,         6,         2},         // (subrame number 9)
+{0xa1,         -1,         2,         1,         512,         0,         1,         6,         2},         // (subrame number 9)
+{0xa1,         -1,         2,         1,         528,         7,         1,         3,         2},         // (subrame number 4,9)
+{0xa1,         -1,         2,         1,         640,         7,         1,         3,         2},         // (subrame number 7,9)
+{0xa1,         -1,         2,         1,         640,         0,         1,         6,         2},         // (subrame number 7,9)
+{0xa1,         -1,         2,         1,         768,         0,         2,         6,         2},         // (subrame number 8,9)
+{0xa1,         -1,         2,         1,         528,         0,         2,         6,         2},         // (subrame number 4,9)
+{0xa1,         -1,         2,         1,         924,         0,         1,         6,         2},         // (subrame number 2,3,4,7,8,9)
+{0xa1,         -1,         1,         0,         512,         0,         2,         6,         2},         // (subrame number 9)
+{0xa1,         -1,         1,         0,         512,         7,         1,         3,         2},         // (subrame number 9)
+{0xa1,         -1,         1,         0,         512,         0,         1,         6,         2},         // (subrame number 9)
+{0xa1,         -1,         1,         0,         768,         0,         2,         6,         2},         // (subrame number 8,9)
+{0xa1,         -1,         1,         0,         528,         0,         1,         6,         2},         // (subrame number 4,9)
+{0xa1,         -1,         1,         0,         640,         7,         1,         3,         2},         // (subrame number 7,9)
+{0xa1,         -1,         1,         0,         792,         0,         1,         6,         2},         // (subrame number 3,4,8,9)
+{0xa1,         -1,         1,         0,         792,         0,         2,         6,         2},         // (subrame number 3,4,8,9)
+{0xa1,         -1,         1,         0,         682,         0,         1,         6,         2},         // (subrame number 1,3,5,7,9)
+{0xa1,         -1,         1,         0,         1023,        7,         1,         3,         2},         // (subrame number 0,1,2,3,4,5,6,7,8,9)
+{0xa2,         -1,         16,        1,         512,         0,         2,         3,         4},         // (subrame number 9)
+{0xa2,         -1,         8,         1,         512,         0,         2,         3,         4},         // (subrame number 9)
+{0xa2,         -1,         4,         1,         512,         0,         1,         3,         4},         // (subrame number 9)
+{0xa2,         -1,         2,         1,         640,         0,         1,         3,         4},         // (subrame number 7,9)
+{0xa2,         -1,         2,         1,         768,         0,         2,         3,         4},         // (subrame number 8,9)
+{0xa2,         -1,         2,         1,         640,         9,         1,         1,         4},         // (subrame number 7,9)
+{0xa2,         -1,         2,         1,         528,         9,         1,         1,         4},         // (subrame number 4,9)
+{0xa2,         -1,         2,         1,         528,         0,         2,         3,         4},         // (subrame number 4,9)
+{0xa2,         -1,         16,        1,         924,         0,         1,         3,         4},         // (subrame number 2,3,4,7,8,9)
+{0xa2,         -1,         1,         0,         4,           0,         1,         3,         4},         // (subrame number 2)
+{0xa2,         -1,         1,         0,         128,         0,         1,         3,         4},         // (subrame number 7)
+{0xa2,         -1,         2,         1,         512,         0,         1,         3,         4},         // (subrame number 9)
+{0xa2,         -1,         1,         0,         512,         0,         2,         3,         4},         // (subrame number 9)
+{0xa2,         -1,         1,         0,         512,         9,         1,         1,         4},         // (subrame number 9)
+{0xa2,         -1,         1,         0,         512,         0,         1,         3,         4},         // (subrame number 9)
+{0xa2,         -1,         1,         0,         132,         0,         1,         3,         4},         // (subrame number 2,7)
+{0xa2,         -1,         1,         0,         768,         0,         2,         3,         4},         // (subrame number 8,9)
+{0xa2,         -1,         1,         0,         528,         0,         1,         3,         4},         // (subrame number 4,9)
+{0xa2,         -1,         1,         0,         640,         9,         1,         1,         4},         // (subrame number 7,9)
+{0xa2,         -1,         1,         0,         792,         0,         1,         3,         4},         // (subrame number 3,4,8,9)
+{0xa2,         -1,         1,         0,         792,         0,         2,         3,         4},         // (subrame number 3,4,8,9)
+{0xa2,         -1,         1,         0,         682,         0,         1,         3,         4},         // (subrame number 1,3,5,7,9)
+{0xa2,         -1,         1,         0,         1023,        9,         1,         1,         4},         // (subrame number 0,1,2,3,4,5,6,7,8,9)
+{0xa3,         -1,         16,        1,         512,         0,         2,         2,         6},         // (subrame number 9)
+{0xa3,         -1,         8,         1,         512,         0,         2,         2,         6},         // (subrame number 9)
+{0xa3,         -1,         4,         1,         512,         0,         1,         2,         6},         // (subrame number 9)
+{0xa3,         -1,         2,         1,         528,         7,         1,         1,         6},         // (subrame number 4,9)
+{0xa3,         -1,         2,         1,         640,         7,         1,         1,         6},         // (subrame number 7,9)
+{0xa3,         -1,         2,         1,         640,         0,         1,         2,         6},         // (subrame number 7,9)
+{0xa3,         -1,         2,         1,         528,         0,         2,         2,         6},         // (subrame number 4,9)
+{0xa3,         -1,         2,         1,         768,         0,         2,         2,         6},         // (subrame number 8,9)
+{0xa3,         -1,         2,         1,         924,         0,         1,         2,         6},         // (subrame number 2,3,4,7,8,9)
+{0xa3,         -1,         1,         0,         4,           0,         1,         2,         6},         // (subrame number 2)
+{0xa3,         -1,         1,         0,         128,         0,         1,         2,         6},         // (subrame number 7)
+{0xa3,         -1,         2,         1,         512,         0,         1,         2,         6},         // (subrame number 9)
+{0xa3,         -1,         1,         0,         512,         0,         2,         2,         6},         // (subrame number 9)
+{0xa3,         -1,         1,         0,         512,         7,         1,         1,         6},         // (subrame number 9)
+{0xa3,         -1,         1,         0,         512,         0,         1,         2,         6},         // (subrame number 9)
+{0xa3,         -1,         1,         0,         132,         0,         1,         2,         6},         // (subrame number 2,7)
+{0xa3,         -1,         1,         0,         768,         0,         2,         2,         6},         // (subrame number 8,9)
+{0xa3,         -1,         1,         0,         528,         0,         1,         2,         6},         // (subrame number 4,9)
+{0xa3,         -1,         1,         0,         640,         7,         1,         1,         6},         // (subrame number 7,9)
+{0xa3,         -1,         1,         0,         792,         0,         1,         2,         6},         // (subrame number 3,4,8,9)
+{0xa3,         -1,         1,         0,         792,         0,         2,         2,         6},         // (subrame number 3,4,8,9)
+{0xa3,         -1,         1,         0,         682,         0,         1,         2,         6},         // (subrame number 1,3,5,7,9)
+{0xa3,         -1,         1,         0,         1023,        7,         1,         1,         6},         // (subrame number 0,1,2,3,4,5,6,7,8,9)
+{0xb1,         -1,         4,         1,         512,         2,         1,         6,         2},         // (subrame number 9)
+{0xb1,         -1,         2,         1,         512,         2,         1,         6,         2},         // (subrame number 9)
+{0xb1,         -1,         2,         1,         640,         2,         1,         6,         2},         // (subrame number 7,9)
+{0xb1,         -1,         2,         1,         528,         8,         1,         3,         2},         // (subrame number 4,9)
+{0xb1,         -1,         2,         1,         528,         2,         2,         6,         2},         // (subrame number 4,9)
+{0xb1,         -1,         1,         0,         512,         2,         2,         6,         2},         // (subrame number 9)
+{0xb1,         -1,         1,         0,         512,         8,         1,         3,         2},         // (subrame number 9)
+{0xb1,         -1,         1,         0,         512,         2,         1,         6,         2},         // (subrame number 9)
+{0xb1,         -1,         1,         0,         768,         2,         2,         6,         2},         // (subrame number 8,9)
+{0xb1,         -1,         1,         0,         528,         2,         1,         6,         2},         // (subrame number 4,9)
+{0xb1,         -1,         1,         0,         640,         8,         1,         3,         2},         // (subrame number 7,9)
+{0xb1,         -1,         1,         0,         682,         2,         1,         6,         2},         // (subrame number 1,3,5,7,9)
+{0xb4,         -1,         16,        1,         512,         0,         2,         1,         12},        // (subrame number 9)
+{0xb4,         -1,         8,         1,         512,         0,         2,         1,         12},        // (subrame number 9)
+{0xb4,         -1,         4,         1,         512,         2,         1,         1,         12},        // (subrame number 9)
+{0xb4,         -1,         2,         1,         512,         0,         1,         1,         12},        // (subrame number 9)
+{0xb4,         -1,         2,         1,         512,         2,         1,         1,         12},        // (subrame number 9)
+{0xb4,         -1,         2,         1,         640,         2,         1,         1,         12},        // (subrame number 7,9)
+{0xb4,         -1,         2,         1,         528,         2,         1,         1,         12},        // (subrame number 4,9)
+{0xb4,         -1,         2,         1,         528,         0,         2,         1,         12},        // (subrame number 4,9)
+{0xb4,         -1,         2,         1,         768,         0,         2,         1,         12},        // (subrame number 8,9)
+{0xb4,         -1,         2,         1,         924,         0,         1,         1,         12},        // (subrame number 2,3,4,7,8,9)
+{0xb4,         -1,         1,         0,         2,           0,         1,         1,         12},        // (subrame number 1)
+{0xb4,         -1,         1,         0,         4,           0,         1,         1,         12},        // (subrame number 2)
+{0xb4,         -1,         1,         0,         16,          0,         1,         1,         12},        // (subrame number 4)
+{0xb4,         -1,         1,         0,         128,         0,         1,         1,         12},        // (subrame number 7)
+{0xb4,         -1,         1,         0,         512,         0,         1,         1,         12},        // (subrame number 9)
+{0xb4,         -1,         1,         0,         512,         2,         1,         1,         12},        // (subrame number 9)
+{0xb4,         -1,         1,         0,         512,         0,         2,         1,         12},        // (subrame number 9)
+{0xb4,         -1,         1,         0,         528,         2,         1,         1,         12},        // (subrame number 4,9)
+{0xb4,         -1,         1,         0,         640,         2,         1,         1,         12},        // (subrame number 7,9)
+{0xb4,         -1,         1,         0,         768,         0,         2,         1,         12},        // (subrame number 8,9)
+{0xb4,         -1,         1,         0,         792,         2,         1,         1,         12},        // (subrame number 3,4,8,9)
+{0xb4,         -1,         1,         0,         682,         2,         1,         1,         12},        // (subrame number 1,3,5,7,9)
+{0xb4,         -1,         1,         0,         1023,        0,         2,         1,         12},        // (subrame number 0,1,2,3,4,5,6,7,8,9)
+{0xb4,         -1,         1,         0,         1023,        2,         1,         1,         12},        // (subrame number 0,1,2,3,4,5,6,7,8,9)
+{0xc0,         -1,         16,        1,         512,         2,         2,         6,         2},         // (subrame number 9)
+{0xc0,         -1,         8,         1,         512,         2,         2,         6,         2},         // (subrame number 9)
+{0xc0,         -1,         4,         1,         512,         2,         1,         6,         2},         // (subrame number 9)
+{0xc0,         -1,         2,         1,         512,         2,         1,         6,         2},         // (subrame number 9)
+{0xc0,         -1,         2,         1,         768,         2,         2,         6,         2},         // (subrame number 8,9)
+{0xc0,         -1,         2,         1,         640,         2,         1,         6,         2},         // (subrame number 7,9)
+{0xc0,         -1,         2,         1,         640,         8,         1,         3,         2},         // (subrame number 7,9)
+{0xc0,         -1,         2,         1,         528,         8,         1,         3,         2},         // (subrame number 4,9)
+{0xc0,         -1,         2,         1,         528,         2,         2,         6,         2},         // (subrame number 4,9)
+{0xc0,         -1,         2,         1,         924,         2,         1,         6,         2},         // (subrame number 2,3,4,7,8,9)
+{0xc0,         -1,         1,         0,         512,         2,         2,         6,         2},         // (subrame number 9)
+{0xc0,         -1,         1,         0,         512,         8,         1,         3,         2},         // (subrame number 9)
+{0xc0,         -1,         1,         0,         512,         2,         1,         6,         2},         // (subrame number 9)
+{0xc0,         -1,         1,         0,         768,         2,         2,         6,         2},         // (subrame number 8,9)
+{0xc0,         -1,         1,         0,         528,         2,         1,         6,         2},         // (subrame number 4,9)
+{0xc0,         -1,         1,         0,         640,         8,         1,         3,         2},         // (subrame number 7,9)
+{0xc0,         -1,         1,         0,         792,         2,         1,         6,         2},         // (subrame number 3,4,8,9)
+{0xc0,         -1,         1,         0,         792,         2,         2,         6,         2},         // (subrame number 3,4,8,9)
+{0xc0,         -1,         1,         0,         682,         2,         1,         6,         2},         // (subrame number 1,3,5,7,9)
+{0xc0,         -1,         1,         0,         1023,        8,         1,         3,         2},         // (subrame number 0,1,2,3,4,5,6,7,8,9)
+{0xc2,         -1,         16,        1,         512,         2,         2,         2,         6},         // (subrame number 9)
+{0xc2,         -1,         8,         1,         512,         2,         2,         2,         6},         // (subrame number 9)
+{0xc2,         -1,         4,         1,         512,         2,         1,         2,         6},         // (subrame number 9)
+{0xc2,         -1,         2,         1,         512,         2,         1,         2,         6},         // (subrame number 9)
+{0xc2,         -1,         2,         1,         768,         2,         2,         2,         6},         // (subrame number 8,9)
+{0xc2,         -1,         2,         1,         640,         2,         1,         2,         6},         // (subrame number 7,9)
+{0xc2,         -1,         2,         1,         640,         8,         1,         1,         6},         // (subrame number 7,9)
+{0xc2,         -1,         2,         1,         528,         8,         1,         1,         6},         // (subrame number 4,9)
+{0xc2,         -1,         2,         1,         528,         2,         2,         2,         6},         // (subrame number 4,9)
+{0xc2,         -1,         2,         1,         924,         2,         1,         2,         6},         // (subrame number 2,3,4,7,8,9)
+{0xc2,         -1,         8,         1,         512,         8,         2,         1,         6},         // (subrame number 9)
+{0xc2,         -1,         4,         1,         512,         8,         1,         1,         6},         // (subrame number 9)
+{0xc2,         -1,         1,         0,         512,         2,         2,         2,         6},         // (subrame number 9)
+{0xc2,         -1,         1,         0,         512,         8,         1,         1,         6},         // (subrame number 9)
+{0xc2,         -1,         1,         0,         512,         2,         1,         2,         6},         // (subrame number 9)
+{0xc2,         -1,         1,         0,         768,         2,         2,         2,         6},         // (subrame number 8,9)
+{0xc2,         -1,         1,         0,         528,         2,         1,         2,         6},         // (subrame number 4,9)
+{0xc2,         -1,         1,         0,         640,         8,         1,         1,         6},         // (subrame number 7,9)
+{0xc2,         -1,         1,         0,         792,         2,         1,         2,         6},         // (subrame number 3,4,8,9)
+{0xc2,         -1,         1,         0,         792,         2,         2,         2,         6},         // (subrame number 3,4,8,9)
+{0xc2,         -1,         1,         0,         682,         2,         1,         2,         6},         // (subrame number 1,3,5,7,9)
+{0xc2,         -1,         1,         0,         1023,        8,         1,         1,         6},         // (subrame number 0,1,2,3,4,5,6,7,8,9)
+{0xa1,         0xb1,       2,         1,         512,         2,         1,         6,         2},         // (subrame number 9)
+{0xa1,         0xb1,       2,         1,         528,         8,         1,         3,         2},         // (subrame number 4,9)
+{0xa1,         0xb1,       2,         1,         640,         8,         1,         3,         2},         // (subrame number 7,9)
+{0xa1,         0xb1,       2,         1,         640,         2,         1,         6,         2},         // (subrame number 7,9)
+{0xa1,         0xb1,       2,         1,         528,         2,         2,         6,         2},         // (subrame number 4,9)
+{0xa1,         0xb1,       2,         1,         768,         2,         2,         6,         2},         // (subrame number 8,9)
+{0xa1,         0xb1,       1,         0,         512,         2,         2,         6,         2},         // (subrame number 9)
+{0xa1,         0xb1,       1,         0,         512,         8,         1,         3,         2},         // (subrame number 9)
+{0xa1,         0xb1,       1,         0,         512,         2,         1,         6,         2},         // (subrame number 9)
+{0xa1,         0xb1,       1,         0,         768,         2,         2,         6,         2},         // (subrame number 8,9)
+{0xa1,         0xb1,       1,         0,         528,         2,         1,         6,         2},         // (subrame number 4,9)
+{0xa1,         0xb1,       1,         0,         640,         8,         1,         3,         2},         // (subrame number 7,9)
+{0xa1,         0xb1,       1,         0,         792,         2,         2,         6,         2},         // (subrame number 3,4,8,9)
+{0xa1,         0xb1,       1,         0,         682,         2,         1,         6,         2},         // (subrame number 1,3,5,7,9)
+{0xa1,         0xb1,       1,         0,         1023,        8,         1,         3,         2},         // (subrame number 0,1,2,3,4,5,6,7,8,9)
+{0xa2,         0xb2,       2,         1,         512,         0,         1,         3,         4},         // (subrame number 9)
+{0xa2,         0xb2,       2,         1,         528,         6,         1,         2,         4},         // (subrame number 4,9)
+{0xa2,         0xb2,       2,         1,         640,         6,         1,         2,         4},         // (subrame number 7,9)
+{0xa2,         0xb2,       2,         1,         528,         0,         2,         3,         4},         // (subrame number 4,9)
+{0xa2,         0xb2,       2,         1,         768,         0,         2,         3,         4},         // (subrame number 8,9)
+{0xa2,         0xb2,       1,         0,         512,         0,         2,         3,         4},         // (subrame number 9)
+{0xa2,         0xb2,       1,         0,         512,         6,         1,         2,         4},         // (subrame number 9)
+{0xa2,         0xb2,       1,         0,         512,         0,         1,         3,         4},         // (subrame number 9)
+{0xa2,         0xb2,       1,         0,         768,         0,         2,         3,         4},         // (subrame number 8,9)
+{0xa2,         0xb2,       1,         0,         528,         0,         1,         3,         4},         // (subrame number 4,9)
+{0xa2,         0xb2,       1,         0,         640,         6,         1,         2,         4},         // (subrame number 7,9)
+{0xa2,         0xb2,       1,         0,         792,         0,         1,         3,         4},         // (subrame number 3,4,8,9)
+{0xa2,         0xb2,       1,         0,         792,         0,         2,         3,         4},         // (subrame number 3,4,8,9)
+{0xa2,         0xb2,       1,         0,         682,         0,         1,         3,         4},         // (subrame number 1,3,5,7,9)
+{0xa2,         0xb2,       1,         0,         1023,        6,         1,         2,         4},         // (subrame number 0,1,2,3,4,5,6,7,8,9)
+{0xa3,         0xb3,       2,         1,         512,         0,         1,         2,         6},         // (subrame number 9)
+{0xa3,         0xb3,       2,         1,         528,         2,         1,         2,         6},         // (subrame number 4,9)
+{0xa3,         0xb3,       2,         1,         640,         0,         1,         2,         6},         // (subrame number 7,9)
+{0xa3,         0xb3,       2,         1,         640,         2,         1,         2,         6},         // (subrame number 7,9)
+{0xa3,         0xb3,       2,         1,         528,         0,         2,         2,         6},         // (subrame number 4,9)
+{0xa3,         0xb3,       2,         1,         768,         0,         2,         2,         6},         // (subrame number 8,9)
+{0xa3,         0xb3,       1,         0,         512,         0,         2,         2,         6},         // (subrame number 9)
+{0xa3,         0xb3,       1,         0,         512,         2,         1,         2,         6},         // (subrame number 9)
+{0xa3,         0xb3,       1,         0,         512,         0,         1,         2,         6},         // (subrame number 9)
+{0xa3,         0xb3,       1,         0,         768,         0,         2,         2,         6},         // (subrame number 8,9)
+{0xa3,         0xb3,       1,         0,         528,         0,         1,         2,         6},         // (subrame number 4,9)
+{0xa3,         0xb3,       1,         0,         640,         2,         1,         2,         6},         // (subrame number 7,9)
+{0xa3,         0xb3,       1,         0,         792,         0,         2,         2,         6},         // (subrame number 3,4,8,9)
+{0xa3,         0xb3,       1,         0,         682,         0,         1,         2,         6},         // (subrame number 1,3,5,7,9)
+{0xa3,         0xb3,       1,         0,         1023,        2,         1,         2,         6}          // (subrame number 0,1,2,3,4,5,6,7,8,9)
+};
+// Table 6.3.3.2-4: Random access configurations for FR2 and unpaired spectrum
+int64_t table_6_3_3_2_4_prachConfig_Index [256][10] = {
+//format,      format,       x,          y,           y,              SFN_nbr,       star_symb,   slots_sfn,  occ_slot,  duration
+{0xa1,          -1,          16,         1,          -1,          567489872400,          0,          2,          6,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa1,          -1,          16,         1,          -1,          586406201480,          0,          1,          6,          2},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa1,          -1,          8,          1,           2,          550293209600,          0,          2,          6,          2},          // (subframe number :9,19,29,39)
+{0xa1,          -1,          8,          1,          -1,          567489872400,          0,          2,          6,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa1,          -1,          8,          1,          -1,          586406201480,          0,          1,          6,          2},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa1,          -1,          4,          1,          -1,          567489872400,          0,          1,          6,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa1,          -1,          4,          1,          -1,          567489872400,          0,          2,          6,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa1,          -1,          4,          1,          -1,          586406201480,          0,          1,          6,          2},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa1,          -1,          2,          1,          -1,          551911719040,          0,          2,          6,          2},          // (subframe number :7,15,23,31,39)
+{0xa1,          -1,          2,          1,          -1,          567489872400,          0,          1,          6,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa1,          -1,          2,          1,          -1,          567489872400,          0,          2,          6,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa1,          -1,          2,          1,          -1,          586406201480,          0,          1,          6,          2},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa1,          -1,          1,          0,          -1,          549756338176,          7,          1,          3,          2},          // (subframe number :19,39)
+{0xa1,          -1,          1,          0,          -1,          168,                   0,          1,          6,          2},          // (subframe number :3,5,7)
+{0xa1,          -1,          1,          0,          -1,          567489331200,          7,          1,          3,          2},          // (subframe number :24,29,34,39)
+{0xa1,          -1,          1,          0,          -1,          550293209600,          7,          2,          3,          2},          // (subframe number :9,19,29,39)
+{0xa1,          -1,          1,          0,          -1,          687195422720,          0,          1,          6,          2},          // (subframe number :17,19,37,39)
+{0xa1,          -1,          1,          0,          -1,          550293209600,          0,          2,          6,          2},          // (subframe number :9,19,29,39)
+{0xa1,          -1,          1,          0,          -1,          567489872400,          0,          1,          6,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa1,          -1,          1,          0,          -1,          567489872400,          7,          1,          3,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa1,          -1,          1,          0,          -1,          10920,                 7,          1,          3,          2},          // (subframe number :3,5,7,9,11,13)
+{0xa1,          -1,          1,          0,          -1,          586405642240,          7,          1,          3,          2},          // (subframe number :23,27,31,35,39)
+{0xa1,          -1,          1,          0,          -1,          551911719040,          0,          1,          6,          2},          // (subframe number :7,15,23,31,39)
+{0xa1,          -1,          1,          0,          -1,          586405642240,          0,          1,          6,          2},          // (subframe number :23,27,31,35,39)
+{0xa1,          -1,          1,          0,          -1,          965830828032,          7,          2,          3,          2},          // (subframe number :13,14,15, 29,30,31,37,38,39)
+{0xa1,          -1,          1,          0,          -1,          586406201480,          7,          1,          3,          2},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa1,          -1,          1,          0,          -1,          586406201480,          0,          1,          6,          2},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa1,          -1,          1,          0,          -1,          733007751850,          0,          1,          6,          2},          // (subframe number :1,3,5,7,…,37,39)
+{0xa1,          -1,          1,          0,          -1,          1099511627775,         7,          1,          3,          2},          // (subframe number :0,1,2,…,39)
+{0xa2,          -1,          16,         1,          -1,          567489872400,          0,          2,          3,          4},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa2,          -1,          16,         1,          -1,          586406201480,          0,          1,          3,          4},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa2,          -1,          8,          1,          -1,          567489872400,          0,          2,          3,          4},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa2,          -1,          8,          1,          -1,          586406201480,          0,          1,          3,          4},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa2,          -1,          8,          1,           2,          550293209600,          0,          2,          3,          4},          // (subframe number :9,19,29,39)
+{0xa2,          -1,          4,          1,          -1,          567489872400,          0,          1,          3,          4},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa2,          -1,          4,          1,          -1,          567489872400,          0,          2,          3,          4},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa2,          -1,          4,          1,          -1,          586406201480,          0,          1,          3,          4},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa2,          -1,          2,          1,          -1,          551911719040,          0,          2,          3,          4},          // (subframe number :7,15,23,31,39)
+{0xa2,          -1,          2,          1,          -1,          567489872400,          0,          1,          3,          4},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa2,          -1,          2,          1,          -1,          567489872400,          0,          2,          3,          4},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa2,          -1,          2,          1,          -1,          586406201480,          0,          1,          3,          4},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa2,          -1,          1,          0,          -1,          549756338176,          5,          1,          2,          4},          // (subframe number :19,39)
+{0xa2,          -1,          1,          0,          -1,          168,                   0,          1,          3,          4},          // (subframe number :3,5,7)
+{0xa2,          -1,          1,          0,          -1,          567489331200,          5,          1,          2,          4},          // (subframe number :24,29,34,39)
+{0xa2,          -1,          1,          0,          -1,          550293209600,          5,          2,          2,          4},          // (subframe number :9,19,29,39)
+{0xa2,          -1,          1,          0,          -1,          687195422720,          0,          1,          3,          4},          // (subframe number :17,19,37,39)
+{0xa2,          -1,          1,          0,          -1,          550293209600,          0,          2,          3,          4},          // (subframe number :9, 19, 29, 39)
+{0xa2,          -1,          1,          0,          -1,          551911719040,          0,          1,          3,          4},          // (subframe number :7,15,23,31,39)
+{0xa2,          -1,          1,          0,          -1,          586405642240,          5,          1,          2,          4},          // (subframe number :23,27,31,35,39)
+{0xa2,          -1,          1,          0,          -1,          586405642240,          0,          1,          3,          4},          // (subframe number :23,27,31,35,39)
+{0xa2,          -1,          1,          0,          -1,          10920,                 5,          1,          2,          4},          // (subframe number :3,5,7,9,11,13)
+{0xa2,          -1,          1,          0,          -1,          10920,                 0,          1,          3,          4},          // (subframe number :3,5,7,9,11,13)
+{0xa2,          -1,          1,          0,          -1,          567489872400,          5,          1,          2,          4},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa2,          -1,          1,          0,          -1,          567489872400,          0,          1,          3,          4},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa2,          -1,          1,          0,          -1,          965830828032,          5,          2,          2,          4},          // (subframe number :13,14,15, 29,30,31,37,38,39)
+{0xa2,          -1,          1,          0,          -1,          586406201480,          5,          1,          2,          4},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa2,          -1,          1,          0,          -1,          586406201480,          0,          1,          3,          4},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa2,          -1,          1,          0,          -1,          733007751850,          0,          1,          3,          4},          // (subframe number :1,3,5,7,…,37,39)
+{0xa2,          -1,          1,          0,          -1,          1099511627775,         5,          1,          2,          4},          // (subframe number :0,1,2,…,39)
+{0xa3,          -1,          16,         1,          -1,          567489872400,          0,          2,          2,          6},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa3,          -1,          16,         1,          -1,          586406201480,          0,          1,          2,          6},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa3,          -1,          8,          1,          -1,          567489872400,          0,          2,          2,          6},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa3,          -1,          8,          1,          -1,          586406201480,          0,          1,          2,          6},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa3,          -1,          8,          1,           2,          550293209600,          0,          2,          2,          6},          // (subframe number :9,19,29,39)
+{0xa3,          -1,          4,          1,          -1,          567489872400,          0,          1,          2,          6},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa3,          -1,          4,          1,          -1,          567489872400,          0,          2,          2,          6},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa3,          -1,          4,          1,          -1,          586406201480,          0,          1,          2,          6},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa3,          -1,          2,          1,          -1,          567489872400,          0,          1,          2,          6},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa3,          -1,          2,          1,          -1,          567489872400,          0,          2,          2,          6},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa3,          -1,          2,          1,          -1,          586406201480,          0,          1,          2,          6},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa3,          -1,          1,          0,          -1,          549756338176,          7,          1,          1,          6},          // (subframe number :19,39)
+{0xa3,          -1,          1,          0,          -1,          168,                   0,          1,          2,          6},          // (subframe number :3,5,7)
+{0xa3,          -1,          1,          0,          -1,          10752,                 2,          1,          2,          6},          // (subframe number :9,11,13)
+{0xa3,          -1,          1,          0,          -1,          567489331200,          7,          1,          1,          6},          // (subframe number :24,29,34,39)
+{0xa3,          -1,          1,          0,          -1,          550293209600,          7,          2,          1,          6},          // (subframe number :9,19,29,39)
+{0xa3,          -1,          1,          0,          -1,          687195422720,          0,          1,          2,          6},          // (subframe number :17,19,37,39)
+{0xa3,          -1,          1,          0,          -1,          550293209600,          0,          2,          2,          6},          // (subframe number :9,19,29,39)
+{0xa3,          -1,          1,          0,          -1,          551911719040,          0,          1,          2,          6},          // (subframe number :7,15,23,31,39)
+{0xa3,          -1,          1,          0,          -1,          586405642240,          7,          1,          1,          6},          // (subframe number :23,27,31,35,39)
+{0xa3,          -1,          1,          0,          -1,          586405642240,          0,          1,          2,          6},          // (subframe number :23,27,31,35,39)
+{0xa3,          -1,          1,          0,          -1,          10920,                 0,          1,          2,          6},          // (subframe number :3,5,7,9,11,13)
+{0xa3,          -1,          1,          0,          -1,          10920,                 7,          1,          1,          6},          // (subframe number :3,5,7,9,11,13)
+{0xa3,          -1,          1,          0,          -1,          567489872400,          0,          1,          2,          6},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa3,          -1,          1,          0,          -1,          567489872400,          7,          1,          1,          6},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa3,          -1,          1,          0,          -1,          965830828032,          7,          2,          1,          6},          // (subframe number :13,14,15, 29,30,31,37,38,39)
+{0xa3,          -1,          1,          0,          -1,          586406201480,          7,          1,          1,          6},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa3,          -1,          1,          0,          -1,          586406201480,          0,          1,          2,          6},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa3,          -1,          1,          0,          -1,          733007751850,          0,          1,          2,          6},          // (subframe number :1,3,5,7,…,37,39)
+{0xa3,          -1,          1,          0,          -1,          1099511627775,         7,          1,          1,          6},          // (subframe number :0,1,2,…,39)
+{0xb1,          -1,          16,         1,          -1,          567489872400,          2,          2,          6,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xb1,          -1,          8,          1,          -1,          567489872400,          2,          2,          6,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xb1,          -1,          8,          1,           2,          550293209600,          2,          2,          6,          2},          // (subframe number :9,19,29,39)
+{0xb1,          -1,          4,          1,          -1,          567489872400,          2,          2,          6,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xb1,          -1,          2,          1,          -1,          567489872400,          2,          2,          6,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xb1,          -1,          2,          1,          -1,          586406201480,          2,          1,          6,          2},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xb1,          -1,          1,          0,          -1,          549756338176,          8,          1,          3,          2},          // (subframe number :19,39)
+{0xb1,          -1,          1,          0,          -1,          168,                   2,          1,          6,          2},          // (subframe number :3,5,7)
+{0xb1,          -1,          1,          0,          -1,          567489331200,          8,          1,          3,          2},          // (subframe number :24,29,34,39)
+{0xb1,          -1,          1,          0,          -1,          550293209600,          8,          2,          3,          2},          // (subframe number :9,19,29,39)
+{0xb1,          -1,          1,          0,          -1,          687195422720,          2,          1,          6,          2},          // (subframe number :17,19,37,39)
+{0xb1,          -1,          1,          0,          -1,          550293209600,          2,          2,          6,          2},          // (subframe number :9,19,29,39)
+{0xb1,          -1,          1,          0,          -1,          551911719040,          2,          1,          6,          2},          // (subframe number :7,15,23,31,39)
+{0xb1,          -1,          1,          0,          -1,          586405642240,          8,          1,          3,          2},          // (subframe number :23,27,31,35,39)
+{0xb1,          -1,          1,          0,          -1,          586405642240,          2,          1,          6,          2},          // (subframe number :23,27,31,35,39)
+{0xb1,          -1,          1,          0,          -1,          10920,                 8,          1,          3,          2},          // (subframe number :3,5,7,9,11,13)
+{0xb1,          -1,          1,          0,          -1,          567489872400,          8,          1,          3,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xb1,          -1,          1,          0,          -1,          567489872400,          2,          1,          6,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xb1,          -1,          1,          0,          -1,          586406201480,          8,          1,          3,          2},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xb1,          -1,          1,          0,          -1,          965830828032,          8,          2,          3,          2},          // (subframe number :13,14,15, 29,30,31,37,38,39)
+{0xb1,          -1,          1,          0,          -1,          586406201480,          2,          1,          6,          2},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xb1,          -1,          1,          0,          -1,          733007751850,          2,          1,          6,          2},          // (subframe number :1,3,5,7,…,37,39)
+{0xb1,          -1,          1,          0,          -1,          1099511627775,         8,          1,          3,          2},          // (subframe number :0,1,2,…,39)
+{0xb4,          -1,          16,         1,           2,          567489872400,          0,          2,          1,          12},         // (subframe number :4,9,14,19,24,29,34,39)
+{0xb4,          -1,          16,         1,           2,          586406201480,          0,          1,          1,          12},         // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xb4,          -1,          8,          1,           2,          567489872400,          0,          2,          1,          12},         // (subframe number :4,9,14,19,24,29,34,39)
+{0xb4,          -1,          8,          1,           2,          586406201480,          0,          1,          1,          12},         // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xb4,          -1,          8,          1,           2,          550293209600,          0,          2,          1,          12},         // (subframe number :9,19,29,39)
+{0xb4,          -1,          4,          1,          -1,          567489872400,          0,          1,          1,          12},         // (subframe number :4,9,14,19,24,29,34,39)
+{0xb4,          -1,          4,          1,          -1,          567489872400,          0,          2,          1,          12},         // (subframe number :4,9,14,19,24,29,34,39)
+{0xb4,          -1,          4,          1,           2,          586406201480,          0,          1,          1,          12},         // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xb4,          -1,          2,          1,          -1,          551911719040,          2,          2,          1,          12},         // (subframe number :7,15,23,31,39)
+{0xb4,          -1,          2,          1,          -1,          567489872400,          0,          1,          1,          12},         // (subframe number :4,9,14,19,24,29,34,39)
+{0xb4,          -1,          2,          1,          -1,          567489872400,          0,          2,          1,          12},         // (subframe number :4,9,14,19,24,29,34,39)
+{0xb4,          -1,          2,          1,          -1,          586406201480,          0,          1,          1,          12},         // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xb4,          -1,          1,          0,          -1,          549756338176,          2,          2,          1,          12},         // (subframe number :19, 39)
+{0xb4,          -1,          1,          0,          -1,          687195422720,          0,          1,          1,          12},         // (subframe number :17, 19, 37, 39)
+{0xb4,          -1,          1,          0,          -1,          567489331200,          2,          1,          1,          12},         // (subframe number :24,29,34,39)
+{0xb4,          -1,          1,          0,          -1,          550293209600,          2,          2,          1,          12},         // (subframe number :9,19,29,39)
+{0xb4,          -1,          1,          0,          -1,          550293209600,          0,          2,          1,          12},         // (subframe number :9,19,29,39)
+{0xb4,          -1,          1,          0,          -1,          551911719040,          0,          1,          1,          12},         // (subframe number :7,15,23,31,39)
+{0xb4,          -1,          1,          0,          -1,          551911719040,          0,          2,          1,          12},         // (subframe number :7,15,23,31,39)
+{0xb4,          -1,          1,          0,          -1,          586405642240,          0,          1,          1,          12},         // (subframe number :23,27,31,35,39)
+{0xb4,          -1,          1,          0,          -1,          586405642240,          2,          2,          1,          12},         // (subframe number :23,27,31,35,39)
+{0xb4,          -1,          1,          0,          -1,          698880,                0,          1,          1,          12},         // (subframe number :9,11,13,15,17,19)
+{0xb4,          -1,          1,          0,          -1,          10920,                 2,          1,          1,          12},         // (subframe number :3,5,7,9,11,13)
+{0xb4,          -1,          1,          0,          -1,          567489872400,          0,          1,          1,          12},         // (subframe number :4,9,14,19,24,29,34,39)
+{0xb4,          -1,          1,          0,          -1,          567489872400,          2,          2,          1,          12},         // (subframe number :4,9,14,19,24,29,34,39)
+{0xb4,          -1,          1,          0,          -1,          965830828032,          2,          2,          1,          12},         // (subframe number :13,14,15, 29,30,31,37,38,39)
+{0xb4,          -1,          1,          0,          -1,          586406201480,          0,          1,          1,          12},         // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xb4,          -1,          1,          0,          -1,          586406201480,          2,          1,          1,          12},         // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xb4,          -1,          1,          0,          -1,          44739240,              2,          1,          1,          12},         // (subframe number :3, 5, 7, …, 23,25)
+{0xb4,          -1,          1,          0,          -1,          44739240,              0,          2,          1,          12},         // (subframe number :3, 5, 7, …, 23,25)
+{0xb4,          -1,          1,          0,          -1,          733007751850,          0,          1,          1,          12},         // (subframe number :1,3,5,7,…,37,39)
+{0xb4,          -1,          1,          0,          -1,          1099511627775,         2,          1,          1,          12},         // (subframe number :0, 1, 2,…, 39)
+{0xc0,          -1,          16,         1,          -1,          567489872400,          0,          2,          7,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xc0,          -1,          16,         1,          -1,          586406201480,          0,          1,          7,          2},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xc0,          -1,          8,          1,          -1,          567489872400,          0,          1,          7,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xc0,          -1,          8,          1,          -1,          586406201480,          0,          1,          7,          2},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xc0,          -1,          8,          1,           2,          550293209600,          0,          2,          7,          2},          // (subframe number :9,19,29,39)
+{0xc0,          -1,          4,          1,          -1,          567489872400,          0,          1,          7,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xc0,          -1,          4,          1,          -1,          567489872400,          0,          2,          7,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xc0,          -1,          4,          1,          -1,          586406201480,          0,          1,          7,          2},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xc0,          -1,          2,          1,          -1,          551911719040,          0,          2,          7,          2},          // (subframe number :7,15,23,31,39)
+{0xc0,          -1,          2,          1,          -1,          567489872400,          0,          1,          7,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xc0,          -1,          2,          1,          -1,          567489872400,          0,          2,          7,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xc0,          -1,          2,          1,          -1,          586406201480,          0,          1,          7,          2},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xc0,          -1,          1,          0,          -1,          549756338176,          8,          1,          3,          2},          // (subframe number :19,39)
+{0xc0,          -1,          1,          0,          -1,          168,                   0,          1,          7,          2},          // (subframe number :3,5,7)
+{0xc0,          -1,          1,          0,          -1,          567489331200,          8,          1,          3,          2},          // (subframe number :24,29,34,39)
+{0xc0,          -1,          1,          0,          -1,          550293209600,          8,          2,          3,          2},          // (subframe number :9,19,29,39)
+{0xc0,          -1,          1,          0,          -1,          687195422720,          0,          1,          7,          2},          // (subframe number :17,19,37,39)
+{0xc0,          -1,          1,          0,          -1,          550293209600,          0,          2,          7,          2},          // (subframe number :9,19,29,39)
+{0xc0,          -1,          1,          0,          -1,          586405642240,          8,          1,          3,          2},          // (subframe number :23,27,31,35,39)
+{0xc0,          -1,          1,          0,          -1,          551911719040,          0,          1,          7,          2},          // (subframe number :7,15,23,31,39)
+{0xc0,          -1,          1,          0,          -1,          586405642240,          0,          1,          7,          2},          // (subframe number :23,27,31,35,39)
+{0xc0,          -1,          1,          0,          -1,          10920,                 8,          1,          3,          2},          // (subframe number :3,5,7,9,11,13)
+{0xc0,          -1,          1,          0,          -1,          567489872400,          8,          1,          3,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xc0,          -1,          1,          0,          -1,          567489872400,          0,          1,          7,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xc0,          -1,          1,          0,          -1,          965830828032,          8,          2,          3,          2},          // (subframe number :13,14,15, 29,30,31,37,38,39)
+{0xc0,          -1,          1,          0,          -1,          586406201480,          8,          1,          3,          2},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xc0,          -1,          1,          0,          -1,          586406201480,          0,          1,          7,          2},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xc0,          -1,          1,          0,          -1,          733007751850,          0,          1,          7,          2},          // (subframe number :1,3,5,7,…,37,39)
+{0xc0,          -1,          1,          0,          -1,          1099511627775,         8,          1,          3,          2},          // (subframe number :0,1,2,…,39)
+{0xc2,          -1,          16,         1,          -1,          567489872400,          0,          2,          2,          6},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xc2,          -1,          16,         1,          -1,          586406201480,          0,          1,          2,          6},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xc2,          -1,          8,          1,          -1,          567489872400,          0,          2,          2,          6},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xc2,          -1,          8,          1,          -1,          586406201480,          0,          1,          2,          6},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xc2,          -1,          8,          1,           2,          550293209600,          0,          2,          2,          6},          // (subframe number :9,19,29,39)
+{0xc2,          -1,          4,          1,          -1,          567489872400,          0,          1,          2,          6},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xc2,          -1,          4,          1,          -1,          567489872400,          0,          2,          2,          6},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xc2,          -1,          4,          1,          -1,          586406201480,          0,          1,          2,          6},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xc2,          -1,          2,          1,          -1,          551911719040,          2,          2,          2,          6},          // (subframe number :7,15,23,31,39)
+{0xc2,          -1,          2,          1,          -1,          567489872400,          0,          1,          2,          6},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xc2,          -1,          2,          1,          -1,          567489872400,          0,          2,          2,          6},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xc2,          -1,          2,          1,          -1,          586406201480,          0,          1,          2,          6},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xc2,          -1,          1,          0,          -1,          549756338176,          2,          1,          2,          6},          // (subframe number :19,39)
+{0xc2,          -1,          1,          0,          -1,          168,                   0,          1,          2,          6},          // (subframe number :3,5,7)
+{0xc2,          -1,          1,          0,          -1,          567489331200,          7,          1,          1,          6},          // (subframe number :24,29,34,39)
+{0xc2,          -1,          1,          0,          -1,          550293209600,          7,          2,          1,          6},          // (subframe number :9,19,29,39)
+{0xc2,          -1,          1,          0,          -1,          687195422720,          0,          1,          2,          6},          // (subframe number :17,19,37,39)
+{0xc2,          -1,          1,          0,          -1,          550293209600,          2,          2,          2,          6},          // (subframe number :9,19,29,39)
+{0xc2,          -1,          1,          0,          -1,          551911719040,          2,          1,          2,          6},          // (subframe number :7,15,23,31,39)
+{0xc2,          -1,          1,          0,          -1,          10920,                 7,          1,          1,          6},          // (subframe number :3,5,7,9,11,13)
+{0xc2,          -1,          1,          0,          -1,          586405642240,          7,          2,          1,          6},          // (subframe number :23,27,31,35,39)
+{0xc2,          -1,          1,          0,          -1,          586405642240,          0,          1,          2,          6},          // (subframe number :23,27,31,35,39)
+{0xc2,          -1,          1,          0,          -1,          567489872400,          7,          2,          1,          6},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xc2,          -1,          1,          0,          -1,          567489872400,          2,          1,          2,          6},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xc2,          -1,          1,          0,          -1,          965830828032,          7,          2,          1,          6},          // (subframe number :13,14,15, 29,30,31,37,38,39)
+{0xc2,          -1,          1,          0,          -1,          586406201480,          7,          1,          1,          6},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xc2,          -1,          1,          0,          -1,          586406201480,          0,          1,          2,          6},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xc2,          -1,          1,          0,          -1,          733007751850,          0,          1,          2,          6},          // (subframe number :1,3,5,7,…,37,39)
+{0xc2,          -1,          1,          0,          -1,          1099511627775,         7,          1,          1,          6},          // (subframe number :0,1,2,…,39)
+{0xa1,          0xb1,        16,         1,          -1,          567489872400,          2,          1,          6,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa1,          0xb1,        16,         1,          -1,          586406201480,          2,          1,          6,          2},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa1,          0xb1,        8,          1,          -1,          567489872400,          2,          1,          6,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa1,          0xb1,        8,          1,          -1,          586406201480,          2,          1,          6,          2},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa1,          0xb1,        4,          1,          -1,          567489872400,          2,          1,          6,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa1,          0xb1,        4,          1,          -1,          586406201480,          2,          1,          6,          2},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa1,          0xb1,        2,          1,          -1,          567489872400,          2,          1,          6,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa1,          0xb1,        1,          0,          -1,          549756338176,          8,          1,          3,          2},          // (subframe number :19,39)
+{0xa1,          0xb1,        1,          0,          -1,          550293209600,          8,          1,          3,          2},          // (subframe number :9,19,29,39)
+{0xa1,          0xb1,        1,          0,          -1,          687195422720,          2,          1,          6,          2},          // (subframe number :17,19,37,39)
+{0xa1,          0xb1,        1,          0,          -1,          550293209600,          2,          2,          6,          2},          // (subframe number :9,19,29,39)
+{0xa1,          0xb1,        1,          0,          -1,          586405642240,          8,          1,          3,          2},          // (subframe number :23,27,31,35,39)
+{0xa1,          0xb1,        1,          0,          -1,          551911719040,          2,          1,          6,          2},          // (subframe number :7,15,23,31,39)
+{0xa1,          0xb1,        1,          0,          -1,          586405642240,          2,          1,          6,          2},          // (subframe number :23,27,31,35,39)
+{0xa1,          0xb1,        1,          0,          -1,          567489872400,          8,          1,          3,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa1,          0xb1,        1,          0,          -1,          567489872400,          2,          1,          6,          2},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa1,          0xb1,        1,          0,          -1,          586406201480,          2,          1,          6,          2},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa1,          0xb1,        1,          0,          -1,          733007751850,          2,          1,          6,          2},          // (subframe number :1,3,5,7,…,37,39)
+{0xa2,          0xb2,        16,         1,          -1,          567489872400,          2,          1,          3,          4},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa2,          0xb2,        16,         1,          -1,          586406201480,          2,          1,          3,          4},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa2,          0xb2,        8,          1,          -1,          567489872400,          2,          1,          3,          4},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa2,          0xb2,        8,          1,          -1,          586406201480,          2,          1,          3,          4},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa2,          0xb2,        4,          1,          -1,          567489872400,          2,          1,          3,          4},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa2,          0xb2,        4,          1,          -1,          586406201480,          2,          1,          3,          4},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa2,          0xb2,        2,          1,          -1,          567489872400,          2,          1,          3,          4},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa2,          0xb2,        1,          0,          -1,          549756338176,          6,          1,          2,          4},          // (subframe number :19,39)
+{0xa2,          0xb2,        1,          0,          -1,          550293209600,          6,          1,          2,          4},          // (subframe number :9,19,29,39)
+{0xa2,          0xb2,        1,          0,          -1,          687195422720,          2,          1,          3,          4},          // (subframe number :17,19,37,39)
+{0xa2,          0xb2,        1,          0,          -1,          550293209600,          2,          2,          3,          4},          // (subframe number :9,19,29,39)
+{0xa2,          0xb2,        1,          0,          -1,          586405642240,          6,          1,          2,          4},          // (subframe number :23,27,31,35,39)
+{0xa2,          0xb2,        1,          0,          -1,          551911719040,          2,          1,          3,          4},          // (subframe number :7,15,23,31,39)
+{0xa2,          0xb2,        1,          0,          -1,          586405642240,          2,          1,          3,          4},          // (subframe number :23,27,31,35,39)
+{0xa2,          0xb2,        1,          0,          -1,          567489872400,          6,          1,          2,          4},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa2,          0xb2,        1,          0,          -1,          567489872400,          2,          1,          3,          4},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa2,          0xb2,        1,          0,          -1,          586406201480,          2,          1,          3,          4},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa2,          0xb2,        1,          0,          -1,          733007751850,          2,          1,          3,          4},          // (subframe number :1,3,5,7,…,37,39)
+{0xa3,          0xb3,        16,         1,          -1,          567489872400,          2,          1,          2,          6},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa3,          0xb3,        16,         1,          -1,          586406201480,          2,          1,          2,          6},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa3,          0xb3,        8,          1,          -1,          567489872400,          2,          1,          2,          6},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa3,          0xb3,        8,          1,          -1,          586406201480,          2,          1,          2,          6},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa3,          0xb3,        4,          1,          -1,          567489872400,          2,          1,          2,          6},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa3,          0xb3,        4,          1,          -1,          586406201480,          2,          1,          2,          6},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa3,          0xb3,        2,          1,          -1,          567489872400,          2,          1,          2,          6},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa3,          0xb3,        1,          0,          -1,          549756338176,          2,          1,          2,          6},          // (subframe number :19,39)
+{0xa3,          0xb3,        1,          0,          -1,          550293209600,          2,          1,          2,          6},          // (subframe number :9,19,29,39)
+{0xa3,          0xb3,        1,          0,          -1,          687195422720,          2,          1,          2,          6},          // (subframe number :17,19,37,39)
+{0xa3,          0xb3,        1,          0,          -1,          550293209600,          2,          2,          2,          6},          // (subframe number :9,19,29,39)
+{0xa3,          0xb3,        1,          0,          -1,          551911719040,          2,          1,          2,          6},          // (subframe number :7,15,23,31,39)
+{0xa3,          0xb3,        1,          0,          -1,          586405642240,          2,          1,          2,          6},          // (subframe number :23,27,31,35,39)
+{0xa3,          0xb3,        1,          0,          -1,          586405642240,          2,          2,          2,          6},          // (subframe number :23,27,31,35,39)
+{0xa3,          0xb3,        1,          0,          -1,          567489872400,          2,          1,          2,          6},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa3,          0xb3,        1,          0,          -1,          567489872400,          2,          2,          2,          6},          // (subframe number :4,9,14,19,24,29,34,39)
+{0xa3,          0xb3,        1,          0,          -1,          586406201480,          2,          1,          2,          6},          // (subframe number :3,7,11,15,19,23,27,31,35,39)
+{0xa3,          0xb3,        1,          0,          -1,          733007751850,          2,          1,          2,          6}           // (subframe number :1,3,5,7,…,37,39)
+};
diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach_common.c b/openair1/PHY/NR_TRANSPORT/nr_prach_common.c
new file mode 100644
index 00000000000..e1b80a87a2f
--- /dev/null
+++ b/openair1/PHY/NR_TRANSPORT/nr_prach_common.c
@@ -0,0 +1,370 @@
+/*
+ * 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/prach_common.c
+ * \brief Common routines for NR UE/gNB PRACH physical channel V15.4 2019-03
+ * \author R. Knopp
+ * \date 2019
+ * \version 0.1
+ * \company Eurecom
+ * \email: knopp@eurecom.fr
+ * \note
+ * \warning
+ */
+#include "PHY/sse_intrin.h"
+#include "common/utils/LOG/vcd_signal_dumper.h"
+#include "PHY/impl_defs_nr.h"
+#include "PHY/defs_nr_UE.h"
+#include "PHY/NR_TRANSPORT/nr_prach.h"
+#include "PHY/NR_TRANSPORT/nr_transport_proto_common.h"
+#include "common/utils/LOG/log.h"
+#include "common/utils/LOG/vcd_signal_dumper.h"
+
+#include "T.h"
+
+void init_nr_prach_tables(int N_ZC);
+
+void dump_nr_prach_config(NR_DL_FRAME_PARMS *frame_parms,uint8_t subframe) {
+
+  FILE *fd;
+
+  fd = fopen("prach_config.txt","w");
+  fprintf(fd,"prach_config: subframe          = %d\n",subframe);
+  fprintf(fd,"prach_config: N_RB_UL           = %d\n",frame_parms->N_RB_UL);
+  fprintf(fd,"prach_config: frame_type        = %s\n",(frame_parms->frame_type==1) ? "TDD":"FDD");
+
+  if (frame_parms->frame_type==TDD) {
+    fprintf(fd,"prach_config: p_tdd_UL_DL_Configuration.referenceSCS                  = %d\n",frame_parms->p_tdd_UL_DL_Configuration->referenceSubcarrierSpacing);
+    fprintf(fd,"prach_config: p_tdd_UL_DL_Configuration.dl_UL_TransmissionPeriodicity = %d\n",frame_parms->p_tdd_UL_DL_Configuration->dl_UL_TransmissionPeriodicity);
+    fprintf(fd,"prach_config: p_tdd_UL_DL_Configuration.nrofDownlinkSlots             = %d\n",frame_parms->p_tdd_UL_DL_Configuration->nrofDownlinkSlots);
+    fprintf(fd,"prach_config: p_tdd_UL_DL_Configuration.nrofDownlinkSymbols           = %d\n",frame_parms->p_tdd_UL_DL_Configuration->nrofDownlinkSymbols);
+    fprintf(fd,"prach_config: p_tdd_UL_DL_Configuration.nrofUownlinkSlots             = %d\n",frame_parms->p_tdd_UL_DL_Configuration->nrofDownlinkSlots);
+    fprintf(fd,"prach_config: p_tdd_UL_DL_Configuration.nrofUownlinkSymbols           = %d\n",frame_parms->p_tdd_UL_DL_Configuration->nrofDownlinkSymbols);
+    if (frame_parms->p_tdd_UL_DL_Configuration->p_next) {
+      fprintf(fd,"prach_config: p_tdd_UL_DL_Configuration.referenceSCS2                  = %d\n",frame_parms->p_tdd_UL_DL_Configuration->p_next->referenceSubcarrierSpacing);
+      fprintf(fd,"prach_config: p_tdd_UL_DL_Configuration.dl_UL_TransmissionPeriodicity2 = %d\n",frame_parms->p_tdd_UL_DL_Configuration->p_next->dl_UL_TransmissionPeriodicity);
+      fprintf(fd,"prach_config: p_tdd_UL_DL_Configuration.nrofDownlinkSlots2             = %d\n",frame_parms->p_tdd_UL_DL_Configuration->p_next->nrofDownlinkSlots);
+      fprintf(fd,"prach_config: p_tdd_UL_DL_Configuration.nrofDownlinkSymbols2           = %d\n",frame_parms->p_tdd_UL_DL_Configuration->p_next->nrofDownlinkSymbols);
+      fprintf(fd,"prach_config: p_tdd_UL_DL_Configuration.nrofUownlinkSlots2             = %d\n",frame_parms->p_tdd_UL_DL_Configuration->p_next->nrofDownlinkSlots);
+      fprintf(fd,"prach_config: p_tdd_UL_DL_Configuration.nrofUownlinkSymbols2           = %d\n",frame_parms->p_tdd_UL_DL_Configuration->p_next->nrofDownlinkSymbols);
+
+    }
+  }
+
+  fprintf(fd,"prach_config: rootSequenceIndex = %d\n",frame_parms->prach_config_common.rootSequenceIndex);
+  fprintf(fd,"prach_config: prach_ConfigIndex = %d\n",frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex);
+  fprintf(fd,"prach_config: Ncs_config        = %d\n",frame_parms->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig);
+  fprintf(fd,"prach_config: highSpeedFlag     = %d\n",frame_parms->prach_config_common.prach_ConfigInfo.highSpeedFlag);
+  fprintf(fd,"prach_config: n_ra_prboffset    = %d\n",frame_parms->prach_config_common.prach_ConfigInfo.msg1_frequencystart);
+  fclose(fd);
+
+}
+
+// This function computes the du
+void nr_fill_du(uint8_t prach_fmt)
+{
+
+  uint16_t iu,u,p;
+  uint16_t N_ZC;
+  uint16_t *prach_root_sequence_map;
+
+  if (prach_fmt<4) {
+    N_ZC = 839;
+    prach_root_sequence_map = prach_root_sequence_map_0_3;
+  } else {
+    N_ZC = 139;
+    prach_root_sequence_map = prach_root_sequence_map_abc;
+  }
+
+  for (iu=0; iu<(N_ZC-1); iu++) {
+
+    u=prach_root_sequence_map[iu];
+    p=1;
+
+    while (((u*p)%N_ZC)!=1)
+      p++;
+
+    nr_du[u] = ((p<(N_ZC>>1)) ? p : (N_ZC-p));
+  }
+
+}
+
+int is_nr_prach_subframe(NR_DL_FRAME_PARMS *frame_parms,uint32_t frame, uint8_t subframe) {
+
+  uint8_t prach_ConfigIndex  = frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
+  /*
+  // For FR1 paired
+  if (((frame%table_6_3_3_2_2_prachConfig_Index[prach_ConfigIndex][2]) == table_6_3_3_2_2_prachConfig_Index[prach_ConfigIndex][3]) &&
+  ((table_6_3_3_2_2_prachConfig_Index[prach_ConfigIndex][4]&(1<<subframe)) == 1)) {
+  // using table 6.3.3.2-2: Random access configurations for FR1 and paired spectrum/supplementary uplink
+  return(1);
+  } else {
+  return(0);
+  }
+  */
+  // For FR1 unpaired
+  if (((frame%table_6_3_3_2_3_prachConfig_Index[prach_ConfigIndex][2]) == table_6_3_3_2_3_prachConfig_Index[prach_ConfigIndex][3]) &&
+      ((table_6_3_3_2_3_prachConfig_Index[prach_ConfigIndex][4]&(1<<subframe)) == 1)) {
+    // using table 6.3.3.2-2: Random access configurations for FR1 and unpaired
+    return(1);
+  } else {
+    return(0);
+  }
+  /*
+  // For FR2: FIXME
+  if ((((frame%table_6_3_3_2_4_prachConfig_Index[prach_ConfigIndex][2]) == table_6_3_3_2_4_prachConfig_Index[prach_ConfigIndex][3]) ||
+  ((frame%table_6_3_3_2_4_prachConfig_Index[prach_ConfigIndex][2]) == table_6_3_3_2_4_prachConfig_Index[prach_ConfigIndex][4]))
+  &&
+  ((table_6_3_3_2_4_prachConfig_Index[prach_ConfigIndex][5]&(1<<subframe)) == 1)) {
+  // using table 6.3.3.2-2: Random access configurations for FR1 and unpaired
+  return(1);
+  } else {
+  return(0);
+  }
+  */
+}
+
+
+int do_prach_rx(NR_DL_FRAME_PARMS *fp,int frame,int slot) {
+
+  int subframe = slot / fp->slots_per_subframe;
+  // when were in the last slot of the subframe and this is a PRACH subframe ,return 1
+  if (((slot%fp->slots_per_subframe) == fp->slots_per_subframe-1)&&
+      (is_nr_prach_subframe(fp,frame,subframe))) return (1);
+  else return(0);
+}
+
+uint16_t get_nr_prach_fmt(int prach_ConfigIndex,lte_frame_type_t frame_type, nr_frequency_range_e fr)
+{
+
+  if (frame_type==FDD) return (table_6_3_3_2_2_prachConfig_Index[prach_ConfigIndex][0]); // if using table 6.3.3.2-2: Random access configurations for FR1 and paired spectrum/supplementary uplink
+  else if (fr==nr_FR1) return (table_6_3_3_2_3_prachConfig_Index[prach_ConfigIndex][0]); // if using table 6.3.3.2-3: Random access configurations for FR1 and unpaired spectrum
+  else AssertFatal(1==0,"FR2 prach configuration not supported yet\n");
+  // For FR2 not implemented. FIXME
+}
+
+void compute_nr_prach_seq(uint16_t rootSequenceIndex,
+			  uint8_t prach_ConfigIndex,
+			  uint8_t zeroCorrelationZoneConfig,
+			  uint8_t highSpeedFlag,
+			  lte_frame_type_t frame_type,
+			  nr_frequency_range_e fr,
+			  uint32_t X_u[64][839])
+{
+
+  // Compute DFT of x_u => X_u[k] = x_u(inv(u)*k)^* X_u[k] = exp(j\pi u*inv(u)*k*(inv(u)*k+1)/N_ZC)
+  unsigned int k,inv_u,i,NCS=0,num_preambles;
+  int N_ZC;
+  uint8_t prach_fmt = get_nr_prach_fmt(prach_ConfigIndex,frame_type,fr);
+  uint16_t *prach_root_sequence_map;
+  uint16_t u, preamble_offset;
+  uint16_t n_shift_ra,n_shift_ra_bar, d_start,numshift;
+  uint8_t not_found;
+
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_COMPUTE_PRACH, VCD_FUNCTION_IN);
+
+#ifdef NR_PRACH_DEBUG
+  LOG_I(PHY,"compute_prach_seq: NCS_config %d, prach_fmt %x\n",zeroCorrelationZoneConfig, prach_fmt);
+#endif
+
+
+  N_ZC = (prach_fmt < 4) ? 839 : 139;
+  //init_prach_tables(N_ZC); //moved to phy_init_lte_ue/eNB, since it takes to long in real-time
+  
+  init_nr_prach_tables(N_ZC);
+
+  if (prach_fmt < 4) {
+    prach_root_sequence_map = prach_root_sequence_map_0_3;
+  } else {
+    // FIXME cannot be reached
+    prach_root_sequence_map = prach_root_sequence_map_abc;
+  }
+
+
+#ifdef PRACH_DEBUG
+  LOG_I( PHY, "compute_prach_seq: done init prach_tables\n" );
+#endif
+
+
+
+
+  int restricted_Type = 0; //this is hardcoded ('0' for restricted_TypeA; and '1' for restricted_TypeB). FIXME
+
+  if (highSpeedFlag== 0) {
+    
+#ifdef PRACH_DEBUG
+    LOG_I(PHY,"Low speed prach : NCS_config %d\n",zeroCorrelationZoneConfig);
+#endif
+    
+    AssertFatal(zeroCorrelationZoneConfig<=15,
+		"FATAL, Illegal Ncs_config for unrestricted format %"PRIu8"\n", zeroCorrelationZoneConfig );
+    if (prach_fmt<3)  NCS = NCS_unrestricted_delta_f_RA_125[zeroCorrelationZoneConfig];
+    if (prach_fmt==3) NCS = NCS_unrestricted_delta_f_RA_5[zeroCorrelationZoneConfig];
+    if (prach_fmt>3)  NCS = NCS_unrestricted_delta_f_RA_15[zeroCorrelationZoneConfig];
+    
+    num_preambles = (NCS==0) ? 64 : ((64*NCS)/N_ZC);
+
+    if (NCS>0) num_preambles++;
+
+    preamble_offset = 0;
+  } else {
+
+#ifdef PRACH_DEBUG
+    LOG_I( PHY, "high speed prach : NCS_config %"PRIu8"\n", zeroCorrelationZoneConfig );
+#endif
+
+    AssertFatal(zeroCorrelationZoneConfig<=14,
+		"FATAL, Illegal Ncs_config for restricted format %"PRIu8"\n", zeroCorrelationZoneConfig );
+    if (prach_fmt<3){
+      if (restricted_Type == 0) NCS = NCS_restricted_TypeA_delta_f_RA_125[zeroCorrelationZoneConfig]; // for TypeA, this is hardcoded. FIXME
+      if (restricted_Type == 1) NCS = NCS_restricted_TypeB_delta_f_RA_125[zeroCorrelationZoneConfig]; // for TypeB, this is hardcoded. FIXME
+    }
+    if (prach_fmt==3){
+      if (restricted_Type == 0) NCS = NCS_restricted_TypeA_delta_f_RA_5[zeroCorrelationZoneConfig]; // for TypeA, this is hardcoded. FIXME
+      if (restricted_Type == 1) NCS = NCS_restricted_TypeB_delta_f_RA_5[zeroCorrelationZoneConfig]; // for TypeB, this is hardcoded. FIXME
+    }
+    if (prach_fmt>3){
+
+    }
+
+    nr_fill_du(prach_fmt);
+
+    num_preambles = 64; // compute ZC sequence for 64 possible roots
+    // find first non-zero shift root (stored in preamble_offset)
+    not_found = 1;
+    preamble_offset = 0;
+
+    while (not_found == 1) {
+      // current root depending on rootSequenceIndex
+      int index = (rootSequenceIndex + preamble_offset) % N_ZC;
+
+      if (prach_fmt<4) {
+        // prach_root_sequence_map points to prach_root_sequence_map0_3
+        DevAssert( index < sizeof(prach_root_sequence_map_0_3) / sizeof(prach_root_sequence_map_0_3[0]) );
+      } else {
+        // prach_root_sequence_map points to prach_root_sequence_map4
+        DevAssert( index < sizeof(prach_root_sequence_map_abc) / sizeof(prach_root_sequence_map_abc[0]) );
+      }
+
+      u = prach_root_sequence_map[index];
+
+      uint16_t n_group_ra = 0;
+
+      if ( (nr_du[u]<(N_ZC/3)) && (nr_du[u]>=NCS) ) {
+        n_shift_ra     = nr_du[u]/NCS;
+        d_start        = (nr_du[u]<<1) + (n_shift_ra * NCS);
+        n_group_ra     = N_ZC/d_start;
+        n_shift_ra_bar = max(0,(N_ZC-(nr_du[u]<<1)-(n_group_ra*d_start))/N_ZC);
+      } else if  ( (nr_du[u]>=(N_ZC/3)) && (nr_du[u]<=((N_ZC - NCS)>>1)) ) {
+        n_shift_ra     = (N_ZC - (nr_du[u]<<1))/NCS;
+        d_start        = N_ZC - (nr_du[u]<<1) + (n_shift_ra * NCS);
+        n_group_ra     = nr_du[u]/d_start;
+        n_shift_ra_bar = min(n_shift_ra,max(0,(nr_du[u]- (n_group_ra*d_start))/NCS));
+      } else {
+        n_shift_ra     = 0;
+        n_shift_ra_bar = 0;
+      }
+
+      // This is the number of cyclic shifts for the current root u
+      numshift = (n_shift_ra*n_group_ra) + n_shift_ra_bar;
+
+      // skip to next root and recompute parameters if numshift==0
+      if (numshift>0)
+        not_found = 0;
+      else
+        preamble_offset++;
+    }
+  }
+
+#ifdef PRACH_DEBUG
+
+  if (NCS>0)
+    LOG_I( PHY, "Initializing %u preambles for PRACH (NCS_config %"PRIu8", NCS %u, N_ZC/NCS %u)\n",
+           num_preambles, zeroCorrelationZoneConfig, NCS, N_ZC/NCS );
+
+#endif
+
+  for (i=0; i<num_preambles; i++) {
+    int index = (rootSequenceIndex+i+preamble_offset) % N_ZC;
+
+    if (prach_fmt<4) {
+      // prach_root_sequence_map points to prach_root_sequence_map0_3
+      DevAssert( index < sizeof(prach_root_sequence_map_0_3) / sizeof(prach_root_sequence_map_0_3[0]) );
+    } else {
+      // prach_root_sequence_map points to prach_root_sequence_map4
+      DevAssert( index < sizeof(prach_root_sequence_map_abc) / sizeof(prach_root_sequence_map_abc[0]) );
+    }
+
+    u = prach_root_sequence_map[index];
+
+    inv_u = nr_ZC_inv[u]; // multiplicative inverse of u
+
+
+    // X_u[0] stores the first ZC sequence where the root u has a non-zero number of shifts
+    // for the unrestricted case X_u[0] is the first root indicated by the rootSequenceIndex
+
+    for (k=0; k<N_ZC; k++) {
+      // 420 is the multiplicative inverse of 2 (required since ru is exp[j 2\pi n])
+      X_u[i][k] = ((uint32_t*)nr_ru)[(((k*(1+(inv_u*k)))%N_ZC)*420)%N_ZC];
+    }
+  }
+
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_COMPUTE_PRACH, VCD_FUNCTION_OUT);
+
+}
+
+void init_nr_prach_tables(int N_ZC)
+{
+
+  int i,m;
+
+  // Compute the modular multiplicative inverse 'iu' of u s.t. iu*u = 1 mod N_ZC
+  nr_ZC_inv[0] = 0;
+  nr_ZC_inv[1] = 1;
+
+  for (i=2; i<N_ZC; i++) {
+    for (m=2; m<N_ZC; m++)
+      if (((i*m)%N_ZC) == 1) {
+        nr_ZC_inv[i] = m;
+        break;
+      }
+
+#ifdef PRACH_DEBUG
+
+    if (i<16)
+      printf("i %d : inv %d\n",i,nr_ZC_inv[i]);
+
+#endif
+  }
+
+  // Compute quantized roots of unity
+  for (i=0; i<N_ZC; i++) {
+    nr_ru[i<<1]     = (int16_t)(floor(32767.0*cos(2*M_PI*(double)i/N_ZC)));
+    nr_ru[1+(i<<1)] = (int16_t)(floor(32767.0*sin(2*M_PI*(double)i/N_ZC)));
+#ifdef PRACH_DEBUG
+
+    if (i<16)
+      printf("i %d : runity %d,%d\n",i,nr_ru[i<<1],nr_ru[1+(i<<1)]);
+
+#endif
+  }
+}
+
diff --git a/openair1/PHY/NR_TRANSPORT/nr_transport_proto_common.h b/openair1/PHY/NR_TRANSPORT/nr_transport_proto_common.h
new file mode 100644
index 00000000000..dd37455e262
--- /dev/null
+++ b/openair1/PHY/NR_TRANSPORT/nr_transport_proto_common.h
@@ -0,0 +1,1760 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+/*! \file PHY/NR_UE_TRANSPORT/transport_proto_ue.h
+ * \brief Function prototypes for PHY physical/transport channel processing and generation V8.6 2009-03
+ * \author R. Knopp, F. Kaltenberger
+ * \date 2011
+ * \version 0.1
+ * \company Eurecom
+ * \email: knopp@eurecom.fr
+ * \note
+ * \warning
+ */
+#ifndef __NR_TRANSPORT_PROTO_UE__H__
+#define __NR_TRANSPORT_PROTO_UE__H__
+#include "PHY/defs_nr_UE.h"
+#include "SCHED_NR_UE/defs.h"
+//#include "PHY/LTE_TRANSPORT/transport_common_proto.h"
+#include <math.h>
+#include "nfapi_interface.h"
+
+// Functions below implement 36-211 and 36-212
+
+/** @addtogroup _PHY_TRANSPORT_
+ * @{
+ */
+
+/** \fn free_ue_dlsch(NR_UE_DLSCH_t *dlsch)
+    \brief This function frees memory allocated for a particular DLSCH at UE
+    @param dlsch Pointer to DLSCH to be removed
+*/
+void free_nr_ue_dlsch(NR_UE_DLSCH_t *dlsch);
+
+/** \fn new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t abstraction_flag)
+    \brief This function allocates structures for a particular DLSCH at UE
+    @returns Pointer to DLSCH to be removed
+    @param Kmimo Kmimo factor from 36-212/36-213
+    @param Mdlharq Maximum number of HARQ rounds (36-212/36-213)
+    @param Nsoft Soft-LLR buffer size from UE-Category
+    @params N_RB_DL total number of resource blocks (determine the operating BW)
+    @param abstraction_flag Flag to indicate abstracted interface
+*/
+NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_turbo_iterations,uint8_t N_RB_DL, uint8_t abstraction_flag);
+
+
+void free_nr_ue_ulsch(NR_UE_ULSCH_t *ulsch);
+
+
+NR_UE_ULSCH_t *new_nr_ue_ulsch(unsigned char N_RB_UL, int number_of_harq_pids, uint8_t abstraction_flag);
+
+void fill_UE_dlsch_MCH(PHY_VARS_NR_UE *ue,int mcs,int ndi,int rvidx,int eNB_id);
+
+int rx_pmch(PHY_VARS_NR_UE *phy_vars_ue,
+            unsigned char eNB_id,
+            uint8_t subframe,
+            unsigned char symbol);
+
+/** \brief Dump OCTAVE/MATLAB files for PMCH debugging
+    @param phy_vars_ue Pointer to UE variables
+    @param eNB_id index of eNB in ue variables
+    @param coded_bits_per_codeword G from 36.211
+    @param subframe Index of subframe
+    @returns 0 on success
+*/
+void dump_mch(PHY_VARS_NR_UE *phy_vars_ue,uint8_t eNB_id,uint16_t coded_bits_per_codeword,int subframe);
+
+
+
+/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream QPSK/QPSK reception.
+    @param stream0_in Input from channel compensated (MR combined) stream 0
+    @param stream1_in Input from channel compensated (MR combined) stream 1
+    @param stream0_out Output from LLR unit for stream0
+    @param rho01 Cross-correlation between channels (MR combined)
+    @param length in complex channel outputs*/
+void qpsk_qpsk(int16_t *stream0_in,
+               int16_t *stream1_in,
+               int16_t *stream0_out,
+               int16_t *rho01,
+               int32_t length);
+
+/** \brief This function perform LLR computation for dual-stream (QPSK/QPSK) transmission.
+    @param frame_parms Frame descriptor structure
+    @param rxdataF_comp Compensated channel output
+    @param rxdataF_comp_i Compensated channel output for interference
+    @param rho_i Correlation between channel of signal and inteference
+    @param dlsch_llr llr output
+    @param symbol OFDM symbol index in sub-frame
+    @param first_symbol_flag flag to indicate this is the first symbol of the dlsch
+    @param nb_rb number of RBs for this allocation
+    @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS
+    @param llr128p pointer to pointer to symbol in dlsch_llr*/
+int32_t nr_dlsch_qpsk_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms,
+                            int32_t **rxdataF_comp,
+                            int32_t **rxdataF_comp_i,
+                            int32_t **rho_i,
+                            int16_t *dlsch_llr,
+                            uint8_t symbol,
+							uint32_t len,
+                            uint8_t first_symbol_flag,
+                            uint16_t nb_rb,
+                            uint16_t pbch_pss_sss_adj,
+                            int16_t **llr128p);
+
+/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream QPSK/16QAM reception.
+    @param stream0_in Input from channel compensated (MR combined) stream 0
+    @param stream1_in Input from channel compensated (MR combined) stream 1
+    @param ch_mag_i Input from scaled channel magnitude square of h0'*g1
+    @param stream0_out Output from LLR unit for stream0
+    @param rho01 Cross-correlation between channels (MR combined)
+    @param length in complex channel outputs*/
+void qpsk_qam16(int16_t *stream0_in,
+                int16_t *stream1_in,
+                short *ch_mag_i,
+                int16_t *stream0_out,
+                int16_t *rho01,
+                int32_t length);
+
+/** \brief This function perform LLR computation for dual-stream (QPSK/16QAM) transmission.
+    @param frame_parms Frame descriptor structure
+    @param rxdataF_comp Compensated channel output
+    @param rxdataF_comp_i Compensated channel output for interference
+    @param rho_i Correlation between channel of signal and inteference
+    @param dlsch_llr llr output
+    @param symbol OFDM symbol index in sub-frame
+    @param first_symbol_flag flag to indicate this is the first symbol of the dlsch
+    @param nb_rb number of RBs for this allocation
+    @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS
+    @param llr128p pointer to pointer to symbol in dlsch_llr*/
+int32_t nr_dlsch_qpsk_16qam_llr(NR_DL_FRAME_PARMS *frame_parms,
+                             int32_t **rxdataF_comp,
+                             int32_t **rxdataF_comp_i,
+                             int **dl_ch_mag_i, //|h_1|^2*(2/sqrt{10})
+                             int32_t **rho_i,
+                             int16_t *dlsch_llr,
+                             uint8_t symbol,
+                             uint8_t first_symbol_flag,
+                             uint16_t nb_rb,
+                             uint16_t pbch_pss_sss_adj,
+                             int16_t **llr128p);
+
+
+/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream QPSK/64QAM reception.
+    @param stream0_in Input from channel compensated (MR combined) stream 0
+    @param stream1_in Input from channel compensated (MR combined) stream 1
+    @param ch_mag_i Input from scaled channel magnitude square of h0'*g1
+    @param stream0_out Output from LLR unit for stream0
+    @param rho01 Cross-correlation between channels (MR combined)
+    @param length in complex channel outputs*/
+void qpsk_qam64(int16_t *stream0_in,
+                int16_t *stream1_in,
+                short *ch_mag_i,
+                int16_t *stream0_out,
+                int16_t *rho01,
+                int32_t length);
+
+/** \brief This function perform LLR computation for dual-stream (QPSK/64QAM) transmission.
+    @param frame_parms Frame descriptor structure
+    @param rxdataF_comp Compensated channel output
+    @param rxdataF_comp_i Compensated channel output for interference
+    @param rho_i Correlation between channel of signal and inteference
+    @param dlsch_llr llr output
+    @param symbol OFDM symbol index in sub-frame
+    @param first_symbol_flag flag to indicate this is the first symbol of the dlsch
+    @param nb_rb number of RBs for this allocation
+    @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS
+    @param llr128p pointer to pointer to symbol in dlsch_llr*/
+int32_t nr_dlsch_qpsk_64qam_llr(NR_DL_FRAME_PARMS *frame_parms,
+                             int32_t **rxdataF_comp,
+                             int32_t **rxdataF_comp_i,
+                             int **dl_ch_mag_i, //|h_1|^2*(2/sqrt{10})
+                             int32_t **rho_i,
+                             int16_t *dlsch_llr,
+                             uint8_t symbol,
+                             uint8_t first_symbol_flag,
+                             uint16_t nb_rb,
+                             uint16_t pbch_pss_sss_adj,
+                             int16_t **llr128p);
+
+
+/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream 16QAM/QPSK reception.
+    @param stream0_in Input from channel compensated (MR combined) stream 0
+    @param stream1_in Input from channel compensated (MR combined) stream 1
+    @param ch_mag   Input from scaled channel magnitude square of h0'*g0
+    @param stream0_out Output from LLR unit for stream0
+    @param rho01 Cross-correlation between channels (MR combined)
+    @param length in complex channel outputs*/
+void qam16_qpsk(short *stream0_in,
+                short *stream1_in,
+                short *ch_mag,
+                short *stream0_out,
+                short *rho01,
+                int length);
+/** \brief This function perform LLR computation for dual-stream (16QAM/QPSK) transmission.
+    @param frame_parms Frame descriptor structure
+    @param rxdataF_comp Compensated channel output
+    @param rxdataF_comp_i Compensated channel output for interference
+    @param ch_mag   Input from scaled channel magnitude square of h0'*g0
+    @param rho_i Correlation between channel of signal and inteference
+    @param dlsch_llr llr output
+    @param symbol OFDM symbol index in sub-frame
+    @param first_symbol_flag flag to indicate this is the first symbol of the dlsch
+    @param nb_rb number of RBs for this allocation
+    @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS
+    @param llr16p pointer to pointer to symbol in dlsch_llr*/
+int nr_dlsch_16qam_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms,
+                         int **rxdataF_comp,
+                         int **rxdataF_comp_i,
+                         int **dl_ch_mag,   //|h_0|^2*(2/sqrt{10})
+                         int **rho_i,
+                         short *dlsch_llr,
+                         unsigned char symbol,
+                         unsigned char first_symbol_flag,
+                         unsigned short nb_rb,
+                         uint16_t pbch_pss_sss_adjust,
+                         short **llr16p);
+
+/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream 16QAM/16QAM reception.
+    @param stream0_in Input from channel compensated (MR combined) stream 0
+    @param stream1_in Input from channel compensated (MR combined) stream 1
+    @param ch_mag   Input from scaled channel magnitude square of h0'*g0
+    @param ch_mag_i Input from scaled channel magnitude square of h0'*g1
+    @param stream0_out Output from LLR unit for stream0
+    @param rho01 Cross-correlation between channels (MR combined)
+    @param length in complex channel outputs*/
+void qam16_qam16(short *stream0_in,
+                 short *stream1_in,
+                 short *ch_mag,
+                 short *ch_mag_i,
+                 short *stream0_out,
+                 short *rho01,
+                 int length);
+
+/** \brief This function perform LLR computation for dual-stream (16QAM/16QAM) transmission.
+    @param frame_parms Frame descriptor structure
+    @param rxdataF_comp Compensated channel output
+    @param rxdataF_comp_i Compensated channel output for interference
+    @param ch_mag   Input from scaled channel magnitude square of h0'*g0
+    @param ch_mag_i Input from scaled channel magnitude square of h0'*g1
+    @param rho_i Correlation between channel of signal and inteference
+    @param dlsch_llr llr output
+    @param symbol OFDM symbol index in sub-frame
+    @param first_symbol_flag flag to indicate this is the first symbol of the dlsch
+    @param nb_rb number of RBs for this allocation
+    @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS
+    @param llr16p pointer to pointer to symbol in dlsch_llr*/
+int nr_dlsch_16qam_16qam_llr(NR_DL_FRAME_PARMS *frame_parms,
+                          int **rxdataF_comp,
+                          int **rxdataF_comp_i,
+                          int **dl_ch_mag,   //|h_0|^2*(2/sqrt{10})
+                          int **dl_ch_mag_i, //|h_1|^2*(2/sqrt{10})
+                          int **rho_i,
+                          short *dlsch_llr,
+                          unsigned char symbol,
+						  uint32_t len,
+                          unsigned char first_symbol_flag,
+                          unsigned short nb_rb,
+                          uint16_t pbch_pss_sss_adjust,
+                          short **llr16p);
+
+/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream 16QAM/64QAM reception.
+    @param stream0_in Input from channel compensated (MR combined) stream 0
+    @param stream1_in Input from channel compensated (MR combined) stream 1
+    @param ch_mag   Input from scaled channel magnitude square of h0'*g0
+    @param ch_mag_i Input from scaled channel magnitude square of h0'*g1
+    @param stream0_out Output from LLR unit for stream0
+    @param rho01 Cross-correlation between channels (MR combined)
+    @param length in complex channel outputs*/
+void qam16_qam64(short *stream0_in,
+                 short *stream1_in,
+                 short *ch_mag,
+                 short *ch_mag_i,
+                 short *stream0_out,
+                 short *rho01,
+                 int length);
+
+/** \brief This function perform LLR computation for dual-stream (16QAM/64QAM) transmission.
+    @param frame_parms Frame descriptor structure
+    @param rxdataF_comp Compensated channel output
+    @param rxdataF_comp_i Compensated channel output for interference
+    @param ch_mag   Input from scaled channel magnitude square of h0'*g0
+    @param ch_mag_i Input from scaled channel magnitude square of h0'*g1
+    @param rho_i Correlation between channel of signal and inteference
+    @param dlsch_llr llr output
+    @param symbol OFDM symbol index in sub-frame
+    @param first_symbol_flag flag to indicate this is the first symbol of the dlsch
+    @param nb_rb number of RBs for this allocation
+    @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS
+    @param llr16p pointer to pointer to symbol in dlsch_llr*/
+int nr_dlsch_16qam_64qam_llr(NR_DL_FRAME_PARMS *frame_parms,
+                          int **rxdataF_comp,
+                          int **rxdataF_comp_i,
+                          int **dl_ch_mag,   //|h_0|^2*(2/sqrt{10})
+                          int **dl_ch_mag_i, //|h_1|^2*(2/sqrt{10})
+                          int **rho_i,
+                          short *dlsch_llr,
+                          unsigned char symbol,
+                          unsigned char first_symbol_flag,
+                          unsigned short nb_rb,
+                          uint16_t pbch_pss_sss_adjust,
+                          short **llr16p);
+
+/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream 64QAM/64QAM reception.
+    @param stream0_in Input from channel compensated (MR combined) stream 0
+    @param stream1_in Input from channel compensated (MR combined) stream 1
+    @param ch_mag   Input from scaled channel magnitude square of h0'*g0
+    @param stream0_out Output from LLR unit for stream0
+    @param rho01 Cross-correlation between channels (MR combined)
+    @param length in complex channel outputs*/
+void qam64_qpsk(short *stream0_in,
+                short *stream1_in,
+                short *ch_mag,
+                short *stream0_out,
+                short *rho01,
+                int length);
+
+/** \brief This function perform LLR computation for dual-stream (64QAM/64QAM) transmission.
+    @param frame_parms Frame descriptor structure
+    @param rxdataF_comp Compensated channel output
+    @param rxdataF_comp_i Compensated channel output for interference
+    @param ch_mag   Input from scaled channel magnitude square of h0'*g0
+    @param rho_i Correlation between channel of signal and inteference
+    @param dlsch_llr llr output
+    @param symbol OFDM symbol index in sub-frame
+    @param first_symbol_flag flag to indicate this is the first symbol of the dlsch
+    @param nb_rb number of RBs for this allocation
+    @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS
+    @param llr16p pointer to pointer to symbol in dlsch_llr*/
+int nr_dlsch_64qam_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms,
+                         int **rxdataF_comp,
+                         int **rxdataF_comp_i,
+                         int **dl_ch_mag,
+                         int **rho_i,
+                         short *dlsch_llr,
+                         unsigned char symbol,
+                         unsigned char first_symbol_flag,
+                         unsigned short nb_rb,
+                         uint16_t pbch_pss_sss_adjust,
+                         short **llr16p);
+
+/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream 64QAM/16QAM reception.
+    @param stream0_in Input from channel compensated (MR combined) stream 0
+    @param stream1_in Input from channel compensated (MR combined) stream 1
+    @param ch_mag   Input from scaled channel magnitude square of h0'*g0
+    @param ch_mag_i Input from scaled channel magnitude square of h0'*g1
+    @param stream0_out Output from LLR unit for stream0
+    @param rho01 Cross-correlation between channels (MR combined)
+    @param length in complex channel outputs*/
+void qam64_qam16(short *stream0_in,
+                 short *stream1_in,
+                 short *ch_mag,
+                 short *ch_mag_i,
+                 short *stream0_out,
+                 short *rho01,
+                 int length);
+
+/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream 64QAM/16QAM reception.
+    @param stream0_in Input from channel compensated (MR combined) stream 0
+    @param stream1_in Input from channel compensated (MR combined) stream 1
+    @param ch_mag   Input from scaled channel magnitude square of h0'*g0
+    @param ch_mag_i Input from scaled channel magnitude square of h0'*g1
+    @param stream0_out Output from LLR unit for stream0
+    @param rho01 Cross-correlation between channels (MR combined)
+    @param length in complex channel outputs*/
+void qam64_qam16_avx2(short *stream0_in,
+                      short *stream1_in,
+                      short *ch_mag,
+                      short *ch_mag_i,
+                      short *stream0_out,
+                      short *rho01,
+                      int length);
+
+/** \brief This function perform LLR computation for dual-stream (64QAM/16QAM) transmission.
+    @param frame_parms Frame descriptor structure
+    @param rxdataF_comp Compensated channel output
+    @param rxdataF_comp_i Compensated channel output for interference
+    @param ch_mag   Input from scaled channel magnitude square of h0'*g0
+    @param ch_mag_i Input from scaled channel magnitude square of h0'*g1
+    @param rho_i Correlation between channel of signal and inteference
+    @param dlsch_llr llr output
+    @param symbol OFDM symbol index in sub-frame
+    @param first_symbol_flag flag to indicate this is the first symbol of the dlsch
+    @param nb_rb number of RBs for this allocation
+    @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS
+    @param llr16p pointer to pointer to symbol in dlsch_llr*/
+int nr_dlsch_64qam_16qam_llr(NR_DL_FRAME_PARMS *frame_parms,
+                          int **rxdataF_comp,
+                          int **rxdataF_comp_i,
+                          int **dl_ch_mag,
+                          int **dl_ch_mag_i,
+                          int **rho_i,
+                          short *dlsch_llr,
+                          unsigned char symbol,
+                          unsigned char first_symbol_flag,
+                          unsigned short nb_rb,
+                          uint16_t pbch_pss_sss_adjust,
+                          short **llr16p);
+
+/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream 64QAM/64QAM reception.
+    @param stream0_in Input from channel compensated (MR combined) stream 0
+    @param stream1_in Input from channel compensated (MR combined) stream 1
+    @param ch_mag   Input from scaled channel magnitude square of h0'*g0
+    @param ch_mag_i Input from scaled channel magnitude square of h0'*g1
+    @param stream0_out Output from LLR unit for stream0
+    @param rho01 Cross-correlation between channels (MR combined)
+    @param length in complex channel outputs*/
+void qam64_qam64(short *stream0_in,
+                 short *stream1_in,
+                 short *ch_mag,
+                 short *ch_mag_i,
+                 short *stream0_out,
+                 short *rho01,
+                 int length);
+
+/** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream 64QAM/64QAM reception.
+    @param stream0_in Input from channel compensated (MR combined) stream 0
+    @param stream1_in Input from channel compensated (MR combined) stream 1
+    @param ch_mag   Input from scaled channel magnitude square of h0'*g0
+    @param ch_mag_i Input from scaled channel magnitude square of h0'*g1
+    @param stream0_out Output from LLR unit for stream0
+    @param rho01 Cross-correlation between channels (MR combined)
+    @param length in complex channel outputs*/
+void qam64_qam64_avx2(int32_t *stream0_in,
+                      int32_t *stream1_in,
+                      int32_t *ch_mag,
+                      int32_t *ch_mag_i,
+                      int16_t *stream0_out,
+                      int32_t *rho01,
+                      int length);
+
+/** \brief This function perform LLR computation for dual-stream (64QAM/64QAM) transmission.
+    @param frame_parms Frame descriptor structure
+    @param rxdataF_comp Compensated channel output
+    @param rxdataF_comp_i Compensated channel output for interference
+    @param ch_mag   Input from scaled channel magnitude square of h0'*g0
+    @param ch_mag_i Input from scaled channel magnitude square of h0'*g1
+    @param rho_i Correlation between channel of signal and inteference
+    @param dlsch_llr llr output
+    @param symbol OFDM symbol index in sub-frame
+    @param first_symbol_flag flag to indicate this is the first symbol of the dlsch
+    @param nb_rb number of RBs for this allocation
+    @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS
+    @param llr16p pointer to pointer to symbol in dlsch_llr*/
+int nr_dlsch_64qam_64qam_llr(NR_DL_FRAME_PARMS *frame_parms,
+                          int **rxdataF_comp,
+                          int **rxdataF_comp_i,
+                          int **dl_ch_mag,
+                          int **dl_ch_mag_i,
+                          int **rho_i,
+                          short *dlsch_llr,
+                          unsigned char symbol,
+						  uint32_t len,
+                          unsigned char first_symbol_flag,
+                          unsigned short nb_rb,
+                          uint16_t pbch_pss_sss_adjust,
+                          //short **llr16p,
+                          uint32_t llr_offset);
+
+
+/** \brief This function generates log-likelihood ratios (decoder input) for single-stream QPSK received waveforms.
+    @param frame_parms Frame descriptor structure
+    @param rxdataF_comp Compensated channel output
+    @param dlsch_llr llr output
+    @param symbol OFDM symbol index in sub-frame
+    @param first_symbol_flag
+    @param nb_rb number of RBs for this allocation
+    @param pbch_pss_sss_adj Number of channel bits taken by PBCH/PSS/SSS
+    @param llr128p pointer to pointer to symbol in dlsch_llr
+    @param beamforming_mode beamforming mode
+*/
+int32_t nr_dlsch_qpsk_llr(NR_DL_FRAME_PARMS *frame_parms,
+                   int32_t **rxdataF_comp,
+                   int16_t *dlsch_llr,
+                   uint8_t symbol,
+				   uint32_t len,
+				   uint8_t first_symbol_flag,
+                   uint16_t nb_rb,
+                   uint8_t beamforming_mode);
+
+/**
+   \brief This function generates log-likelihood ratios (decoder input) for single-stream 16QAM received waveforms
+   @param frame_parms Frame descriptor structure
+   @param rxdataF_comp Compensated channel output
+   @param dlsch_llr llr output
+   @param dl_ch_mag Squared-magnitude of channel in each resource element position corresponding to allocation and weighted for mid-point in 16QAM constellation
+   @param symbol OFDM symbol index in sub-frame
+   @param first_symbol_flag
+   @param nb_rb number of RBs for this allocation
+   @param pbch_pss_sss_adjust  Adjustment factor in RE for PBCH/PSS/SSS allocations
+   @param llr128p pointer to pointer to symbol in dlsch_llr
+   @param beamforming_mode beamforming mode
+*/
+
+int32_t nr_dlsch_qpsk_llr_SIC(NR_DL_FRAME_PARMS *frame_parms,
+                           int **rxdataF_comp,
+                           int32_t **sic_buffer,
+                           int **rho_i,
+                           short *dlsch_llr,
+                           uint8_t num_pdcch_symbols,
+                           uint16_t nb_rb,
+                           uint8_t subframe,
+                           uint16_t mod_order_0,
+                           uint32_t rb_alloc);
+
+void nr_dlsch_16qam_llr(NR_DL_FRAME_PARMS *frame_parms,
+                     int32_t **rxdataF_comp,
+                     int16_t *dlsch_llr,
+                     int32_t **dl_ch_mag,
+                     uint8_t symbol,
+					 uint32_t len,
+                     uint8_t first_symbol_flag,
+                     uint16_t nb_rb,
+                     int16_t **llr32p,
+                     uint8_t beamforming_mode);
+/**
+   \brief This function generates log-likelihood ratios (decoder input) for single-stream 16QAM received waveforms
+   @param frame_parms Frame descriptor structure
+   @param rxdataF_comp Compensated channel output
+   @param dlsch_llr llr output
+   @param dl_ch_mag Squared-magnitude of channel in each resource element position corresponding to allocation, weighted by first mid-point of 64-QAM constellation
+   @param dl_ch_magb Squared-magnitude of channel in each resource element position corresponding to allocation, weighted by second mid-point of 64-QAM constellation
+   @param symbol OFDM symbol index in sub-frame
+   @param first_symbol_flag
+   @param nb_rb number of RBs for this allocation
+   @param pbch_pss_sss_adjust PBCH/PSS/SSS RE adjustment (in REs)
+   @param beamforming_mode beamforming mode
+*/
+void nr_dlsch_16qam_llr_SIC (NR_DL_FRAME_PARMS *frame_parms,
+                          int32_t **rxdataF_comp,
+                          int32_t **sic_buffer,  //Q15
+                          int32_t **rho_i,
+                          int16_t *dlsch_llr,
+                          uint8_t num_pdcch_symbols,
+                          int32_t **dl_ch_mag,
+                          uint16_t nb_rb,
+                          uint8_t subframe,
+                          uint16_t mod_order_0,
+                          uint32_t rb_alloc);
+
+void dlsch_64qam_llr_SIC(NR_DL_FRAME_PARMS *frame_parms,
+                         int32_t **rxdataF_comp,
+                         int32_t **sic_buffer,  //Q15
+                         int32_t **rho_i,
+                         int16_t *dlsch_llr,
+                         uint8_t num_pdcch_symbols,
+                         int32_t **dl_ch_mag,
+                         int32_t **dl_ch_magb,
+                         uint16_t nb_rb,
+                         uint8_t subframe,
+                         uint16_t mod_order_0,
+                         uint32_t rb_alloc);
+
+void nr_dlsch_64qam_llr(NR_DL_FRAME_PARMS *frame_parms,
+                     int32_t **rxdataF_comp,
+                     int16_t *dlsch_llr,
+                     int32_t **dl_ch_mag,
+                     int32_t **dl_ch_magb,
+                     uint8_t symbol,
+					 uint32_t len,
+                     uint8_t first_symbol_flag,
+                     uint16_t nb_rb,
+                     uint32_t llr_offset,
+                     uint8_t beamforming_mode);
+
+
+/** \fn dlsch_siso(NR_DL_FRAME_PARMS *frame_parms,
+    int32_t **rxdataF_comp,
+    int32_t **rxdataF_comp_i,
+    uint8_t l,
+    uint16_t nb_rb)
+    \brief This function does the first stage of llr computation for SISO, by just extracting the pilots, PBCH and primary/secondary synchronization sequences.
+    @param frame_parms Frame descriptor structure
+    @param rxdataF_comp Compensated channel output
+    @param rxdataF_comp_i Compensated channel output for interference
+    @param l symbol in sub-frame
+    @param nb_rb Number of RBs in this allocation
+*/
+
+void dlsch_siso(NR_DL_FRAME_PARMS *frame_parms,
+                int32_t **rxdataF_comp,
+                int32_t **rxdataF_comp_i,
+                uint8_t l,
+                uint16_t nb_rb);
+
+/** \fn dlsch_alamouti(NR_DL_FRAME_PARMS *frame_parms,
+    int32_t **rxdataF_comp,
+    int32_t **dl_ch_mag,
+    int32_t **dl_ch_magb,
+    uint8_t symbol,
+    uint16_t nb_rb)
+    \brief This function does Alamouti combining on RX and prepares LLR inputs by skipping pilots, PBCH and primary/secondary synchronization signals.
+    @param frame_parms Frame descriptor structure
+    @param rxdataF_comp Compensated channel output
+    @param dl_ch_mag First squared-magnitude of channel (16QAM and 64QAM) for LLR computation.  Alamouti combining should be performed on this as well. Result is stored in first antenna position
+    @param dl_ch_magb Second squared-magnitude of channel (64QAM only) for LLR computation.  Alamouti combining should be performed on this as well. Result is stored in first antenna position
+    @param symbol Symbol in sub-frame
+    @param nb_rb Number of RBs in this allocation
+*/
+void dlsch_alamouti(NR_DL_FRAME_PARMS *frame_parms,
+                    int32_t **rxdataF_comp,
+                    int32_t **dl_ch_mag,
+                    int32_t **dl_ch_magb,
+                    uint8_t symbol,
+                    uint16_t nb_rb);
+
+/** \fn dlsch_antcyc(NR_DL_FRAME_PARMS *frame_parms,
+    int32_t **rxdataF_comp,
+    int32_t **dl_ch_mag,
+    int32_t **dl_ch_magb,
+    uint8_t symbol,
+    uint16_t nb_rb)
+    \brief This function does antenna selection (based on antenna cycling pattern) on RX and prepares LLR inputs by skipping pilots, PBCH and primary/secondary synchronization signals.  Note that this is not LTE, it is just included for comparison purposes.
+    @param frame_parms Frame descriptor structure
+    @param rxdataF_comp Compensated channel output
+    @param dl_ch_mag First squared-magnitude of channel (16QAM and 64QAM) for LLR computation.  Alamouti combining should be performed on this as well. Result is stored in first antenna position
+    @param dl_ch_magb Second squared-magnitude of channel (64QAM only) for LLR computation.  Alamouti combining should be performed on this as well. Result is stored in first antenna position
+    @param symbol Symbol in sub-frame
+    @param nb_rb Number of RBs in this allocation
+*/
+void dlsch_antcyc(NR_DL_FRAME_PARMS *frame_parms,
+                  int32_t **rxdataF_comp,
+                  int32_t **dl_ch_mag,
+                  int32_t **dl_ch_magb,
+                  uint8_t symbol,
+                  uint16_t nb_rb);
+
+/** \fn dlsch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms,
+    int32_t **rxdataF_comp,
+    int32_t **rxdataF_comp_i,
+    int32_t **rho,
+    int32_t **rho_i,
+    int32_t **dl_ch_mag,
+    int32_t **dl_ch_magb,
+    uint8_t symbol,
+    uint16_t nb_rb,
+    uint8_t dual_stream_UE)
+
+    \brief This function does maximal-ratio combining for dual-antenna receivers.
+    @param frame_parms Frame descriptor structure
+    @param rxdataF_comp Compensated channel output
+    @param rxdataF_comp_i Compensated channel output for interference
+    @param rho Cross correlation between spatial channels
+    @param rho_i Cross correlation between signal and inteference channels
+    @param dl_ch_mag First squared-magnitude of channel (16QAM and 64QAM) for LLR computation.  Alamouti combining should be performed on this as well. Result is stored in first antenna position
+    @param dl_ch_magb Second squared-magnitude of channel (64QAM only) for LLR computation.  Alamouti combining should be performed on this as well. Result is stored in first antenna position
+    @param symbol Symbol in sub-frame
+    @param nb_rb Number of RBs in this allocation
+    @param dual_stream_UE Flag to indicate dual-stream detection
+*/
+void dlsch_detection_mrc(NR_DL_FRAME_PARMS *frame_parms,
+                         int32_t **rxdataF_comp,
+                         int32_t **rxdataF_comp_i,
+                         int32_t **rho,
+                         int32_t **rho_i,
+                         int32_t **dl_ch_mag,
+                         int32_t **dl_ch_magb,
+                         int32_t **dl_ch_mag_i,
+                         int32_t **dl_ch_magb_i,
+                         uint8_t symbol,
+                         uint16_t nb_rb,
+                         uint8_t dual_stream_UE);
+
+void dlsch_detection_mrc_TM34(NR_DL_FRAME_PARMS *frame_parms,
+                              NR_UE_PDSCH *lte_ue_pdsch_vars,
+                              int harq_pid,
+                              int round,
+                              unsigned char symbol,
+                              unsigned short nb_rb,
+                              unsigned char dual_stream_UE);
+
+/** \fn dlsch_extract_rbs_single(int32_t **rxdataF,
+    int32_t **dl_ch_estimates,
+    int32_t **rxdataF_ext,
+    int32_t **dl_ch_estimates_ext,
+    uint16_t pmi,
+    uint8_t *pmi_ext,
+    uint32_t *rb_alloc,
+    uint8_t symbol,
+    uint8_t subframe,
+    NR_DL_FRAME_PARMS *frame_parms)
+    \brief This function extracts the received resource blocks, both channel estimates and data symbols,
+    for the current allocation and for single antenna eNB transmission.
+    @param rxdataF Raw FFT output of received signal
+    @param dl_ch_estimates Channel estimates of current slot
+    @param rxdataF_ext FFT output for RBs in this allocation
+    @param dl_ch_estimates_ext Channel estimates for RBs in this allocation
+    @param pmi subband Precoding matrix indicator
+    @param pmi_ext Extracted PMI for chosen RBs
+    @param rb_alloc RB allocation vector
+    @param symbol Symbol to extract
+    @param subframe Subframe number
+    @param vrb_type Flag to indicate distributed VRB type
+    @param high_speed_flag
+    @param frame_parms Pointer to frame descriptor
+*/
+/*uint16_t nr_dlsch_extract_rbs_single(int32_t **rxdataF,
+                                  int32_t **dl_ch_estimates,
+                                  int32_t **rxdataF_ext,
+                                  int32_t **dl_ch_estimates_ext,
+                                  uint16_t pmi,
+                                  uint8_t *pmi_ext,
+                                  uint32_t *rb_alloc,
+                                  uint8_t symbol,
+                                  uint8_t subframe,
+                                  uint32_t high_speed_flag,
+                                  NR_DL_FRAME_PARMS *frame_parms);*/
+
+unsigned short nr_dlsch_extract_rbs_single(int **rxdataF,
+                                        int **dl_ch_estimates,
+                                        int **rxdataF_ext,
+                                        int **dl_ch_estimates_ext,
+                                        unsigned short pmi,
+                                        unsigned char *pmi_ext,
+                                        unsigned char symbol,
+										uint8_t pilots,
+										unsigned short start_rb,
+										unsigned short nb_pdsch_rb,
+                                        unsigned char nr_tti_rx,
+                                        uint32_t high_speed_flag,
+                                        NR_DL_FRAME_PARMS *frame_parms);
+
+/** \fn dlsch_extract_rbs_dual(int32_t **rxdataF,
+    int32_t **dl_ch_estimates,
+    int32_t **rxdataF_ext,
+    int32_t **dl_ch_estimates_ext,
+    uint16_t pmi,
+    uint8_t *pmi_ext,
+    uint32_t *rb_alloc,
+    uint8_t symbol,
+    NR_DL_FRAME_PARMS *frame_parms)
+    \brief This function extracts the received resource blocks, both channel estimates and data symbols,
+    for the current allocation and for dual antenna eNB transmission.
+    @param rxdataF Raw FFT output of received signal
+    @param dl_ch_estimates Channel estimates of current slot
+    @param rxdataF_ext FFT output for RBs in this allocation
+    @param dl_ch_estimates_ext Channel estimates for RBs in this allocation
+    @param pmi subband Precoding matrix indicator
+    @param pmi_ext Extracted PMI for chosen RBs
+    @param rb_alloc RB allocation vector
+    @param symbol Symbol to extract
+    @param subframe Subframe index
+    @param high_speed_flag
+    @param frame_parms Pointer to frame descriptor
+*/
+unsigned short nr_dlsch_extract_rbs_dual(int **rxdataF,
+                                      int **dl_ch_estimates,
+                                      int **rxdataF_ext,
+                                      int **dl_ch_estimates_ext,
+                                      unsigned short pmi,
+                                      unsigned char *pmi_ext,
+                                      unsigned char symbol,
+									  uint8_t pilots,
+									  unsigned short start_rb,
+									  unsigned short nb_rb_pdsch,
+                                      unsigned char nr_tti_rx,
+                                      uint32_t high_speed_flag,
+                                      NR_DL_FRAME_PARMS *frame_parms,
+                                      MIMO_mode_t mimo_mode);
+
+/** \fn dlsch_extract_rbs_TM7(int32_t **rxdataF,
+    int32_t **dl_bf_ch_estimates,
+    int32_t **rxdataF_ext,
+    int32_t **dl_bf_ch_estimates_ext,
+    uint32_t *rb_alloc,
+    uint8_t symbol,
+    uint8_t subframe,
+    uint32_t high_speed_flag,
+    NR_DL_FRAME_PARMS *frame_parms)
+    \brief This function extracts the received resource blocks, both channel estimates and data symbols,
+    for the current allocation and for single antenna eNB transmission.
+    @param rxdataF Raw FFT output of received signal
+    @param dl_bf_ch_estimates Beamforming channel estimates of current slot
+    @param rxdataF_ext FFT output for RBs in this allocation
+    @param dl_bf_ch_estimates_ext Beamforming channel estimates for RBs in this allocation
+    @param rb_alloc RB allocation vector
+    @param symbol Symbol to extract
+    @param subframe Subframe number
+    @param high_speed_flag
+    @param frame_parms Pointer to frame descriptor
+*/
+uint16_t dlsch_extract_rbs_TM7(int32_t **rxdataF,
+                               int32_t **dl_bf_ch_estimates,
+                               int32_t **rxdataF_ext,
+                               int32_t **dl_bf_ch_estimates_ext,
+                               uint32_t *rb_alloc,
+                               uint8_t symbol,
+                               uint8_t subframe,
+                               uint32_t high_speed_flag,
+                               NR_DL_FRAME_PARMS *frame_parms);
+
+/** \brief This function performs channel compensation (matched filtering) on the received RBs for this allocation.  In addition, it computes the squared-magnitude of the channel with weightings for 16QAM/64QAM detection as well as dual-stream detection (cross-correlation)
+    @param rxdataF_ext Frequency-domain received signal in RBs to be demodulated
+    @param dl_ch_estimates_ext Frequency-domain channel estimates in RBs to be demodulated
+    @param dl_ch_mag First Channel magnitudes (16QAM/64QAM)
+    @param dl_ch_magb Second weighted Channel magnitudes (64QAM)
+    @param rxdataF_comp Compensated received waveform
+    @param rho Cross-correlation between two spatial channels on each RX antenna
+    @param frame_parms Pointer to frame descriptor
+    @param symbol Symbol on which to operate
+    @param first_symbol_flag set to 1 on first DLSCH symbol
+    @param mod_order Modulation order of allocation
+    @param nb_rb Number of RBs in allocation
+    @param output_shift Rescaling for compensated output (should be energy-normalizing)
+    @param phy_measurements Pointer to UE PHY measurements
+*/
+void nr_dlsch_channel_compensation(int32_t **rxdataF_ext,
+                                int32_t **dl_ch_estimates_ext,
+                                int32_t **dl_ch_mag,
+                                int32_t **dl_ch_magb,
+                                int32_t **rxdataF_comp,
+                                int32_t **rho,
+                                NR_DL_FRAME_PARMS *frame_parms,
+                                uint8_t symbol,
+								uint8_t start_symbol,
+                                uint8_t first_symbol_flag,
+                                uint8_t mod_order,
+                                uint16_t nb_rb,
+                                uint8_t output_shift,
+                                PHY_NR_MEASUREMENTS *phy_measurements);
+
+void nr_dlsch_channel_compensation_core(int **rxdataF_ext,
+                                     int **dl_ch_estimates_ext,
+                                     int **dl_ch_mag,
+                                     int **dl_ch_magb,
+                                     int **rxdataF_comp,
+                                     int **rho,
+                                     unsigned char n_tx,
+                                     unsigned char n_rx,
+                                     unsigned char mod_order,
+                                     unsigned char output_shift,
+                                     int length,
+                                     int start_point);
+
+void nr_dlsch_deinterleaving(uint8_t symbol,
+							uint8_t start_symbol,
+							uint16_t L,
+							uint16_t *llr,
+							uint16_t *llr_deint,
+							uint16_t nb_rb_pdsch);
+
+void dlsch_dual_stream_correlation(NR_DL_FRAME_PARMS *frame_parms,
+                                   unsigned char symbol,
+                                   unsigned short nb_rb,
+                                   int **dl_ch_estimates_ext,
+                                   int **dl_ch_estimates_ext_i,
+                                   int **dl_ch_rho_ext,
+                                   unsigned char output_shift);
+
+void dlsch_dual_stream_correlationTM34(NR_DL_FRAME_PARMS *frame_parms,
+                                   unsigned char symbol,
+                                   unsigned short nb_rb,
+                                   int **dl_ch_estimates_ext,
+                                   int **dl_ch_estimates_ext_i,
+                                   int **dl_ch_rho_ext,
+                                   unsigned char output_shift0,
+                                   unsigned char output_shift1);
+//This function is used to compute multiplications in Hhermitian * H matrix
+void conjch0_mult_ch1(int *ch0,
+                      int *ch1,
+                      int32_t *ch0conj_ch1,
+                      unsigned short nb_rb,
+                      unsigned char output_shift0);
+
+void construct_HhH_elements(int *ch0conj_ch0,
+                         int *ch1conj_ch1,
+                         int *ch2conj_ch2,
+                         int *ch3conj_ch3,
+                         int *ch0conj_ch1,
+                         int *ch1conj_ch0,
+                         int *ch2conj_ch3,
+                         int *ch3conj_ch2,
+                         int32_t *after_mf_00,
+                         int32_t *after_mf_01,
+                         int32_t *after_mf_10,
+                         int32_t *after_mf_11,
+                         unsigned short nb_rb);
+
+void squared_matrix_element(int32_t *Hh_h_00,
+                            int32_t *Hh_h_00_sq,
+                            unsigned short nb_rb);
+
+void dlsch_channel_level_TM34_meas(int *ch00,
+                                   int *ch01,
+                                   int *ch10,
+                                   int *ch11,
+                                   int *avg_0,
+                                   int *avg_1,
+                                   unsigned short nb_rb);
+
+void nr_dlsch_channel_level_median(int **dl_ch_estimates_ext,
+                                int32_t *median,
+                                int n_tx,
+                                int n_rx,
+                                int length,
+                                int start_point);
+
+void nr_dlsch_detection_mrc_core(int **rxdataF_comp,
+                              int **rxdataF_comp_i,
+                              int **rho,
+                              int **rho_i,
+                              int **dl_ch_mag,
+                              int **dl_ch_magb,
+                              int **dl_ch_mag_i,
+                              int **dl_ch_magb_i,
+                              unsigned char n_tx,
+                              unsigned char n_rx,
+                              int length,
+                              int start_point);
+
+void det_HhH(int32_t *after_mf_00,
+             int32_t *after_mf_01,
+             int32_t *after_mf_10,
+             int32_t *after_mf_11,
+             int32_t *det_fin_128,
+             unsigned short nb_rb);
+
+void numer(int32_t *Hh_h_00_sq,
+           int32_t *Hh_h_01_sq,
+           int32_t *Hh_h_10_sq,
+           int32_t *Hh_h_11_sq,
+           int32_t *num_fin,
+           unsigned short nb_rb);
+
+uint8_t rank_estimation_tm3_tm4(int *dl_ch_estimates_00,
+                                int *dl_ch_estimates_01,
+                                int *dl_ch_estimates_10,
+                                int *dl_ch_estimates_11,
+                                unsigned short nb_rb);
+
+void dlsch_channel_compensation_TM56(int **rxdataF_ext,
+                                     int **dl_ch_estimates_ext,
+                                     int **dl_ch_mag,
+                                     int **dl_ch_magb,
+                                     int **rxdataF_comp,
+                                     unsigned char *pmi_ext,
+                                     NR_DL_FRAME_PARMS *frame_parms,
+                                     PHY_NR_MEASUREMENTS *phy_measurements,
+                                     int eNB_id,
+                                     unsigned char symbol,
+                                     unsigned char mod_order,
+                                     unsigned short nb_rb,
+                                     unsigned char output_shift,
+                                     unsigned char dl_power_off);
+
+
+void dlsch_channel_compensation_TM34(NR_DL_FRAME_PARMS *frame_parms,
+                                    NR_UE_PDSCH *lte_ue_pdsch_vars,
+                                    PHY_NR_MEASUREMENTS *phy_measurements,
+                                    int eNB_id,
+                                    unsigned char symbol,
+                                    unsigned char mod_order0,
+                                    unsigned char mod_order1,
+                                    int harq_pid,
+                                    int round,
+                                    MIMO_mode_t mimo_mode,
+                                    unsigned short nb_rb,
+                                    unsigned char output_shift0,
+                                    unsigned char output_shift1);
+
+
+/** \brief This function computes the average channel level over all allocated RBs and antennas (TX/RX) in order to compute output shift for compensated signal
+    @param dl_ch_estimates_ext Channel estimates in allocated RBs
+    @param frame_parms Pointer to frame descriptor
+    @param avg Pointer to average signal strength
+    @param pilots_flag Flag to indicate pilots in symbol
+    @param nb_rb Number of allocated RBs
+*/
+void nr_dlsch_channel_level(int **dl_ch_estimates_ext,
+                         NR_DL_FRAME_PARMS *frame_parms,
+                         int32_t *avg,
+                         uint8_t symbol,
+						 uint32_t len,
+                         unsigned short nb_rb);
+
+
+void dlsch_channel_level_TM34(int **dl_ch_estimates_ext,
+                              NR_DL_FRAME_PARMS *frame_parms,
+                              unsigned char *pmi_ext,
+                              int *avg_0,
+                              int *avg_1,
+                              uint8_t symbol,
+                              unsigned short nb_rb,
+                              MIMO_mode_t mimo_mode);
+
+
+void dlsch_channel_level_TM56(int32_t **dl_ch_estimates_ext,
+                              NR_DL_FRAME_PARMS *frame_parms,
+                              unsigned char *pmi_ext,
+                              int32_t *avg,
+                              uint8_t symbol_mod,
+                              uint16_t nb_rb);
+
+void dlsch_channel_level_TM7(int32_t **dl_bf_ch_estimates_ext,
+                         NR_DL_FRAME_PARMS *frame_parms,
+                         int32_t *avg,
+                         uint8_t pilots_flag,
+                         uint16_t nb_rb);
+
+void nr_dlsch_scale_channel(int32_t **dl_ch_estimates_ext,
+                         NR_DL_FRAME_PARMS *frame_parms,
+                         NR_UE_DLSCH_t **dlsch_ue,
+                         uint8_t symbol,
+						 uint8_t start_symbol,
+                         uint16_t nb_rb);
+
+/** \brief This is the top-level entry point for DLSCH decoding in UE.  It should be replicated on several
+    threads (on multi-core machines) corresponding to different HARQ processes. The routine first
+    computes the segmentation information, followed by rate dematching and sub-block deinterleaving the of the
+    received LLRs computed by dlsch_demodulation for each transport block segment. It then calls the
+    turbo-decoding algorithm for each segment and stops after either after unsuccesful decoding of at least
+    one segment or correct decoding of all segments.  Only the segment CRCs are check for the moment, the
+    overall CRC is ignored.  Finally transport block reassembly is performed.
+    @param phy_vars_ue Pointer to ue variables
+    @param dlsch_llr Pointer to LLR values computed by dlsch_demodulation
+    @param lte_frame_parms Pointer to frame descriptor
+    @param dlsch Pointer to DLSCH descriptor
+    @param frame Frame number
+    @param subframe Subframe number
+    @param num_pdcch_symbols Number of PDCCH symbols
+    @param is_crnti indicates if PDSCH belongs to a CRNTI (necessary for parallelizing decoding threads)
+    @param llr8_flag If 1, indicate that the 8-bit turbo decoder should be used
+    @returns 0 on success, 1 on unsuccessful decoding
+*/
+
+uint32_t  nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
+                         short *dlsch_llr,
+                         NR_DL_FRAME_PARMS *frame_parms,
+                         NR_UE_DLSCH_t *dlsch,
+                         NR_DL_UE_HARQ_t *harq_process,
+                         uint32_t frame,
+						 uint16_t nb_symb_sch,
+                         uint8_t nr_tti_rx,
+                         uint8_t harq_pid,
+                         uint8_t is_crnti,
+                         uint8_t llr8_flag);
+
+int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
+                     NR_DL_FRAME_PARMS* frame_parms,
+                     uint8_t harq_pid);
+
+/*! \brief Perform PUSCH scrambling. TS 38.211 V15.4.0 subclause 6.3.1.1
+  @param[in] in Pointer to input bits
+  @param[in] size of input bits
+  @param[in] Nid cell id
+  @param[in] n_RNTI CRNTI
+  @param[out] out the scrambled bits
+*/
+
+void nr_pusch_codeword_scrambling(uint8_t *in,
+                         uint16_t size,
+                         uint32_t Nid,
+                         uint32_t n_RNTI,
+                         uint32_t* out);
+
+
+uint32_t  nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
+						 UE_nr_rxtx_proc_t *proc,
+                         int eNB_id,
+                         short *dlsch_llr,
+                         NR_DL_FRAME_PARMS *frame_parms,
+                         NR_UE_DLSCH_t *dlsch,
+                         NR_DL_UE_HARQ_t *harq_process,
+                         uint32_t frame,
+                         uint16_t nb_symb_sch,
+                         uint8_t nr_tti_rx,
+                         uint8_t harq_pid,
+                         uint8_t is_crnti,
+                         uint8_t llr8_flag);
+
+void *nr_dlsch_decoding_2thread0(void *arg);
+
+void *nr_dlsch_decoding_2thread1(void *arg);
+
+void nr_dlsch_unscrambling(int16_t* llr,
+			   uint32_t size,
+			   uint8_t q,
+			   uint32_t Nid,
+			   uint32_t n_RNTI);
+
+uint32_t dlsch_decoding_emul(PHY_VARS_NR_UE *phy_vars_ue,
+                             uint8_t subframe,
+                             PDSCH_t dlsch_id,
+                             uint8_t eNB_id);
+
+/** \brief This function is the top-level entry point to PDSCH demodulation, after frequency-domain transformation and channel estimation.  It performs
+    - RB extraction (signal and channel estimates)
+    - channel compensation (matched filtering)
+    - RE extraction (pilot, PBCH, synch. signals)
+    - antenna combining (MRC, Alamouti, cycling)
+    - LLR computation
+    This function supports TM1, 2, 3, 5, and 6.
+    @param PHY_VARS_NR_UE Pointer to PHY variables
+    @param type Type of PDSCH (SI_PDSCH,RA_PDSCH,PDSCH,PMCH)
+    @param eNB_id eNb index (Nid1) 0,1,2
+    @param eNB_id_i Interfering eNB index (Nid1) 0,1,2, or 3 in case of MU-MIMO IC receiver
+    @param subframe Subframe number
+    @param symbol Symbol on which to act (within sub-frame)
+    @param first_symbol_flag set to 1 on first DLSCH symbol
+    @param rx_type. rx_type=RX_IC_single_stream will enable interference cancellation of a second stream when decoding the first stream. In case of TM1, 2, 5, and this can cancel interference from a neighbouring cell given by eNB_id_i. In case of TM5, eNB_id_i should be set to n_connected_eNB to perform multi-user interference cancellation. In case of TM3, eNB_id_i should be set to eNB_id to perform co-channel interference cancellation; this option should be used together with an interference cancellation step [...]. In case of TM3, if rx_type=RX_IC_dual_stream, both streams will be decoded by applying the IC single stream receiver twice.
+    @param i_mod Modulation order of the interfering stream
+*/
+int32_t nr_rx_pdsch(PHY_VARS_NR_UE *phy_vars_ue,
+                 PDSCH_t type,
+                 uint8_t eNB_id,
+                 uint8_t eNB_id_i,
+                 uint32_t frame,
+                 uint8_t subframe,
+                 uint8_t symbol,
+                 uint8_t first_symbol_flag,
+                 RX_type_t rx_type,
+                 uint8_t i_mod,
+                 uint8_t harq_pid);
+
+int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
+                    uint32_t frame,
+                    uint8_t nr_tti_rx,
+                    uint8_t eNB_id,
+                    MIMO_mode_t mimo_mode,
+                    uint32_t high_speed_flag,
+                    uint8_t is_secondary_ue,
+                    int nb_coreset_active,
+                    uint16_t symbol_mon,
+                    NR_SEARCHSPACE_TYPE_t searchSpaceType);
+
+/*! \brief Extract PSS and SSS resource elements
+  @param phy_vars_ue Pointer to UE variables
+  @param[out] pss_ext contain the PSS signals after the extraction
+  @param[out] sss_ext contain the SSS signals after the extraction
+  @returns 0 on success
+*/
+int pss_sss_extract(PHY_VARS_NR_UE *phy_vars_ue,
+                    int32_t pss_ext[4][72],
+                    int32_t sss_ext[4][72],
+                                        uint8_t subframe);
+
+/*! \brief Extract only PSS resource elements
+  @param phy_vars_ue Pointer to UE variables
+  @param[out] pss_ext contain the PSS signals after the extraction
+  @returns 0 on success
+*/
+int pss_only_extract(PHY_VARS_NR_UE *phy_vars_ue,
+                    int32_t pss_ext[4][72],
+                    uint8_t subframe);
+
+/*! \brief Extract only SSS resource elements
+  @param phy_vars_ue Pointer to UE variables
+  @param[out] sss_ext contain the SSS signals after the extraction
+  @returns 0 on success
+*/
+int sss_only_extract(PHY_VARS_NR_UE *phy_vars_ue,
+                    int32_t sss_ext[4][72],
+                    uint8_t subframe);
+
+/*! \brief Performs detection of SSS to find cell ID and other framing parameters (FDD/TDD, normal/extended prefix)
+  @param phy_vars_ue Pointer to UE variables
+  @param tot_metric Pointer to variable containing maximum metric under framing hypothesis (to be compared to other hypotheses
+  @param flip_max Pointer to variable indicating if start of frame is in second have of RX buffer (i.e. PSS/SSS is flipped)
+  @param phase_max Pointer to variable (0 ... 6) containing rought phase offset between PSS and SSS (can be used for carrier
+  frequency adjustment. 0 means -pi/3, 6 means pi/3.
+  @returns 0 on success
+*/
+int rx_sss(PHY_VARS_NR_UE *phy_vars_ue,int32_t *tot_metric,uint8_t *flip_max,uint8_t *phase_max);
+
+/*! \brief receiver for the PBCH
+  \returns number of tx antennas or -1 if error
+*/
+int nr_rx_pbch( PHY_VARS_NR_UE *ue,
+		     UE_nr_rxtx_proc_t *proc,
+		     NR_UE_PBCH *nr_ue_pbch_vars,
+		     NR_DL_FRAME_PARMS *frame_parms,
+		     uint8_t eNB_id,
+                     uint8_t i_ssb,
+		     MIMO_mode_t mimo_mode,
+		     uint32_t high_speed_flag);
+
+int nr_pbch_detection(UE_nr_rxtx_proc_t *proc,
+		      PHY_VARS_NR_UE *ue,
+		      int pbch_initial_symbol,
+		      runmode_t mode);
+
+uint16_t rx_pbch_emul(PHY_VARS_NR_UE *phy_vars_ue,
+                      uint8_t eNB_id,
+                      uint8_t pbch_phase);
+
+
+/*! \brief PBCH unscrambling
+  This is similar to pbch_scrabling with the difference that inputs are signed s16s (llr values) and instead of flipping bits we change signs.
+  \param frame_parms Pointer to frame descriptor
+  \param llr Output of the demodulator
+  \param length Length of the sequence
+  \param frame_mod4 Frame number modulo 4*/
+void pbch_unscrambling(NR_DL_FRAME_PARMS *frame_parms,
+                       int8_t* llr,
+                       uint32_t length,
+                       uint8_t frame_mod4);
+
+
+void generate_64qam_table(void);
+void generate_16qam_table(void);
+void generate_qpsk_table(void);
+
+uint16_t extract_crc(uint8_t *dci,uint8_t DCI_LENGTH);
+
+/*! \brief LLR from two streams. This function takes two streams (qpsk modulated) and calculates the LLR, considering one stream as interference.
+  \param stream0_in pointer to first stream0
+  \param stream1_in pointer to first stream1
+  \param stream0_out pointer to output stream
+  \param rho01 pointer to correlation matrix
+  \param length*/
+void qpsk_qpsk_TM3456(short *stream0_in,
+                      short *stream1_in,
+                      short *stream0_out,
+                      short *rho01,
+                      int length
+                     );
+
+/** \brief Attempt decoding of a particular DCI with given length and format.
+    @param DCI_LENGTH length of DCI in bits
+    @param DCI_FMT Format of DCI
+    @param e e-sequence (soft bits)
+    @param decoded_output Output of Viterbi decoder
+*/
+void dci_decoding(uint8_t DCI_LENGTH,
+                  uint8_t DCI_FMT,
+                  int8_t *e,
+                  uint8_t *decoded_output);
+
+/** \brief Do 36.213 DCI decoding procedure by searching different RNTI options and aggregation levels.  Currently does
+    not employ the complexity reducing procedure based on RNTI.
+    @param phy_vars_ue UE variables
+    @param dci_alloc Pointer to DCI_ALLOC_t array to store results for DLSCH/ULSCH programming
+    @param do_common If 1 perform search in common search-space else ue-specific search-space
+    @param eNB_id eNB Index on which to act
+    @param subframe Index of subframe
+    @returns bitmap of occupied CCE positions (i.e. those detected)
+*/
+uint16_t dci_decoding_procedure(PHY_VARS_NR_UE *phy_vars_ue,
+                                DCI_ALLOC_t *dci_alloc,
+                                int do_common,
+                                int16_t eNB_id,
+                                uint8_t subframe);
+
+uint16_t dci_CRNTI_decoding_procedure(PHY_VARS_NR_UE *ue,
+                                DCI_ALLOC_t *dci_alloc,
+                                uint8_t DCIFormat,
+                                uint8_t agregationLevel,
+                                int16_t eNB_id,
+                                uint8_t subframe);
+
+uint16_t dci_decoding_procedure_emul(NR_UE_PDCCH **lte_ue_pdcch_vars,
+                                     uint8_t num_ue_spec_dci,
+                                     uint8_t num_common_dci,
+                                     DCI_ALLOC_t *dci_alloc_tx,
+                                     DCI_ALLOC_t *dci_alloc_rx,
+                                     int16_t eNB_id);
+
+/** \brief Compute Q (modulation order) based on I_MCS PDSCH.  Implements table 7.1.7.1-1 from 36.213.
+    @param I_MCS */
+uint8_t get_Qm(uint8_t I_MCS);
+
+/** \brief Compute Q (modulation order) based on I_MCS for PUSCH.  Implements table 8.6.1-1 from 36.213.
+    @param I_MCS */
+uint8_t get_Qm_ul(uint8_t I_MCS);
+
+/** \brief Compute I_TBS (transport-block size) based on I_MCS for PDSCH.  Implements table 7.1.7.1-1 from 36.213.
+    @param I_MCS */
+uint8_t get_I_TBS(uint8_t I_MCS);
+
+/** \brief Compute I_TBS (transport-block size) based on I_MCS for PUSCH.  Implements table 8.6.1-1 from 36.213.
+    @param I_MCS */
+unsigned char get_I_TBS_UL(unsigned char I_MCS);
+
+/** \brief Compute Q (modulation order) based on downlink I_MCS. Implements table 7.1.7.1-1 from 36.213.
+    @param I_MCS
+    @param nb_rb
+    @return Transport block size */
+uint32_t get_TBS_DL(uint8_t mcs, uint16_t nb_rb);
+
+/** \brief Compute Q (modulation order) based on uplink I_MCS. Implements table 7.1.7.1-1 from 36.213.
+    @param I_MCS
+    @param nb_rb
+    @return Transport block size */
+uint32_t get_TBS_UL(uint8_t mcs, uint16_t nb_rb);
+
+/* \brief Return bit-map of resource allocation for a given DCI rballoc (RIV format) and vrb type
+   @param N_RB_DL number of PRB on DL
+   @param indicator for even/odd slot
+   @param vrb vrb index
+   @param Ngap Gap indicator
+*/
+uint32_t get_prb(int N_RB_DL,int odd_slot,int vrb,int Ngap);
+
+/* \brief Return prb for a given vrb index
+   @param vrb_type VRB type (0=localized,1=distributed)
+   @param rb_alloc_dci rballoc field from DCI
+*/
+uint32_t get_rballoc(vrb_t vrb_type,uint16_t rb_alloc_dci);
+
+
+/* \brief Return bit-map of resource allocation for a given DCI rballoc (RIV format) and vrb type
+   @returns Transmission mode (1-7)
+*/
+uint8_t get_transmission_mode(module_id_t Mod_id, uint8_t CC_id, rnti_t rnti);
+
+
+/* \brief
+   @param ra_header Header of resource allocation (0,1) (See sections 7.1.6.1/7.1.6.2 of 36.213 Rel8.6)
+   @param rb_alloc Bitmap allocation from DCI (format 1,2)
+   @returns number of physical resource blocks
+*/
+uint32_t conv_nprb(uint8_t ra_header,uint32_t rb_alloc,int N_RB_DL);
+
+int get_G(NR_DL_FRAME_PARMS *frame_parms,uint16_t nb_rb,uint32_t *rb_alloc,uint8_t mod_order,uint8_t Nl,uint8_t num_pdcch_symbols,int frame,uint8_t subframe, uint8_t beamforming_mode);
+
+int adjust_G(NR_DL_FRAME_PARMS *frame_parms,uint32_t *rb_alloc,uint8_t mod_order,uint8_t subframe);
+int adjust_G2(NR_DL_FRAME_PARMS *frame_parms,uint32_t *rb_alloc,uint8_t mod_order,uint8_t subframe,uint8_t symbol);
+
+
+#ifndef modOrder
+#define modOrder(I_MCS,I_TBS) ((I_MCS-I_TBS)*2+2) // Find modulation order from I_TBS and I_MCS
+#endif
+
+/** \fn uint8_t I_TBS2I_MCS(uint8_t I_TBS);
+    \brief This function maps I_tbs to I_mcs according to Table 7.1.7.1-1 in 3GPP TS 36.213 V8.6.0. Where there is two supported modulation orders for the same I_TBS then either high or low modulation is chosen by changing the equality of the two first comparisons in the if-else statement.
+    \param I_TBS Index of Transport Block Size
+    \return I_MCS given I_TBS
+*/
+uint8_t I_TBS2I_MCS(uint8_t I_TBS);
+
+/** \fn uint8_t SE2I_TBS(float SE,
+    uint8_t N_PRB,
+    uint8_t symbPerRB);
+    \brief This function maps a requested throughput in number of bits to I_tbs. The throughput is calculated as a function of modulation order, RB allocation and number of symbols per RB. The mapping orginates in the "Transport block size table" (Table 7.1.7.2.1-1 in 3GPP TS 36.213 V8.6.0)
+    \param SE Spectral Efficiency (before casting to integer, multiply by 1024, remember to divide result by 1024!)
+    \param N_PRB Number of PhysicalResourceBlocks allocated \sa lte_frame_parms->N_RB_DL
+    \param symbPerRB Number of symbols per resource block allocated to this channel
+    \return I_TBS given an SE and an N_PRB
+*/
+uint8_t SE2I_TBS(float SE,
+                 uint8_t N_PRB,
+                 uint8_t symbPerRB);
+/** \brief This function generates the sounding reference symbol (SRS) for the uplink according to 36.211 v8.6.0. If IFFT_FPGA is defined, the SRS is quantized to a QPSK sequence.
+    @param frame_parms LTE DL Frame Parameters
+    @param soundingrs_ul_config_dedicated Dynamic configuration from RRC during Connection Establishment
+    @param txdataF pointer to the frequency domain TX signal
+    @returns 0 on success*/
+int generate_srs(NR_DL_FRAME_PARMS *frame_parms,
+		 SOUNDINGRS_UL_CONFIG_DEDICATED *soundingrs_ul_config_dedicated,
+		 int *txdataF,
+		 int16_t amp,
+		 uint32_t subframe);
+
+
+/*!
+  \brief This function is similar to generate_srs_tx but generates a conjugate sequence for channel estimation. If IFFT_FPGA is defined, the SRS is quantized to a QPSK sequence.
+  @param phy_vars_ue Pointer to PHY_VARS structure
+  @param eNB_id Index of destination eNB for this SRS
+  @param amp Linear amplitude of SRS
+  @param subframe Index of subframe on which to act
+  @returns 0 on success, -1 on error with message
+*/
+
+int32_t generate_srs_tx(PHY_VARS_NR_UE *phy_vars_ue,
+                        uint8_t eNB_id,
+                        int16_t amp,
+                        uint32_t subframe);
+
+/*!
+  \brief This function generates the downlink reference signal for the PUSCH according to 36.211 v8.6.0. The DRS occuies the RS defined by rb_alloc and the symbols 2 and 8 for extended CP and 3 and 10 for normal CP.
+*/
+
+int32_t generate_drs_pusch(PHY_VARS_NR_UE *phy_vars_ue,
+                           UE_nr_rxtx_proc_t *proc,
+                           uint8_t eNB_id,
+                           int16_t amp,
+                           uint32_t subframe,
+                           uint32_t first_rb,
+                           uint32_t nb_rb,
+                           uint8_t ant);
+
+/*!
+  \brief This function initializes the Group Hopping, Sequence Hopping and nPRS sequences for PUCCH/PUSCH according to 36.211 v8.6.0. It should be called after configuration of UE (reception of SIB2/3) and initial configuration of eNB (or after reconfiguration of cell-specific parameters).
+  @param frame_parms Pointer to a NR_DL_FRAME_PARMS structure (eNB or UE)*/
+void init_ul_hopping(NR_DL_FRAME_PARMS *frame_parms);
+
+
+/*!
+  \brief This function implements the initialization of paging parameters for UE (See Section 7, 36.304).It must be called after setting IMSImod1024 during UE startup and after receiving SIB2
+  @param ue Pointer to UE context
+  @param defaultPagingCycle T from 36.304 (0=32,1=64,2=128,3=256)
+  @param nB nB from 36.304 (0=4T,1=2T,2=T,3=T/2,4=T/4,5=T/8,6=T/16,7=T/32*/
+int init_ue_paging_info(PHY_VARS_NR_UE *ue, long defaultPagingCycle, long nB);
+
+int32_t compareints (const void * a, const void * b);
+
+
+void ulsch_modulation(int32_t **txdataF,
+                      int16_t amp,
+                      frame_t frame,
+                      uint32_t subframe,
+                      NR_DL_FRAME_PARMS *frame_parms,
+                      NR_UE_ULSCH_t *ulsch);
+
+
+
+
+
+
+int generate_ue_dlsch_params_from_dci(int frame,
+                                      uint8_t subframe,
+                                      void *dci_pdu,
+                                      rnti_t rnti,
+                                      DCI_format_t dci_format,
+                                      NR_UE_PDCCH *pdcch_vars,
+                                      NR_UE_PDSCH *pdsch_vars,
+                                      NR_UE_DLSCH_t **dlsch,
+                                      NR_DL_FRAME_PARMS *frame_parms,
+                                      PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
+                                      uint16_t si_rnti,
+                                      uint16_t ra_rnti,
+                                      uint16_t p_rnti,
+                                      uint8_t beamforming_mode,
+                                      uint16_t tc_rnti);
+
+
+int generate_ue_ulsch_params_from_dci(void *dci_pdu,
+                                      rnti_t rnti,
+                                      uint8_t subframe,
+                                      DCI_format_t dci_format,
+                                      PHY_VARS_NR_UE *phy_vars_ue,
+                                      UE_nr_rxtx_proc_t *proc,
+                                      uint16_t si_rnti,
+                                      uint16_t ra_rnti,
+                                      uint16_t p_rnti,
+                                      uint16_t cba_rnti,
+                                      uint8_t eNB_id,
+                                      uint8_t use_srs);
+
+int32_t generate_ue_ulsch_params_from_rar(PHY_VARS_NR_UE *phy_vars_ue,
+                                          UE_nr_rxtx_proc_t *proc,
+                                          uint8_t eNB_id);
+double sinr_eff_cqi_calc(PHY_VARS_NR_UE *phy_vars_ue,
+                         uint8_t eNB_id,
+                                                 uint8_t subframe);
+
+uint8_t sinr2cqi(double sinr,uint8_t trans_mode);
+
+
+int dump_dci(NR_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci);
+
+int dump_ue_stats(PHY_VARS_NR_UE *phy_vars_ue, UE_nr_rxtx_proc_t *proc, char* buffer, int length, runmode_t mode, int input_level_dBm);
+
+void init_transport_channels(uint8_t);
+
+void generate_RIV_tables(void);
+
+/*!
+  \brief This function performs the initial cell search procedure - PSS detection, SSS detection and PBCH detection.  At the
+  end, the basic frame parameters are known (Frame configuration - TDD/FDD and cyclic prefix length,
+  N_RB_DL, PHICH_CONFIG and Nid_cell) and the UE can begin decoding PDCCH and DLSCH SI to retrieve the rest.  Once these
+  parameters are know, the routine calls some basic initialization routines (cell-specific reference signals, etc.)
+  @param phy_vars_ue Pointer to UE variables
+  @param mode current running mode
+*/
+int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
+                    PHY_VARS_NR_UE *phy_vars_ue, runmode_t mode);
+
+
+/*!
+  \brief Encoding of PUSCH/ACK/RI/ACK from 36-212.
+  @param a Pointer to ulsch SDU
+  @param frame_parms Pointer to Frame parameters
+  @param ulsch Pointer to ulsch descriptor
+  @param harq_pid HARQ process ID
+  @param tmode Transmission mode (1-7)
+  @param control_only_flag Generate PUSCH with control information only
+  @param Nbundled Parameter for ACK/NAK bundling (36.213 Section 7.3)
+*/
+uint32_t ulsch_encoding(uint8_t *a,
+                        PHY_VARS_NR_UE *phy_vars_ue,
+                        uint8_t harq_pid,
+                        uint8_t eNB_id,
+                        uint8_t subframe_rx,
+                        uint8_t tmode,
+                        uint8_t control_only_flag,
+                        uint8_t Nbundled);
+
+void print_CQI(void *o,UCI_format_t uci_format,uint8_t eNB_id,int N_RB_DL);
+
+void fill_CQI(NR_UE_ULSCH_t *ulsch,PHY_NR_MEASUREMENTS *meas,uint8_t eNB_id, uint8_t harq_pid,int N_RB_DL, rnti_t rnti, uint8_t trans_mode,double sinr_eff);
+
+void reset_cba_uci(void *o);
+
+/** \brief  This routine computes the subband PMI bitmap based on measurements (0,1,2,3 for rank 0 and 0,1 for rank 1) in the format needed for UCI
+    @param meas pointer to measurements
+    @param eNB_id eNB_id
+    @param nb_subbands number of subbands
+    @returns subband PMI bitmap
+*/
+uint16_t quantize_subband_pmi(PHY_NR_MEASUREMENTS *meas,uint8_t eNB_id,int nb_subbands);
+
+int32_t pmi_convert_rank1_from_rank2(uint16_t pmi_alloc, int tpmi, int nb_rb);
+
+uint16_t quantize_subband_pmi2(PHY_NR_MEASUREMENTS *meas,uint8_t eNB_id,uint8_t a_id,int nb_subbands);
+
+
+
+uint64_t cqi2hex(uint32_t cqi);
+
+uint16_t computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs);
+
+
+/** \brief  This routine extracts a single subband PMI from a bitmap coming from UCI or the pmi_extend function
+    @param N_RB_DL number of resource blocks
+    @param mimo_mode
+    @param pmi_alloc subband PMI bitmap
+    @param rb resource block for which to extract PMI
+    @returns subband PMI
+*/
+uint8_t get_pmi(uint8_t N_RB_DL,MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb);
+
+int get_nCCE_offset_l1(int *CCE_table,
+                       const unsigned char L,
+                       const int nCCE,
+                       const int common_dci,
+                       const unsigned short rnti,
+                       const unsigned char subframe);
+
+uint16_t get_nCCE(uint8_t num_pdcch_symbols,NR_DL_FRAME_PARMS *frame_parms,uint8_t mi);
+
+uint16_t get_nquad(uint8_t num_pdcch_symbols,NR_DL_FRAME_PARMS *frame_parms,uint8_t mi);
+
+uint8_t get_mi(NR_DL_FRAME_PARMS *frame,uint8_t subframe);
+
+uint16_t get_nCCE_mac(uint8_t Mod_id,uint8_t CC_id,int num_pdcch_symbols,int subframe);
+
+uint8_t get_num_pdcch_symbols(uint8_t num_dci,DCI_ALLOC_t *dci_alloc,NR_DL_FRAME_PARMS *frame_parms,uint8_t subframe);
+
+void pdcch_interleaving(NR_DL_FRAME_PARMS *frame_parms,int32_t **z, int32_t **wbar,uint8_t n_symbols_pdcch,uint8_t mi);
+
+void pdcch_unscrambling(NR_DL_FRAME_PARMS *frame_parms,
+                        uint8_t subframe,
+                        int8_t* llr,
+                        uint32_t length);
+
+
+
+void dlsch_unscrambling(NR_DL_FRAME_PARMS *frame_parms,
+                        int mbsfn_flag,
+                        NR_UE_DLSCH_t *dlsch,
+                        int G,
+                        int16_t* llr,
+                        uint8_t q,
+                        uint8_t Ns);
+
+void init_ncs_cell(NR_DL_FRAME_PARMS *frame_parms,uint8_t ncs_cell[20][7]);
+
+void generate_pucch1x(int32_t **txdataF,
+                      NR_DL_FRAME_PARMS *frame_parms,
+                      uint8_t ncs_cell[20][7],
+                      PUCCH_FMT_t fmt,
+                      PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
+                      uint16_t n1_pucch,
+                      uint8_t shortened_format,
+                      uint8_t *payload,
+                      int16_t amp,
+                      uint8_t subframe);
+
+void generate_pucch2x(int32_t **txdataF,
+                      NR_DL_FRAME_PARMS *fp,
+                      uint8_t ncs_cell[20][7],
+                      PUCCH_FMT_t fmt,
+                      PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
+                      uint16_t n2_pucch,
+                      uint8_t *payload,
+                      int A,
+                      int B2,
+                      int16_t amp,
+                      uint8_t subframe,
+                      uint16_t rnti);
+
+void generate_pucch3x(int32_t **txdataF,
+                    NR_DL_FRAME_PARMS *frame_parms,
+                    uint8_t ncs_cell[20][7],
+                    PUCCH_FMT_t fmt,
+                    PUCCH_CONFIG_DEDICATED *pucch_config_dedicated,
+                    uint16_t n3_pucch,
+                    uint8_t shortened_format,
+                    uint8_t *payload,
+                    int16_t amp,
+                    uint8_t subframe,
+                    uint16_t rnti);
+
+
+void init_ulsch_power_LUT(void);
+
+/*!
+  \brief Check for PRACH TXop in subframe
+  @param frame_parms Pointer to NR_DL_FRAME_PARMS
+  @param frame frame index to check
+  @param subframe subframe index to check
+  @returns 0 on success
+*/
+int is_prach_subframe(NR_DL_FRAME_PARMS *frame_parms,frame_t frame, uint8_t subframe);
+
+/*!
+  \brief Generate PRACH waveform
+  @param phy_vars_ue Pointer to ue top-level descriptor
+  @param eNB_id Index of destination eNB
+  @param subframe subframe index to operate on
+  @param index of preamble (0-63)
+  @param Nf System frame number
+  @returns 0 on success
+
+*/
+int32_t generate_prach(PHY_VARS_NR_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe,uint16_t Nf);
+
+
+/*!
+  \brief Helper for MAC, returns number of available PRACH in TDD for a particular configuration index
+  @param frame_parms Pointer to NR_DL_FRAME_PARMS structure
+  @returns 0-5 depending on number of available prach
+*/
+uint8_t get_num_prach_tdd(module_id_t Mod_id);
+
+/*!
+  \brief Return the PRACH format as a function of the Configuration Index and Frame type.
+  @param prach_ConfigIndex PRACH Configuration Index
+  @param frame_type 0-FDD, 1-TDD
+  @returns 0-1 accordingly
+*/
+uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type);
+
+uint16_t get_nr_prach_fmt(int prach_ConfigIndex,lte_frame_type_t frame_type, nr_frequency_range_e fr);
+
+/*!
+  \brief Helper for MAC, returns frequency index of PRACH resource in TDD for a particular configuration index
+  @param frame_parms Pointer to NR_DL_FRAME_PARMS structure
+  @returns 0-5 depending on number of available prach
+*/
+uint8_t get_fid_prach_tdd(module_id_t Mod_id,uint8_t tdd_map_index);
+
+/*!
+  \brief Comp ute DFT of PRACH ZC sequences.  Used for generation of prach in UE and reception of PRACH in eNB.
+  @param rootSequenceIndex PRACH root sequence
+  #param prach_ConfigIndex PRACH Configuration Index
+  @param zeroCorrelationZoneConfig PRACH ncs_config
+  @param highSpeedFlat PRACH High-Speed Flag
+  @param frame_type TDD/FDD flag
+  @param Xu DFT output
+*/
+void compute_prach_seq(uint16_t rootSequenceIndex,
+		       uint8_t prach_ConfigIndex,
+		       uint8_t zeroCorrelationZoneConfig,
+		       uint8_t highSpeedFlag,
+		       lte_frame_type_t frame_type,
+		       uint32_t X_u[64][839]);
+
+
+void init_prach_tables(int N_ZC);
+
+void init_unscrambling_lut(void);
+void init_scrambling_lut(void);
+
+/*!
+  \brief Return the status of MBSFN in this frame/subframe
+  @param frame Frame index
+  @param subframe Subframe index
+  @param frame_parms Pointer to frame parameters
+  @returns 1 if subframe is for MBSFN
+*/
+int is_pmch_subframe(frame_t frame, int subframe, NR_DL_FRAME_PARMS *frame_parms);
+
+uint8_t is_not_pilot(uint8_t pilots, uint8_t re, uint8_t nushift, uint8_t use2ndpilots);
+
+uint8_t is_not_UEspecRS(int8_t lprime, uint8_t re, uint8_t nushift, uint8_t Ncp, uint8_t beamforming_mode);
+
+uint32_t dlsch_decoding_abstraction(double *dlsch_MIPB,
+                                    NR_DL_FRAME_PARMS *lte_frame_parms,
+                                    NR_UE_DLSCH_t *dlsch,
+                                    uint8_t subframe,
+                                    uint8_t num_pdcch_symbols);
+
+// DL power control functions
+double get_pa_dB(uint8_t pa);
+
+
+double computeRhoA_UE(PDSCH_CONFIG_DEDICATED *pdsch_config_dedicated,
+                      NR_UE_DLSCH_t *dlsch_ue,
+                      uint8_t dl_power_off,
+                      uint8_t n_antenna_port);
+
+double computeRhoB_UE(PDSCH_CONFIG_DEDICATED  *pdsch_config_dedicated,
+                      PDSCH_CONFIG_COMMON *pdsch_config_common,
+                      uint8_t n_antenna_port,
+                      NR_UE_DLSCH_t *dlsch_ue,
+                      uint8_t dl_power_off);
+
+/*void compute_sqrt_RhoAoRhoB(PDSCH_CONFIG_DEDICATED  *pdsch_config_dedicated,
+  PDSCH_CONFIG_COMMON *pdsch_config_common,
+  uint8_t n_antenna_port,
+  NR_UE_DLSCH_t *dlsch_ue);
+*/
+
+uint8_t get_prach_prb_offset(NR_DL_FRAME_PARMS *frame_parms,
+			     uint8_t prach_ConfigIndex, 
+			     uint8_t n_ra_prboffset,
+			     uint8_t tdd_mapindex, uint16_t Nf);
+
+void nr_pdcch_unscrambling(uint16_t crnti, NR_DL_FRAME_PARMS *frame_parms, uint8_t nr_tti_rx,
+			   int16_t *z, uint32_t length, uint16_t pdcch_DMRS_scrambling_id, int do_common);
+
+
+uint32_t lte_gold_generic(uint32_t *x1, uint32_t *x2, uint8_t reset);
+
+int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
+             PDSCH_t type,
+             unsigned char eNB_id,
+             unsigned char eNB_id_i, //if this == ue->n_connected_eNB, we assume MU interference
+             uint32_t frame,
+             uint8_t nr_tti_rx,
+             unsigned char symbol,
+             unsigned char first_symbol_flag,
+             RX_type_t rx_type,
+             unsigned char i_mod,
+		unsigned char harq_pid);
+
+uint32_t nr_get_G(uint16_t nb_rb, uint16_t nb_symb_sch,uint8_t nb_re_dmrs,uint16_t length_dmrs, uint8_t Qm, uint8_t Nl) ;
+
+uint32_t  nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
+			    short *dlsch_llr,
+			    NR_DL_FRAME_PARMS *frame_parms,
+			    NR_UE_DLSCH_t *dlsch,
+			    NR_DL_UE_HARQ_t *harq_process,
+			    uint32_t frame,
+			    uint16_t nb_symb_sch,
+			    uint8_t nr_tti_rx,
+			    uint8_t harq_pid,
+			    uint8_t is_crnti,
+			    uint8_t llr8_flag);
+
+/**@}*/
+#endif
diff --git a/openair1/SCHED_NR/nr_prach_procedures.c b/openair1/SCHED_NR/nr_prach_procedures.c
new file mode 100644
index 00000000000..b9a8ba94f1e
--- /dev/null
+++ b/openair1/SCHED_NR/nr_prach_procedures.c
@@ -0,0 +1,141 @@
+/*
+ * 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 nr_prach_procedures.c
+ * \brief Implementation of gNB prach procedures from 38.213 LTE specifications
+ * \author R. Knopp, 
+ * \date 2019
+ * \version 0.1
+ * \company Eurecom
+ * \email: knopp@eurecom.fr
+ * \note
+ * \warning
+ */
+
+#include "PHY/defs_gNB.h"
+#include "PHY/phy_extern.h"
+#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
+#include "nfapi_nr_interface_scf.h"
+#include "fapi_nr_l1.h"
+#include "nfapi_pnf.h"
+#include "common/utils/LOG/log.h"
+#include "common/utils/LOG/vcd_signal_dumper.h"
+
+
+#include "assertions.h"
+#include "msc.h"
+
+#include <time.h>
+
+#include "intertask_interface.h"
+
+extern uint32_t nfapi_mode;
+
+extern int oai_nfapi_nr_rach_ind(nfapi_rach_indication_t *rach_ind);
+
+
+void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int subframe) {
+  uint16_t max_preamble[4],max_preamble_energy[4],max_preamble_delay[4];
+  uint16_t i;
+
+
+  gNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles=0;
+
+  RU_t *ru;
+  int aa=0;
+  int ru_aa;
+
+ 
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,1);
+
+
+
+  for (i=0;i<gNB->num_RU;i++) {
+    ru=gNB->RU_list[i];
+    for (ru_aa=0,aa=0;ru_aa<ru->nb_rx;ru_aa++,aa++) {
+      gNB->prach_vars.rxsigF[aa] = gNB->RU_list[i]->prach_rxsigF[ru_aa];
+    }
+  }
+
+  rx_nr_prach(gNB,
+	      frame,
+	      subframe,
+	      &max_preamble[0],
+	      &max_preamble_energy[0],
+	      &max_preamble_delay[0]
+	      );
+
+  LOG_D(PHY,"[RAPROC] Frame %d, subframe %d : Most likely preamble %d, energy %d dB delay %d (prach_energy counter %d)\n",
+        frame,subframe,
+        max_preamble[0],
+        max_preamble_energy[0]/10,
+        max_preamble_delay[0],
+	gNB->prach_energy_counter);
+
+  if ((gNB->prach_energy_counter == 100) && 
+      (max_preamble_energy[0] > gNB->measurements.prach_I0+100)) {
+    
+    LOG_I(PHY,"[gNB %d][RAPROC] Frame %d, subframe %d Initiating RA procedure with preamble %d, energy %d.%d dB, delay %d\n",
+	  gNB->Mod_id,
+	  frame,
+	  subframe,
+	  max_preamble[0],
+	  max_preamble_energy[0]/10,
+	  max_preamble_energy[0]%10,
+	  max_preamble_delay[0]);
+    
+    T(T_ENB_PHY_INITIATE_RA_PROCEDURE, T_INT(gNB->Mod_id), T_INT(frame), T_INT(subframe),
+      T_INT(max_preamble[0]), T_INT(max_preamble_energy[0]), T_INT(max_preamble_delay[0]));
+    
+    
+    gNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles  = 1;
+    gNB->UL_INFO.rach_ind.rach_indication_body.preamble_list        = &gNB->preamble_list[0];
+    gNB->UL_INFO.rach_ind.rach_indication_body.tl.tag               = NFAPI_RACH_INDICATION_BODY_TAG;
+    gNB->UL_INFO.rach_ind.header.message_id                         = NFAPI_RACH_INDICATION;
+    gNB->UL_INFO.rach_ind.sfn_sf                                    = frame<<4 | subframe;
+    
+    gNB->preamble_list[0].preamble_rel8.tl.tag                = NFAPI_PREAMBLE_REL8_TAG;
+    gNB->preamble_list[0].preamble_rel8.timing_advance        = max_preamble_delay[0];
+    gNB->preamble_list[0].preamble_rel8.preamble              = max_preamble[0];
+    gNB->preamble_list[0].preamble_rel8.rnti                  = 1+subframe;  // note: fid is implicitly 0 here
+    gNB->preamble_list[0].instance_length                     = 0; //don't know exactly what this is
+    
+    if (nfapi_mode == 1) {  // If NFAPI PNF then we need to send the message to the VNF
+      
+      LOG_D(PHY,"Filling NFAPI indication for NR RACH : SFN_SF:%d TA %d, Preamble %d, rnti %x\n",
+	    NFAPI_SFNSF2DEC(gNB->UL_INFO.rach_ind.sfn_sf),
+	    gNB->preamble_list[0].preamble_rel8.timing_advance,
+	    gNB->preamble_list[0].preamble_rel8.preamble,
+	    gNB->preamble_list[0].preamble_rel8.rnti);
+      AssertFatal(1==0,"shouldn't be here yet..\n"); 
+      //oai_nfapi_nr_rach_ind(&gNB->UL_INFO.rach_ind);
+      
+      gNB->UL_INFO.rach_ind.rach_indication_body.number_of_preambles = 0;
+    }
+  } // max_preamble_energy > prach_I0 + 100 
+  else {
+    gNB->measurements.prach_I0 = ((gNB->measurements.prach_I0*900)>>10) + ((max_preamble_energy[0]*124)>>10); 
+    if (frame==0) LOG_I(PHY,"prach_I0 = %d.%d dB\n",gNB->measurements.prach_I0/10,gNB->measurements.prach_I0%10);
+    if (gNB->prach_energy_counter < 100) gNB->prach_energy_counter++;
+  }
+
+  VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,0);
+}
diff --git a/openair1/SCHED_NR/phy_frame_config_nr.c b/openair1/SCHED_NR/phy_frame_config_nr.c
new file mode 100644
index 00000000000..fa22e43661f
--- /dev/null
+++ b/openair1/SCHED_NR/phy_frame_config_nr.c
@@ -0,0 +1,435 @@
+/*
+ * 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
+ */
+
+/***********************************************************************
+*
+* FILENAME    :  phy_frame_configuration_nr.c
+*
+* DESCRIPTION :  functions related to FDD/TDD configuration for NR
+*                see TS 38.213 11.1 Slot configuration
+*                and TS 38.331 for RRC configuration
+*
+************************************************************************/
+
+#include "SCHED_NR_UE/defs.h"
+#include "PHY/defs_nr_UE.h"
+#include "SCHED_NR_UE/phy_frame_config_nr.h"
+#include "PHY/impl_defs_nr.h"
+#include "PHY/impl_defs_top.h"
+
+/*******************************************************************
+*
+* NAME :         set_tdd_configuration
+*
+* PARAMETERS :   pointer to frame configuration
+*
+* OUTPUT:        table of uplink symbol for each slot for 2 frames
+*
+* RETURN :       0 if tdd has been properly configurated
+*                -1 tdd configuration can not be done
+*
+* DESCRIPTION :  generate bit map for uplink symbol for each slot for several frames
+*                see TS 38.213 11.1 Slot configuration
+*
+*********************************************************************/
+
+int set_tdd_config_nr( nfapi_nr_config_request_scf_t *cfg,
+                       int mu,
+                       int nrofDownlinkSlots, int nrofDownlinkSymbols,
+                       int nrofUplinkSlots,   int nrofUplinkSymbols) {
+  int slot_number = 0;
+  int nb_periods_per_frame;
+  int nb_slots_to_set = TDD_CONFIG_NB_FRAMES*(1<<mu)*NR_NUMBER_OF_SUBFRAMES_PER_FRAME;
+
+  switch(cfg->tdd_table.tdd_period.value) {
+    case 0:
+      nb_periods_per_frame = 20; // 10ms/0p5ms
+      break;
+
+    case 1:
+      nb_periods_per_frame = 16; // 10ms/0p625ms
+      break;
+
+    case 2:
+      nb_periods_per_frame = 10; // 10ms/1ms
+      break;
+
+    case 3:
+      nb_periods_per_frame = 8; // 10ms/1p25ms
+      break;
+
+    case 4:
+      nb_periods_per_frame = 5; // 10ms/2ms
+      break;
+
+    case 5:
+      nb_periods_per_frame = 4; // 10ms/2p5ms
+      break;
+
+    case 6:
+      nb_periods_per_frame = 2; // 10ms/5ms
+      break;
+
+    case 7:
+      nb_periods_per_frame = 1; // 10ms/10ms
+      break;
+
+    default:
+      AssertFatal(1==0,"Undefined tdd period %d\n", cfg->tdd_table.tdd_period.value);
+  }
+
+  int nb_slots_per_period = ((1<<mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME)/nb_periods_per_frame;
+
+  if ( (nrofDownlinkSymbols + nrofUplinkSymbols) == 0 )
+    AssertFatal(nb_slots_per_period == (nrofDownlinkSlots + nrofUplinkSlots),
+                "set_tdd_configuration_nr: given period is inconsistent with current tdd configuration, nrofDownlinkSlots %d, nrofUplinkSlots %d, nb_slots_per_period %d \n",
+                nrofDownlinkSlots,nrofUplinkSlots,nb_slots_per_period);
+  else {
+    AssertFatal(nrofDownlinkSymbols + nrofUplinkSymbols < 14,"illegal symbol configuration DL %d, UL %d\n",nrofDownlinkSymbols,nrofUplinkSymbols);
+    AssertFatal(nb_slots_per_period == (nrofDownlinkSlots + nrofUplinkSlots + 1),
+                "set_tdd_configuration_nr: given period is inconsistent with current tdd configuration, nrofDownlinkSlots %d, nrofUplinkSlots %d, nrofMixed slots 1, nb_slots_per_period %d \n",
+                nrofDownlinkSlots,nrofUplinkSlots,nb_slots_per_period);
+  }
+
+  cfg->tdd_table.max_tdd_periodicity_list = (nfapi_nr_max_tdd_periodicity_t *) malloc(nb_slots_to_set*sizeof(nfapi_nr_max_tdd_periodicity_t));
+
+  for(int memory_alloc =0 ; memory_alloc<nb_slots_to_set; memory_alloc++)
+    cfg->tdd_table.max_tdd_periodicity_list[memory_alloc].max_num_of_symbol_per_slot_list = (nfapi_nr_max_num_of_symbol_per_slot_t *) malloc(NR_NUMBER_OF_SYMBOLS_PER_SLOT*sizeof(
+          nfapi_nr_max_num_of_symbol_per_slot_t));
+
+  while(slot_number != nb_slots_to_set) {
+    if(nrofDownlinkSlots != 0) {
+      for (int number_of_symbol = 0; number_of_symbol < nrofDownlinkSlots*NR_NUMBER_OF_SYMBOLS_PER_SLOT; number_of_symbol++) {
+        cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol%NR_NUMBER_OF_SYMBOLS_PER_SLOT].slot_config.value= 0;
+
+        if((number_of_symbol+1)%NR_NUMBER_OF_SYMBOLS_PER_SLOT == 0)
+          slot_number++;
+      }
+    }
+
+    if (nrofDownlinkSymbols != 0 || nrofUplinkSymbols != 0) {
+      for(int number_of_symbol =0; number_of_symbol < nrofDownlinkSymbols; number_of_symbol++) {
+        cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol].slot_config.value= 0;
+      }
+
+      for(int number_of_symbol = nrofDownlinkSymbols; number_of_symbol < NR_NUMBER_OF_SYMBOLS_PER_SLOT-nrofUplinkSymbols; number_of_symbol++) {
+        cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol].slot_config.value= 2;
+      }
+
+      for(int number_of_symbol = NR_NUMBER_OF_SYMBOLS_PER_SLOT-nrofUplinkSymbols; number_of_symbol < NR_NUMBER_OF_SYMBOLS_PER_SLOT; number_of_symbol++) {
+        cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol].slot_config.value= 1;
+      }
+
+      slot_number++;
+    }
+
+    if(nrofUplinkSlots != 0) {
+      for (int number_of_symbol = 0; number_of_symbol < nrofUplinkSlots*NR_NUMBER_OF_SYMBOLS_PER_SLOT; number_of_symbol++) {
+        cfg->tdd_table.max_tdd_periodicity_list[slot_number].max_num_of_symbol_per_slot_list[number_of_symbol%NR_NUMBER_OF_SYMBOLS_PER_SLOT].slot_config.value= 1;
+
+        if((number_of_symbol+1)%NR_NUMBER_OF_SYMBOLS_PER_SLOT == 0)
+          slot_number++;
+      }
+    }
+  }
+
+  /*
+  while(slot_number != nb_slots_to_set) {
+    for (int number_of_slot = 0; number_of_slot < nrofDownlinkSlots; number_of_slot++) {
+      frame_parms->tdd_uplink_nr[slot_number] = NR_TDD_DOWNLINK_SLOT;
+      printf("slot %d set as downlink\n",slot_number);
+      slot_number++;
+    }
+
+    if (nrofDownlinkSymbols != 0 || nrofUplinkSymbols != 0) {
+       frame_parms->tdd_uplink_nr[slot_number] = (1<<nrofUplinkSymbols) - 1;
+       printf("slot %d set as SL\n",slot_number);
+       slot_number++;
+    }
+
+    for (int number_of_slot = 0; number_of_slot < nrofUplinkSlots; number_of_slot++) {
+      frame_parms->tdd_uplink_nr[slot_number] = NR_TDD_UPLINK_SLOT;
+      printf("slot %d set as uplink\n",slot_number);
+      slot_number++;
+    }
+
+    if (p_tdd_ul_dl_configuration->nrofUplinkSymbols != 0) {
+      LOG_E(PHY,"set_tdd_configuration_nr: uplink symbol for slot is not supported for tdd configuration \n");
+      return (-1);
+    }
+  }
+
+  if (frame_parms->p_tdd_UL_DL_ConfigurationCommon2 != NULL) {
+    LOG_E(PHY,"set_tdd_configuration_nr: additionnal tdd configuration 2 is not supported for tdd configuration \n");
+    return (-1);
+  }*/
+  return (0);
+}
+
+/*******************************************************************
+*
+* NAME :         add_tdd_dedicated_configuration_nr
+*
+* PARAMETERS :   pointer to frame configuration
+*
+* OUTPUT:        table of uplink symbol for each slot for several frames
+*
+* RETURN :       0 if tdd has been properly configurated
+*                -1 tdd configuration can not be done
+*
+* DESCRIPTION :  generate bit map for uplink symbol for each slot for several frames
+*                see TS 38.213 11.1 Slot configuration
+*
+*********************************************************************/
+
+void add_tdd_dedicated_configuration_nr(NR_DL_FRAME_PARMS *frame_parms, int slotIndex, int nrofDownlinkSymbols, int nrofUplinkSymbols) {
+  TDD_UL_DL_SlotConfig_t *p_TDD_UL_DL_ConfigDedicated = frame_parms->p_TDD_UL_DL_ConfigDedicated;
+  TDD_UL_DL_SlotConfig_t *p_previous_TDD_UL_DL_ConfigDedicated;
+  int next = 0;
+
+  while (p_TDD_UL_DL_ConfigDedicated != NULL) {
+    p_previous_TDD_UL_DL_ConfigDedicated = p_TDD_UL_DL_ConfigDedicated;
+    p_TDD_UL_DL_ConfigDedicated = (TDD_UL_DL_SlotConfig_t *)(p_TDD_UL_DL_ConfigDedicated->p_next_TDD_UL_DL_SlotConfig);
+    next = 1;
+  }
+
+  p_TDD_UL_DL_ConfigDedicated = calloc( 1, sizeof(TDD_UL_DL_SlotConfig_t));
+
+  //printf("allocate pt %p \n", p_TDD_UL_DL_ConfigDedicated);
+  if (p_TDD_UL_DL_ConfigDedicated == NULL) {
+    printf("Error test_frame_configuration: memory allocation problem \n");
+    assert(0);
+  }
+
+  if (next == 0) {
+    frame_parms->p_TDD_UL_DL_ConfigDedicated = p_TDD_UL_DL_ConfigDedicated;
+  } else {
+    p_previous_TDD_UL_DL_ConfigDedicated->p_next_TDD_UL_DL_SlotConfig = (struct TDD_UL_DL_SlotConfig_t *)p_TDD_UL_DL_ConfigDedicated;
+  }
+
+  p_TDD_UL_DL_ConfigDedicated->slotIndex = slotIndex;
+  p_TDD_UL_DL_ConfigDedicated->nrofDownlinkSymbols = nrofDownlinkSymbols;
+  p_TDD_UL_DL_ConfigDedicated->nrofUplinkSymbols = nrofUplinkSymbols;
+}
+
+/*******************************************************************
+*
+* NAME :         set_tdd_configuration_dedicated_nr
+*
+* PARAMETERS :   pointer to frame configuration
+*
+* OUTPUT:        table of uplink symbol for each slot for several frames
+*
+* RETURN :       0 if tdd has been properly configurated
+*                -1 tdd configuration can not be done
+*
+* DESCRIPTION :  generate bit map for uplink symbol for each slot for several frames
+*                see TS 38.213 11.1 Slot configuration
+*
+*********************************************************************/
+
+int set_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms) {
+  TDD_UL_DL_SlotConfig_t *p_current_TDD_UL_DL_SlotConfig;
+  p_current_TDD_UL_DL_SlotConfig = frame_parms->p_TDD_UL_DL_ConfigDedicated;
+  NR_TST_PHY_PRINTF("\nSet tdd dedicated configuration\n ");
+
+  while(p_current_TDD_UL_DL_SlotConfig != NULL) {
+    int slot_index = p_current_TDD_UL_DL_SlotConfig->slotIndex;
+
+    if (slot_index < TDD_CONFIG_NB_FRAMES*(frame_parms->ttis_per_subframe * NR_NUMBER_OF_SUBFRAMES_PER_FRAME)) {
+      if (p_current_TDD_UL_DL_SlotConfig->nrofDownlinkSymbols != 0) {
+        if (p_current_TDD_UL_DL_SlotConfig->nrofDownlinkSymbols == NR_TDD_SET_ALL_SYMBOLS) {
+          if (p_current_TDD_UL_DL_SlotConfig->nrofUplinkSymbols == 0) {
+            frame_parms->tdd_uplink_nr[slot_index] = NR_TDD_DOWNLINK_SLOT;
+            NR_TST_PHY_PRINTF(" DL[%d] ", slot_index);
+          } else {
+            LOG_E(PHY,"set_tdd_configuration_dedicated_nr: tdd downlink & uplink symbol configuration is not supported \n");
+            return (-1);
+          }
+        } else {
+          LOG_E(PHY,"set_tdd_configuration_dedicated_nr: tdd downlink symbol configuration is not supported \n");
+          return (-1);
+        }
+      } else if (p_current_TDD_UL_DL_SlotConfig->nrofUplinkSymbols != 0) {
+        if (p_current_TDD_UL_DL_SlotConfig->nrofUplinkSymbols == NR_TDD_SET_ALL_SYMBOLS) {
+          frame_parms->tdd_uplink_nr[slot_index] = NR_TDD_UPLINK_SLOT;
+          NR_TST_PHY_PRINTF(" UL[%d] ", slot_index);
+        } else {
+          LOG_E(PHY,"set_tdd_configuration_dedicated_nr: tdd uplink symbol configuration is not supported \n");
+          return (-1);
+        }
+      } else {
+        LOG_E(PHY,"set_tdd_configuration_dedicated_nr: no tdd symbol configuration is specified \n");
+        return (-1);
+      }
+    } else {
+      LOG_E(PHY,"set_tdd_configuration_dedicated_nr: tdd slot index exceeds maximum value \n");
+      return (-1);
+    }
+
+    p_current_TDD_UL_DL_SlotConfig = (TDD_UL_DL_SlotConfig_t *)(p_current_TDD_UL_DL_SlotConfig->p_next_TDD_UL_DL_SlotConfig);
+  }
+
+  NR_TST_PHY_PRINTF("\n");
+  return (0);
+}
+
+/*******************************************************************
+*
+* NAME :         set_tdd_configuration
+*
+* PARAMETERS :   pointer to tdd common configuration
+*                pointer to tdd common configuration2
+*                pointer to tdd dedicated configuration
+*
+* OUTPUT:        table of uplink symbol for each slot for 2 frames
+*
+* RETURN :       0  if srs sequence has been successfully generated
+*                -1 if sequence can not be properly generated
+*
+* DESCRIPTION :  generate bit map for uplink symbol for each slot for 2 frames
+*                see TS 38.213 11.1 Slot configuration
+*
+*********************************************************************/
+
+int nr_slot_select(nfapi_nr_config_request_scf_t *cfg, int nr_frame, int nr_tti) {
+  /* for FFD all slot can be considered as an uplink */
+  int mu = cfg->ssb_config.scs_common.value,check_slot=0;
+
+  if (cfg->cell_config.frame_duplex_type.value == FDD) {
+    return (NR_UPLINK_SLOT | NR_DOWNLINK_SLOT );
+  }
+
+  if (nr_frame%2 == 0) {
+    for(int symbol_count=0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) {
+      if (cfg->tdd_table.max_tdd_periodicity_list[nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==1) {
+        check_slot++;
+      }
+    }
+
+    if(check_slot == NR_NUMBER_OF_SYMBOLS_PER_SLOT) {
+      return (NR_UPLINK_SLOT);
+    }
+
+    check_slot = 0;
+
+    for(int symbol_count=0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) {
+      if (cfg->tdd_table.max_tdd_periodicity_list[nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==0) {
+        check_slot++;
+      }
+    }
+
+    if(check_slot == NR_NUMBER_OF_SYMBOLS_PER_SLOT) {
+      return (NR_DOWNLINK_SLOT);
+    } else {
+      return (NR_MIXED_SLOT);
+    }
+  } else {
+    for(int symbol_count=0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) {
+      if (cfg->tdd_table.max_tdd_periodicity_list[((1<<mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME) + nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==1) {
+        check_slot++;
+      }
+    }
+
+    if(check_slot == NR_NUMBER_OF_SYMBOLS_PER_SLOT) {
+      return (NR_UPLINK_SLOT);
+    }
+
+    check_slot = 0;
+
+    for(int symbol_count=0; symbol_count<NR_NUMBER_OF_SYMBOLS_PER_SLOT; symbol_count++) {
+      if (cfg->tdd_table.max_tdd_periodicity_list[((1<<mu) * NR_NUMBER_OF_SUBFRAMES_PER_FRAME) + nr_tti].max_num_of_symbol_per_slot_list[symbol_count].slot_config.value==0) {
+        check_slot++;
+      }
+    }
+
+    if(check_slot == NR_NUMBER_OF_SYMBOLS_PER_SLOT) {
+      return (NR_DOWNLINK_SLOT);
+    } else {
+      return (NR_MIXED_SLOT);
+    }
+  }
+}
+
+/*******************************************************************
+*
+* NAME :         free_tdd_configuration_nr
+*
+* PARAMETERS :   pointer to frame configuration
+*
+* RETURN :       none
+*
+* DESCRIPTION :  free structure related to tdd configuration
+*
+*********************************************************************/
+
+void free_tdd_configuration_nr(NR_DL_FRAME_PARMS *frame_parms) {
+  TDD_UL_DL_configCommon_t *p_tdd_UL_DL_Configuration = frame_parms->p_tdd_UL_DL_Configuration;
+  free_tdd_configuration_dedicated_nr(frame_parms);
+
+  if (p_tdd_UL_DL_Configuration != NULL) {
+    frame_parms->p_tdd_UL_DL_Configuration = NULL;
+    free(p_tdd_UL_DL_Configuration);
+  }
+
+  for (int number_of_slot = 0; number_of_slot < NR_MAX_SLOTS_PER_FRAME; number_of_slot++) {
+    frame_parms->tdd_uplink_nr[number_of_slot] = NR_TDD_DOWNLINK_SLOT;
+  }
+}
+
+/*******************************************************************
+*
+* NAME :         free_tdd_configuration_dedicated_nr
+*
+* PARAMETERS :   pointer to frame configuration
+*
+* RETURN :       none
+*
+* DESCRIPTION :  free structure related to tdd dedicated configuration
+*
+*********************************************************************/
+
+void free_tdd_configuration_dedicated_nr(NR_DL_FRAME_PARMS *frame_parms) {
+  TDD_UL_DL_SlotConfig_t *p_current_TDD_UL_DL_ConfigDedicated = frame_parms->p_TDD_UL_DL_ConfigDedicated;
+  TDD_UL_DL_SlotConfig_t *p_next_TDD_UL_DL_ConfigDedicated;
+  int next = 0;
+
+  if (p_current_TDD_UL_DL_ConfigDedicated != NULL) {
+    do {
+      if (p_current_TDD_UL_DL_ConfigDedicated->p_next_TDD_UL_DL_SlotConfig != NULL) {
+        next = 1;
+        p_next_TDD_UL_DL_ConfigDedicated =  (TDD_UL_DL_SlotConfig_t *)(p_current_TDD_UL_DL_ConfigDedicated->p_next_TDD_UL_DL_SlotConfig);
+        p_current_TDD_UL_DL_ConfigDedicated->p_next_TDD_UL_DL_SlotConfig = NULL;
+        //printf("free pt %p \n", p_current_TDD_UL_DL_ConfigDedicated);
+        free(p_current_TDD_UL_DL_ConfigDedicated);
+        p_current_TDD_UL_DL_ConfigDedicated = p_next_TDD_UL_DL_ConfigDedicated;
+      } else {
+        if (p_current_TDD_UL_DL_ConfigDedicated != NULL) {
+          frame_parms->p_TDD_UL_DL_ConfigDedicated = NULL;
+          //printf("free pt %p \n", p_current_TDD_UL_DL_ConfigDedicated);
+          free(p_current_TDD_UL_DL_ConfigDedicated);
+          next = 0;
+        }
+      }
+    } while (next);
+  }
+}
+
diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c
new file mode 100644
index 00000000000..5c003525158
--- /dev/null
+++ b/openair1/SIMULATION/NR_PHY/prachsim.c
@@ -0,0 +1,666 @@
+/*
+ * 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
+ */
+
+#include <string.h>
+#include <math.h>
+#include <unistd.h>
+
+#include "common/config/config_userapi.h"
+#include "common/utils/LOG/log.h"
+#include "common/ran_context.h" 
+
+#include "SIMULATION/TOOLS/sim.h"
+#include "SIMULATION/RF/rf.h"
+#include "PHY/types.h"
+#include "PHY/defs_gNB.h"
+#include "PHY/defs_nr_UE.h"
+#include "SCHED_NR/sched_nr.h"
+#include "SCHED_NR_UE/phy_frame_config_nr.h"
+#include "PHY/phy_vars_nr_ue.h"
+
+#include "PHY/NR_REFSIG/refsig_defs_ue.h"
+#include "PHY/NR_REFSIG/nr_mod_table.h"
+#include "PHY/MODULATION/modulation_eNB.h"
+#include "PHY/MODULATION/modulation_UE.h"
+#include "PHY/INIT/phy_init.h"
+#include "PHY/NR_TRANSPORT/nr_transport.h"
+#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
+#include "OCG_vars.h"
+
+#include <pthread.h>
+
+PHY_VARS_gNB *gNB;
+PHY_VARS_NR_UE *UE;
+RAN_CONTEXT_t RC;
+RU_t *ru;
+
+double cpuf;
+
+extern uint16_t prach_root_sequence_map0_3[838];
+
+void dump_nr_prach_config(NR_DL_FRAME_PARMS *frame_parms,uint8_t subframe);
+
+uint16_t NB_UE_INST=1;
+volatile int oai_exit=0;
+
+void exit_function(const char* file, const char* function, const int line,const char *s) { 
+   const char * msg= s==NULL ? "no comment": s;
+   printf("Exiting at: %s:%d %s(), %s\n", file, line, function, msg); 
+   exit(-1); 
+}
+
+
+int8_t nr_ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, uint8_t eNB_id, uint16_t rnti, sub_frame_t subframe) {
+  AssertFatal(1==0,"Shouldn't be here ...\n");
+  return 0;
+}
+
+uint8_t nr_ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
+           sub_frame_t subframe, uint8_t eNB_index,
+           uint8_t *ulsch_buffer, uint16_t buflen, uint8_t *access_mode) {return(0);}
+
+int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind) {return(0);}
+
+openair0_config_t openair0_cfg[MAX_CARDS];
+uint8_t nfapi_mode=0;
+NR_IF_Module_t *NR_IF_Module_init(int Mod_id){return(NULL);}
+int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { return(0); }
+
+uint64_t get_softmodem_optmask(void) {
+  return 0;
+}
+
+int main(int argc, char **argv)
+{
+
+  char c;
+
+  int i,aa,aarx;
+  double sigma2, sigma2_dB=0,SNR,snr0=-2.0,snr1=0.0,ue_speed0=0.0,ue_speed1=0.0;
+  uint8_t snr1set=0;
+  uint8_t ue_speed1set=0;
+  int **txdata;
+  double **s_re,**s_im,**r_re,**r_im;
+  double iqim=0.0;
+  int trial; //, ntrials=1;
+  uint8_t transmission_mode = 1,n_tx=1,n_rx=1;
+  uint16_t Nid_cell=0;
+
+  uint8_t awgn_flag=0;
+  uint8_t hs_flag=0;
+  int n_frames=1;
+  channel_desc_t *UE2gNB;
+  uint32_t nsymb,tx_lev; //,tx_lev_dB;
+  //  int8_t interf1=-19,interf2=-19;
+  NR_DL_FRAME_PARMS *frame_parms;
+
+  SCM_t channel_model=Rayleigh1;
+
+  //  uint8_t abstraction_flag=0,calibration_flag=0;
+  //  double prach_sinr;
+  int N_RB_UL=273;
+  uint32_t prach_errors=0;
+  uint8_t subframe=9;
+  uint16_t preamble_energy_list[64],preamble_tx=50,preamble_delay_list[64];
+  uint16_t preamble_max,preamble_energy_max;
+  PRACH_RESOURCES_t prach_resources;
+  //uint8_t prach_fmt;
+  //int N_ZC;
+  int delay = 0;
+  double delay_avg=0;
+  double ue_speed = 0;
+  int NCS_config = 13,rootSequenceIndex=0;
+  int threequarter_fs = 0;
+  int mu=1;
+  uint64_t SSB_positions=0x01;
+
+  int loglvl=OAILOG_INFO;
+
+  cpuf = get_cpu_freq_GHz();
+
+
+  if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0) {
+    exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
+  }
+
+  randominit(0);
+
+
+  while ((c = getopt (argc, argv, "hHaA:Cr:p:g:n:s:S:t:x:y:v:V:z:N:F:d:Z:L:R:E")) != -1) {
+    switch (c) {
+    case 'a':
+      printf("Running AWGN simulation\n");
+      awgn_flag = 1;
+      /* ntrials not used later, no need to set */
+      //ntrials=1;
+      break;
+
+    case 'd':
+      delay = atoi(optarg);
+      break;
+
+    case 'g':
+      switch((char)*optarg) {
+      case 'A':
+        channel_model=SCM_A;
+        break;
+
+      case 'B':
+        channel_model=SCM_B;
+        break;
+
+      case 'C':
+        channel_model=SCM_C;
+        break;
+
+      case 'D':
+        channel_model=SCM_D;
+        break;
+
+      case 'E':
+        channel_model=EPA;
+        break;
+
+      case 'F':
+        channel_model=EVA;
+        break;
+
+      case 'G':
+        channel_model=ETU;
+        break;
+
+      case 'H':
+        channel_model=Rayleigh8;
+
+      case 'I':
+        channel_model=Rayleigh1;
+
+      case 'J':
+        channel_model=Rayleigh1_corr;
+
+      case 'K':
+        channel_model=Rayleigh1_anticorr;
+
+      case 'L':
+        channel_model=Rice8;
+
+      case 'M':
+        channel_model=Rice1;
+
+      case 'N':
+        channel_model=Rayleigh1_800;
+        break;
+
+      default:
+        msg("Unsupported channel model!\n");
+        exit(-1);
+      }
+
+      break;
+
+    case 'E':
+      threequarter_fs=1;
+      break;
+
+    case 'n':
+      n_frames = atoi(optarg);
+      break;
+
+    case 's':
+      snr0 = atof(optarg);
+      msg("Setting SNR0 to %f\n",snr0);
+      break;
+
+    case 'S':
+      snr1 = atof(optarg);
+      snr1set=1;
+      msg("Setting SNR1 to %f\n",snr1);
+      break;
+
+    case 'p':
+      preamble_tx=atoi(optarg);
+      break;
+
+    case 'v':
+      ue_speed0 = atoi(optarg);
+      break;
+
+    case 'V':
+      ue_speed1 = atoi(optarg);
+      ue_speed1set = 1;
+      break;
+
+    case 'Z':
+      NCS_config = atoi(optarg);
+
+      if ((NCS_config > 15) || (NCS_config < 0))
+        printf("Illegal NCS_config %d, (should be 0-15)\n",NCS_config);
+
+      break;
+
+    case 'H':
+      printf("High-Speed Flag enabled\n");
+      hs_flag = 1;
+      break;
+
+    case 'L':
+      rootSequenceIndex = atoi(optarg);
+
+      if ((rootSequenceIndex < 0) || (rootSequenceIndex > 837))
+        printf("Illegal rootSequenceNumber %d, (should be 0-837)\n",rootSequenceIndex);
+
+      break;
+
+    case 'x':
+      transmission_mode=atoi(optarg);
+
+      if ((transmission_mode!=1) &&
+          (transmission_mode!=2) &&
+          (transmission_mode!=6)) {
+        msg("Unsupported transmission mode %d\n",transmission_mode);
+        exit(-1);
+      }
+
+      break;
+
+    case 'y':
+      n_tx=atoi(optarg);
+
+      if ((n_tx==0) || (n_tx>2)) {
+        msg("Unsupported number of tx antennas %d\n",n_tx);
+        exit(-1);
+      }
+
+      break;
+
+    case 'z':
+      n_rx=atoi(optarg);
+
+      if ((n_rx==0) || (n_rx>2)) {
+        msg("Unsupported number of rx antennas %d\n",n_rx);
+        exit(-1);
+      }
+
+      break;
+
+    case 'N':
+      Nid_cell = atoi(optarg);
+      break;
+
+    case 'R':
+      N_RB_UL = atoi(optarg);
+      break;
+
+    case 'F':
+      break;
+
+    default:
+    case 'h':
+      printf("%s -h(elp) -a(wgn on) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n",
+             argv[0]);
+      printf("-h This message\n");
+      printf("-a Use AWGN channel and not multipath\n");
+      printf("-n Number of frames to simulate\n");
+      printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB.  If n_frames is 1 then just SNR is simulated\n");
+      printf("-S Ending SNR, runs from SNR0 to SNR1\n");
+      printf("-g [A,B,C,D,E,F,G,I,N] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) or Rayleigh1 (I) or Rayleigh1_800 (N) models (ignores delay spread and Ricean factor)\n");
+      printf("-z Number of RX antennas used in gNB\n");
+      printf("-N Nid_cell\n");
+      printf("-O oversampling factor (1,2,4,8,16)\n");
+      //    printf("-f PRACH format (0=1,1=2,2=3,3=4)\n");
+      printf("-d Channel delay \n");
+      printf("-v Starting UE velocity in km/h, runs from 'v' to 'v+50km/h'. If n_frames is 1 just 'v' is simulated \n");
+      printf("-V Ending UE velocity in km/h, runs from 'v' to 'V'");
+      printf("-L rootSequenceIndex (0-837)\n");
+      printf("-Z NCS_config (ZeroCorrelationZone) (0-15)\n");
+      printf("-H Run with High-Speed Flag enabled \n");
+      printf("-R Number of PRB (6,15,25,50,75,100)\n");
+      printf("-F Input filename (.txt format) for RX conformance testing\n");
+      exit (-1);
+      break;
+    }
+  }
+
+  logInit();
+
+  set_glog(loglvl);
+  T_stdout = 1;
+
+  SET_LOG_DEBUG(PRACH); 
+
+  if (snr1set==0) {
+    if (n_frames==1)
+      snr1 = snr0+.1;
+    else
+      snr1 = snr0+5.0;
+  }
+
+  RC.gNB = (PHY_VARS_gNB**) malloc(2*sizeof(PHY_VARS_gNB *));
+  RC.gNB[0] = malloc(sizeof(PHY_VARS_gNB));
+  memset(RC.gNB[0],0,sizeof(PHY_VARS_gNB));
+
+  RC.ru = (RU_t**) malloc(2*sizeof(RU_t *));
+  RC.ru[0] = (RU_t*) malloc(sizeof(RU_t ));
+  memset(RC.ru[0],0,sizeof(RU_t));
+  RC.nb_RU = 1;
+
+  gNB = RC.gNB[0];
+  ru = RC.ru[0];
+
+
+  if (ue_speed1set==0) {
+    if (n_frames==1)
+      ue_speed1 = ue_speed0+10;
+    else
+      ue_speed1 = ue_speed0+50;
+  }
+
+  printf("SNR0 %f, SNR1 %f\n",snr0,snr1);
+
+  frame_parms = &gNB->frame_parms;
+
+
+
+  s_re = malloc(2*sizeof(double*));
+  s_im = malloc(2*sizeof(double*));
+  r_re = malloc(2*sizeof(double*));
+  r_im = malloc(2*sizeof(double*));
+
+  frame_parms = &gNB->frame_parms; //to be initialized I suppose (maybe not necessary for PBCH)
+  frame_parms->nb_antennas_tx = n_tx;
+  frame_parms->nb_antennas_rx = n_rx;
+  frame_parms->N_RB_DL = N_RB_UL;
+  frame_parms->N_RB_UL = N_RB_UL;
+  frame_parms->threequarter_fs = threequarter_fs;
+
+
+  nr_phy_config_request_sim(gNB,N_RB_UL,N_RB_UL,mu,Nid_cell,SSB_positions);
+
+  frame_parms->frame_type = TDD;
+  frame_parms->freq_range = nr_FR1;
+
+  nsymb = (frame_parms->Ncp == 0) ? 14 : 12;
+
+  printf("FFT Size %d, Extended Prefix %d, Samples per subframe %d,Frame type %s, Frequency Range %s\n",NUMBER_OF_OFDM_CARRIERS,
+         frame_parms->Ncp,frame_parms->samples_per_subframe,frame_parms->frame_type == FDD ? "FDD" : "TDD", frame_parms->freq_range == nr_FR1 ? "FR1" : "FR2");
+
+  ru->nr_frame_parms=frame_parms;
+  ru->if_south = LOCAL_RF;
+  ru->nb_tx = n_tx;
+  ru->nb_rx = n_rx;
+
+  RC.nb_nr_L1_inst=1;
+  phy_init_nr_gNB(gNB,0,0);
+  nr_phy_init_RU(ru);
+  set_tdd_config_nr(&gNB->gNB_config, 5000,
+		    7, 6,
+		    2, 4);
+
+    //configure UE
+  UE = malloc(sizeof(PHY_VARS_NR_UE));
+  memset((void*)UE,0,sizeof(PHY_VARS_NR_UE));
+  PHY_vars_UE_g = malloc(2*sizeof(PHY_VARS_NR_UE**));
+  PHY_vars_UE_g[0] = malloc(2*sizeof(PHY_VARS_NR_UE*));
+  PHY_vars_UE_g[0][0] = UE;
+  memcpy(&UE->frame_parms,frame_parms,sizeof(NR_DL_FRAME_PARMS));
+  if (init_nr_ue_signal(UE, 1, 0) != 0)
+  {
+    printf("Error at UE NR initialisation\n");
+    exit(-1);
+  }
+
+  txdata = UE->common_vars.txdata;
+  printf("txdata %p\n",&txdata[0][subframe*frame_parms->samples_per_subframe]);
+
+  double fs,bw;
+
+
+  bw = N_RB_UL*(180e3)*(1<<gNB->frame_parms.numerology_index);
+  AssertFatal(bw<=122.88e6,"Illegal channel bandwidth %f (mu %d,N_RB_UL %d)\n",gNB->frame_parms.numerology_index,N_RB_UL);
+  if (bw <= 30.72e6)       fs = 30.72e6;
+  else if (bw <= 61.44e6)  fs = 61.44e6;
+  else if (bw <= 122.88e6) fs = 122.88e6;
+  LOG_I(PHY,"Running with bandwidth %f Hz, fs %f samp/s, FRAME_LENGTH_COMPLEX_SAMPLES %d\n",bw,fs,FRAME_LENGTH_COMPLEX_SAMPLES);
+
+  
+  UE2gNB = new_channel_desc_scm(UE->frame_parms.nb_antennas_tx,
+                                gNB->frame_parms.nb_antennas_rx,
+                                channel_model,
+				fs,
+				bw,
+                                0.0,
+                                delay,
+                                0);
+
+  if (UE2gNB==NULL) {
+    printf("Problem generating channel model. Exiting.\n");
+    exit(-1);
+  }
+
+  for (i=0; i<2; i++) {
+
+    s_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    bzero(s_re[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    s_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    bzero(s_im[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+
+    r_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    bzero(r_re[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    r_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+    bzero(r_im[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
+  }
+
+  UE->frame_parms.prach_config_common.rootSequenceIndex=rootSequenceIndex;
+  UE->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex=98;
+  UE->frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig=NCS_config;
+  UE->frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag=hs_flag;
+  UE->frame_parms.prach_config_common.prach_ConfigInfo.restrictedSetConfig=0;
+  UE->frame_parms.prach_config_common.prach_ConfigInfo.msg1_frequencystart=0;
+
+
+  gNB->frame_parms.prach_config_common.rootSequenceIndex=rootSequenceIndex;
+  gNB->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex=98;
+  gNB->frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig=NCS_config;
+  gNB->frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag=hs_flag;
+  gNB->frame_parms.prach_config_common.prach_ConfigInfo.restrictedSetConfig=0;
+  gNB->frame_parms.prach_config_common.prach_ConfigInfo.msg1_frequencystart=0;
+
+  gNB->proc.slot_rx    = subframe<<1;
+
+  gNB->common_vars.rxdata = ru->common.rxdata;
+
+
+  compute_nr_prach_seq(gNB->frame_parms.prach_config_common.rootSequenceIndex,
+		       gNB->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
+		       gNB->frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
+		       gNB->frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag,
+		       gNB->frame_parms.frame_type,
+		       gNB->frame_parms.freq_range,
+		       gNB->X_u);
+
+  compute_nr_prach_seq(UE->frame_parms.prach_config_common.rootSequenceIndex,
+		       UE->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex,
+		       UE->frame_parms.prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig,
+		       UE->frame_parms.prach_config_common.prach_ConfigInfo.highSpeedFlag,
+		       UE->frame_parms.frame_type,
+		       UE->frame_parms.freq_range,
+		       UE->X_u);
+
+
+
+  UE->prach_vars[0]->amp = AMP;
+
+  UE->prach_resources[0] = &prach_resources;
+
+  if (preamble_tx == 99)
+    preamble_tx = (uint16_t)(taus()&0x3f);
+
+  if (n_frames == 1)
+    printf("raPreamble %d\n",preamble_tx);
+
+  UE->prach_resources[0]->ra_PreambleIndex = preamble_tx;
+  UE->prach_resources[0]->ra_TDD_map_index = 0;
+
+  /*tx_lev = generate_nr_prach(UE,
+			     0, //gNB_id,
+			     subframe,
+			     0); //Nf */ //commented for testing purpose
+
+  UE_nr_rxtx_proc_t proc={0};
+  nr_ue_prach_procedures(UE,&proc,0,0,0);
+
+
+  /* tx_lev_dB not used later, no need to set */
+  //tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
+
+  LOG_M("txsig0.m","txs0", &txdata[0][subframe*frame_parms->samples_per_subframe],frame_parms->samples_per_subframe,1,1);
+  //LOG_M("txsig1.m","txs1", txdata[1],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
+
+  // multipath channel
+  dump_nr_prach_config(&gNB->frame_parms,subframe);
+
+  for (i=0; i<2*frame_parms->samples_per_subframe; i++) {
+    for (aa=0; aa<1; aa++) {
+      if (awgn_flag == 0) {
+        s_re[aa][i] = ((double)(((short *)&txdata[aa][subframe*frame_parms->samples_per_subframe]))[(i<<1)]);
+        s_im[aa][i] = ((double)(((short *)&txdata[aa][subframe*frame_parms->samples_per_subframe]))[(i<<1)+1]);
+      } else {
+        for (aarx=0; aarx<gNB->frame_parms.nb_antennas_rx; aarx++) {
+          if (aa==0) {
+            r_re[aarx][i] = ((double)(((short *)&txdata[aa][subframe*frame_parms->samples_per_subframe]))[(i<<1)]);
+            r_im[aarx][i] = ((double)(((short *)&txdata[aa][subframe*frame_parms->samples_per_subframe]))[(i<<1)+1]);
+          } else {
+            r_re[aarx][i] += ((double)(((short *)&txdata[aa][subframe*frame_parms->samples_per_subframe]))[(i<<1)]);
+            r_im[aarx][i] += ((double)(((short *)&txdata[aa][subframe*frame_parms->samples_per_subframe]))[(i<<1)+1]);
+          }
+        }
+      }
+    }
+  }
+
+
+
+  for (SNR=snr0; SNR<snr1; SNR+=.2) {
+    for (ue_speed=ue_speed0; ue_speed<ue_speed1; ue_speed+=10) {
+      delay_avg = 0.0;
+      // max Doppler shift
+      UE2gNB->max_Doppler = 1.9076e9*(ue_speed/3.6)/3e8;
+      printf("n_frames %d SNR %f\n",n_frames,SNR);
+      prach_errors=0;
+
+      for (trial=0; trial<n_frames; trial++) {
+
+        sigma2_dB = 10*log10((double)tx_lev) - SNR;
+
+        if (n_frames==1)
+          printf("sigma2_dB %f (SNR %f dB) tx_lev_dB %f\n",sigma2_dB,SNR,10*log10((double)tx_lev));
+
+        //AWGN
+        sigma2 = pow(10,sigma2_dB/10);
+        //  printf("Sigma2 %f (sigma2_dB %f)\n",sigma2,sigma2_dB);
+
+
+        if (awgn_flag == 0) {
+          multipath_tv_channel(UE2gNB,s_re,s_im,r_re,r_im,
+                               2*frame_parms->samples_per_subframe,0);
+        }
+
+        if (n_frames==1) {
+          printf("rx_level data symbol %f, tx_lev %f\n",
+                 10*log10(signal_energy_fp(r_re,r_im,1,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES,0)),
+                 10*log10(tx_lev));
+        }
+
+        for (i=0; i<frame_parms->samples_per_subframe; i++) {
+          for (aa=0; aa<gNB->frame_parms.nb_antennas_rx; aa++) {
+
+            ((short*) &gNB->common_vars.rxdata[aa][subframe*(frame_parms->samples_per_subframe)])[2*i] = (short) (.167*(r_re[aa][i] +sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
+            ((short*) &gNB->common_vars.rxdata[aa][subframe*(frame_parms->samples_per_subframe)])[2*i+1] = (short) (.167*(r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
+          }
+        }
+	uint16_t preamble_rx;
+        rx_nr_prach_ru(ru,
+		       0,
+		       subframe);
+	gNB->prach_vars.rxsigF = ru->prach_rxsigF;
+
+        rx_nr_prach(gNB,
+		    0,
+		    subframe,
+		    &preamble_rx,
+		    preamble_energy_list,
+		    preamble_delay_list);
+	
+        if (preamble_rx!=preamble_tx)
+          prach_errors++;
+        else {
+          delay_avg += (double)preamble_delay_list[preamble_tx];
+        }
+
+        if (n_frames==1) {
+	  printf("preamble %d (tx %d) : energy %d, delay %d\n",preamble_rx,preamble_tx,preamble_energy_list[0],preamble_delay_list[0]);
+	  
+          
+          LOG_M("prach0.m","prach0", &txdata[0][subframe*frame_parms->samples_per_subframe],frame_parms->samples_per_subframe,1,1);
+          LOG_M("prachF0.m","prachF0", &gNB->prach_vars.prachF[0],24576,1,1);
+          LOG_M("rxsig0.m","rxs0",
+                       &gNB->common_vars.rxdata[0][subframe*frame_parms->samples_per_subframe],
+                       frame_parms->samples_per_subframe,1,1);
+          LOG_M("rxsigF0.m","rxsF0", gNB->prach_vars.rxsigF[0],839*4,1,1);
+          LOG_M("prach_preamble.m","prachp",&gNB->X_u[0],839,1,1);
+        }
+      }
+
+      printf("SNR %f dB, UE Speed %f km/h: errors %d/%d (delay %f)\n",SNR,ue_speed,prach_errors,n_frames,delay_avg/(double)(n_frames-prach_errors));
+      //printf("(%f,%f)\n",ue_speed,(double)prach_errors/(double)n_frames);
+    } // UE Speed loop
+
+    //printf("SNR %f dB, UE Speed %f km/h: errors %d/%d (delay %f)\n",SNR,ue_speed,prach_errors,n_frames,delay_avg/(double)(n_frames-prach_errors));
+    //  printf("(%f,%f)\n",SNR,(double)prach_errors/(double)n_frames);
+  } //SNR loop
+
+
+  for (i=0; i<2; i++) {
+    free(s_re[i]);
+    free(s_im[i]);
+    free(r_re[i]);
+    free(r_im[i]);
+  }
+
+  free(s_re);
+  free(s_im);
+  free(r_re);
+  free(r_im);
+
+
+  return(0);
+
+}
+
+
+
+/*
+  for (i=1;i<4;i++)
+    memcpy((void *)&PHY_vars->tx_vars[0].TX_DMA_BUFFER[i*12*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES_NO_PREFIX*2],
+     (void *)&PHY_vars->tx_vars[0].TX_DMA_BUFFER[0],
+     12*OFDM_SYMBOL_SIZE_SAMPLES_NO_PREFIX*2);
+*/
+
diff --git a/openair1/SIMULATION/NR_PHY/reconfig.raw b/openair1/SIMULATION/NR_PHY/reconfig.raw
new file mode 100644
index 0000000000000000000000000000000000000000..59b524fbbaf41e4dc0b6aadc51b902d781116b4f
GIT binary patch
literal 479
zcmZvXF=!J}0EYi}?{ax<ukjUPC?V8WJtc}rC>>G}d=0UjAmZpy<eFMgK_cj+%e!le
z)hR>?1wqoHAVn}JNC$_P8qbu9h~QQvv??8KmoBX}?rz_=eIN7J#<A5JV#P4Y&a_4n
z(@nvr?sR?f==s&QaXqVmNIiV|tEQi0f#m5;aZDi*UL4*Tdc*N;tnlXos#`O~o`czO
z%<Hq8IXy_<6<d36A+nK2WD3%y+El7bc&3{sl^9ATb$rmX-D|WmKuqmB4L`r^Uw!YF
zn*Os7elzrceDuTFRWUM`U*k3)g!R~%jqu(lm)N2G-vD?UfyL9_#!{glkfTeveh^fY
za7f#b66K8H#IX`ZE+^yVy5$U$l>-PoS@HD3gnT`rmkaW1L9b8B?Mc0ne|h3^N(7BY
zkP@+@RKe`|t^_2=CenhQlDGdi+gL2$Fw8!dQThmaiH(evzVb!P-*X1W9)9lhkUf^;
z20=B-ME#a`pV0@h4Pxxn7&vej-Hd3{I=uJ-oCGOpCub5y=MJ&%cJ!xG{}6E~8qqW&
rpj~8=u$iJp4Z4NQY1mv*vm;f7lV$hZ_N)ErU6YQ&DfG?JT}%B1IwqM-

literal 0
HcmV?d00001

diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c
new file mode 100644
index 00000000000..396e06ff090
--- /dev/null
+++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c
@@ -0,0 +1,183 @@
+/*
+ * 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 nr_ue_dci_configuration.c
+ * \brief functions for generating dci search procedures based on RRC Serving Cell Group Configuration
+ * \author R. Knopp
+ * \date 2020
+ * \version 0.1
+ * \company Eurecom
+ * \email: knopp@eurecom.fr
+ * \note
+ * \warning
+ */
+
+#include "mac_proto.h"
+#include "mac_defs.h"
+#include "assertions.h"
+#include "LAYER2/NR_MAC_UE/mac_extern.h"
+#include "mac_defs.h"
+#include <stdio.h>
+
+#ifdef NR_PDCCH_DCI_TOOLS_DEBUG
+#define LOG_DCI_D(a...) printf("\t\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_extract_dci_info) ->" a)
+#else 
+#define LOG_DCI_D(a...)
+#endif
+#define LOG_DCI_PARM(a...) LOG_D(PHY,"\t<-NR_PDCCH_DCI_TOOLS_DEBUG (nr_generate_ue_ul_dlsch_params_from_dci)" a)
+
+
+void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15) {
+
+  LOG_D(MAC,"Filling search candidates for DCI\n");
+  
+  rel15->number_of_candidates=3;
+  rel15->CCE[0]=0;
+  rel15->L[0]=4;
+  rel15->CCE[1]=4;
+  rel15->L[1]=4;
+  rel15->CCE[2]=8;
+  rel15->L[2]=4;
+
+}
+
+void ue_dci_configuration(NR_UE_MAC_INST_t *mac,fapi_nr_dl_config_request_t *dl_config,int frame,int slot) {
+
+  // check if DL slot
+  if (is_nr_DL_slot(mac->scc,slot)==1) {
+    
+    // get BWP 1, Coreset 0, SearchSpace 0  
+    if (mac->DLbwp[0]==NULL) {
+      AssertFatal(mac->scd->downlinkBWP_ToAddModList!=NULL,"downlinkBWP_ToAddModList is null\n");
+      AssertFatal(mac->scd->downlinkBWP_ToAddModList->list.count==1,"downlinkBWP_ToAddModList->list->count is %d\n",
+		  mac->scd->downlinkBWP_ToAddModList->list.count);
+      mac->DLbwp[0]      = mac->scd->downlinkBWP_ToAddModList->list.array[0];
+      AssertFatal(mac->DLbwp[0]->bwp_Dedicated!=NULL,"bwp_Dedicated is null\n");
+      AssertFatal(mac->DLbwp[0]->bwp_Dedicated->pdcch_Config!=NULL,"pdcch_Config is null\n");
+      AssertFatal(mac->DLbwp[0]->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList!=NULL,"controlResourceSetToAddModList is null\n");
+      AssertFatal(mac->DLbwp[0]->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.count==1,"controlResourceSetToAddModList->list.count=%d\n",
+		  mac->DLbwp[0]->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.count);
+      mac->coreset[0][0] = mac->DLbwp[0]->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list.array[0];
+      AssertFatal(mac->coreset[0][0]!=NULL,"coreset[0][0] is null\n");
+      
+      AssertFatal(mac->DLbwp[0]->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList!=NULL,"searchPsacesToAddModList is null\n");
+      AssertFatal(mac->DLbwp[0]->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count>0,
+		  "searchPsacesToAddModList is empty\n");
+      NR_SearchSpace_t *ss;
+      int ss_id=0;
+      AssertFatal(mac->DLbwp[0]->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count<FAPI_NR_MAX_SS_PER_CORESET,
+		  "too many searchpaces per coreset %d\n",
+		  mac->DLbwp[0]->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count);
+      for (int i=0;i<mac->DLbwp[0]->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count;i++) {
+	ss=mac->DLbwp[0]->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.array[i];
+	AssertFatal(ss->controlResourceSetId != NULL,"ss->controlResourceSetId is null\n");
+	AssertFatal(ss->searchSpaceType != NULL,"ss->searchSpaceType is null\n");
+	AssertFatal(*ss->controlResourceSetId == mac->coreset[0][0]->controlResourceSetId,"ss->controlResourceSetId is unknown\n");
+	mac->SSpace[0][0][ss_id] = ss;
+	ss_id++;
+      }
+    }
+    if (mac->ULbwp[0]==NULL) {
+      AssertFatal(mac->scd->uplinkConfig->uplinkBWP_ToAddModList!=NULL,"uplinkBWP_ToAddModList is null\n");
+      AssertFatal(mac->scd->uplinkConfig->uplinkBWP_ToAddModList->list.count==1,"uplinkBWP_ToAddModList->list->count is %d\n",
+		  mac->scd->uplinkConfig->uplinkBWP_ToAddModList->list.count);
+      mac->ULbwp[0]      = mac->scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0];
+      AssertFatal(mac->ULbwp[0]->bwp_Dedicated!=NULL,"bwp_Dedicated is null\n");
+    }
+    // check search spaces
+	
+    int ss_id=0;
+    fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15;
+    int sps =mac->DLbwp[0]->bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12;
+    
+    while(mac->SSpace[0][0][ss_id]!=NULL && 
+	  ss_id < mac->DLbwp[0]->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count) {
+      
+      AssertFatal(mac->SSpace[0][0][ss_id]->monitoringSymbolsWithinSlot!=NULL,"ss->monitoringSymbolsWithinSlot is null\n");
+      AssertFatal(mac->SSpace[0][0][ss_id]->monitoringSymbolsWithinSlot->buf!=NULL,"ss->monitoringSymbolsWithinSlot->buf is null\n");
+      
+      ss_id++;
+    }
+    if (mac->ra_state == WAIT_RAR) {
+      // check for RAR
+      rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15; 
+      rel15->rnti = 2;//get_RA_RNTI(mac,frame,slot);
+      dl_config->number_pdus = dl_config->number_pdus + 1;
+    }
+    else if (mac->ra_state == WAIT_CONTENTION_RESOLUTION) {
+      rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15; 
+      rel15->rnti = mac->t_crnti;
+      dl_config->number_pdus = dl_config->number_pdus + 1;
+    }
+    if (mac->crnti>0) {
+      rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15; 
+      rel15->rnti = mac->crnti;
+      rel15->BWPSize = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275);
+      rel15->BWPStart = NRRIV2PRBOFFSET(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth,275);
+      rel15->SubcarrierSpacing = mac->DLbwp[0]->bwp_Common->genericParameters.subcarrierSpacing;
+      // get UE-specific search space
+      for (ss_id=0;ss_id<FAPI_NR_MAX_SS_PER_CORESET && mac->SSpace[0][0][ss_id]!=NULL;ss_id++) 
+	if (mac->SSpace[0][0][ss_id]->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) break;
+      AssertFatal(ss_id<FAPI_NR_MAX_SS_PER_CORESET,"couldn't find a UE-specific SS\n");
+      // for SPS=14 8 MSBs in positions 13 downto 6,  
+      uint16_t monitoringSymbolsWithinSlot = (mac->SSpace[0][0][ss_id]->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | 
+	(mac->SSpace[0][0][ss_id]->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
+      
+      for (int i=0; i<sps; i++)
+	if ((monitoringSymbolsWithinSlot>>(sps-1-i))&1) {
+	  rel15->coreset.StartSymbolIndex=i;
+	  break;
+	}
+      rel15->coreset.duration = mac->coreset[0][0]->duration;
+      for (int i=0;i<6;i++)
+	rel15->coreset.frequency_domain_resource[i] = mac->coreset[0][0]->frequencyDomainResources.buf[i];
+      
+      rel15->coreset.CceRegMappingType = mac->coreset[0][0]->cce_REG_MappingType.present == NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved?
+	FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED : FAPI_NR_CCE_REG_MAPPING_TYPE_NON_INTERLEAVED;
+      if (rel15->coreset.CceRegMappingType == FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED) {
+	rel15->coreset.RegBundleSize = (mac->coreset[0][0]->cce_REG_MappingType.choice.interleaved->reg_BundleSize == NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6) ? 6 : (2+mac->coreset[0][0]->cce_REG_MappingType.choice.interleaved->reg_BundleSize);
+	rel15->coreset.InterleaverSize = (mac->coreset[0][0]->cce_REG_MappingType.choice.interleaved->interleaverSize==NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n6) ? 6 : (2+mac->coreset[0][0]->cce_REG_MappingType.choice.interleaved->interleaverSize);
+	AssertFatal(mac->scc->physCellId != NULL,"mac->scc->physCellId is null\n");
+	rel15->coreset.ShiftIndex = mac->coreset[0][0]->cce_REG_MappingType.choice.interleaved->shiftIndex != NULL ? *mac->coreset[0][0]->cce_REG_MappingType.choice.interleaved->shiftIndex : *mac->scc->physCellId;
+      }
+      else {
+	rel15->coreset.RegBundleSize = 0;
+	rel15->coreset.InterleaverSize = 0;
+	rel15->coreset.ShiftIndex = 0;
+      }
+      rel15->coreset.CoreSetType = 1;
+      rel15->coreset.precoder_granularity = mac->coreset[0][0]->precoderGranularity;
+      if (mac->coreset[0][0]->pdcch_DMRS_ScramblingID)
+	rel15->coreset.pdcch_dmrs_scrambling_id = *mac->coreset[0][0]->pdcch_DMRS_ScramblingID;
+      else
+	rel15->coreset.pdcch_dmrs_scrambling_id = *mac->scc->physCellId;
+      fill_dci_search_candidates(mac->SSpace[0][0][ss_id],rel15);
+      rel15->dci_format = NR_DL_DCI_FORMAT_1_0;
+      rel15->dci_length = nr_dci_size(rel15->dci_format,NR_RNTI_C,rel15->BWPSize);
+      dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DCI;
+      dl_config->number_pdus = dl_config->number_pdus + 1;
+    }
+  }
+}
+
+
+
+
diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_compute_tbs_common.c b/openair2/LAYER2/NR_MAC_gNB/nr_compute_tbs_common.c
new file mode 100644
index 00000000000..e4e3ac05df9
--- /dev/null
+++ b/openair2/LAYER2/NR_MAC_gNB/nr_compute_tbs_common.c
@@ -0,0 +1,153 @@
+/*
+ * 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: nr_compute_tbs.c
+   purpose: Compute NR TBS
+   author: Hongzhi WANG (TCL)
+*/
+#define INDEX_MAX_TBS_TABLE (93)
+
+#include "common/utils/nr/nr_common.h"
+#include <math.h>
+
+//Table 5.1.2.2-2
+uint16_t Tbstable_nr[INDEX_MAX_TBS_TABLE] = {24,32,40,48,56,64,72,80,88,96,104,112,120,128,136,144,152,160,168,176,184,192,208,224,240,256,272,288,304,320,336,352,368,384,408,432,456,480,504,528,552,576,608,640,672,704,736,768,808,848,888,928,984,1032,1064,1128,1160,1192,1224,1256,1288,1320,1352,1416,1480,1544,1608,1672,1736,1800,1864,1928,2024,2088,2152,2216,2280,2408,2472,2536,2600,2664,2728,2792,2856,2976,3104,3240,3368,3496,3624,3752,3824};
+
+uint16_t NPRB_LBRM[7] = {32,66,107,135,162,217,273};
+
+uint32_t nr_compute_tbs(uint16_t Qm,
+                        uint16_t R,
+			uint16_t nb_rb,
+			uint16_t nb_symb_sch,
+			uint16_t nb_dmrs_prb,
+                        uint16_t nb_rb_oh,
+			uint8_t Nl)
+{
+
+    uint16_t nbp_re, nb_re;
+    uint32_t nr_tbs=0;
+    uint32_t Ninfo, Np_info, C;
+    uint8_t n, scale;
+
+    nbp_re = 12 * nb_symb_sch - nb_dmrs_prb - nb_rb_oh;
+
+    nb_re = min(156, nbp_re) * nb_rb;
+    
+    scale = (R>1024)?11:10;
+
+    // Intermediate number of information bits
+    Ninfo = (nb_re * R * Qm * Nl)>>scale;
+
+    if (Ninfo <=3824) {
+    	n = max(3, floor(log2(Ninfo)) - 6);
+        Np_info = max(24, (Ninfo>>n)<<n);
+        for (int i=0; i<INDEX_MAX_TBS_TABLE; i++) {
+        	if (Tbstable_nr[i] >= Np_info){
+        		nr_tbs = Tbstable_nr[i];
+        		break;
+        	}
+        }
+    }
+    else {
+    	n = log2(Ninfo-24)-5;
+        Np_info = max(3840, (ROUNDIDIV((Ninfo-24),(1<<n)))<<n);
+
+        if (R <= 256) { 
+            C = CEILIDIV((Np_info+24),3816);
+            nr_tbs = (C<<3)*CEILIDIV((Np_info+24),(C<<3)) - 24;
+        }
+        else {
+            if (Np_info > 8424){
+                C = CEILIDIV((Np_info+24),8424);
+                nr_tbs = (C<<3)*CEILIDIV((Np_info+24),(C<<3)) - 24;
+            }
+            else {
+            	nr_tbs = ((CEILIDIV((Np_info+24),8))<<3) - 24;
+            }
+
+        }
+
+    }
+    //printf("Ninfo %d nbp_re %d nb_re %d Qm %d, R %d, tbs %d\n", Ninfo, nbp_re, nb_re, Qm, R, nr_tbs);
+    return nr_tbs;
+}
+
+
+//tbslbrm calculation according to 5.4.2.1 of 38.212
+uint32_t nr_compute_tbslbrm(uint16_t table,
+			    uint16_t nb_rb,
+		            uint8_t Nl,
+                            uint8_t C)
+{
+
+  uint16_t R, nb_re;
+  uint16_t nb_rb_lbrm=0;
+  uint8_t Qm;
+  int i;
+  uint32_t nr_tbs=0;
+  uint32_t Ninfo, Np_info;
+  uint8_t n;
+
+  for (i=0; i<7; i++) {
+      	if (NPRB_LBRM[i] >= nb_rb){
+     		nb_rb_lbrm = NPRB_LBRM[i];
+       		break;
+       	}
+  }
+
+  Qm = ((table == 1)? 8 : 6);
+  R = 948;
+  nb_re = 156 * nb_rb_lbrm;
+
+  // Intermediate number of information bits
+  Ninfo = (nb_re * R * Qm * Nl)>>10;
+
+  if (Ninfo <=3824) {
+    	n = max(3, floor(log2(Ninfo)) - 6);
+        Np_info = max(24, (Ninfo>>n)<<n);
+        for (int i=0; i<INDEX_MAX_TBS_TABLE; i++) {
+        	if (Tbstable_nr[i] >= Np_info){
+        		nr_tbs = Tbstable_nr[i];
+        		break;
+        	}
+        }
+  }
+  else {
+    	n = log2(Ninfo-24)-5;
+        Np_info = max(3840, (ROUNDIDIV((Ninfo-24),(1<<n)))<<n);
+
+        if (R <= 256) { 
+            nr_tbs = (C<<3)*CEILIDIV((Np_info+24),(C<<3)) - 24;
+        }
+        else {
+            if (Np_info > 8424){
+                nr_tbs = (C<<3)*CEILIDIV((Np_info+24),(C<<3)) - 24;
+            }
+            else {
+            	nr_tbs = ((CEILIDIV((Np_info+24),8))<<3) - 24;
+            }
+
+        }
+
+  }
+  return nr_tbs;
+
+}
diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_common.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_common.h
new file mode 100644
index 00000000000..6b043963b01
--- /dev/null
+++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_common.h
@@ -0,0 +1,70 @@
+/*
+ * 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 mac.h
+* \brief MAC data structures, constant, and function prototype
+* \author Navid Nikaein and Raymond Knopp, WIE-TAI CHEN
+* \date Dec. 2019
+* \version 0.1
+* \company Eurecom
+* \email raymond.knopp@eurecom.fr
+
+*/
+
+#ifndef __LAYER2_NR_MAC_COMMON_H__
+#define __LAYER2_NR_MAC_COMMON_H__
+
+uint16_t config_bandwidth(int mu, int nb_rb, int nr_band);
+
+uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn);
+
+uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, uint32_t bw);
+
+int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols);
+
+typedef enum {
+  NR_DL_DCI_FORMAT_1_0 = 0,
+  NR_DL_DCI_FORMAT_1_1,
+  NR_DL_DCI_FORMAT_2_0,
+  NR_DL_DCI_FORMAT_2_1,
+  NR_DL_DCI_FORMAT_2_2,
+  NR_DL_DCI_FORMAT_2_3,
+  NR_UL_DCI_FORMAT_0_0,
+  NR_UL_DCI_FORMAT_0_1
+} nr_dci_format_t;
+
+typedef enum {
+  NR_RNTI_new = 0,
+  NR_RNTI_C,
+  NR_RNTI_RA,
+  NR_RNTI_P,
+  NR_RNTI_CS,
+  NR_RNTI_TC,
+  NR_RNTI_SP_CSI,
+  NR_RNTI_SI,
+  NR_RNTI_SFI,
+  NR_RNTI_INT,
+  NR_RNTI_TPC_PUSCH,
+  NR_RNTI_TPC_PUCCH,
+  NR_RNTI_TPC_SRS
+} nr_rnti_type_t;
+
+#endif
diff --git a/openair2/RRC/LTE/rrc_eNB_endc.c b/openair2/RRC/LTE/rrc_eNB_endc.c
new file mode 100644
index 00000000000..3d3d9787b59
--- /dev/null
+++ b/openair2/RRC/LTE/rrc_eNB_endc.c
@@ -0,0 +1,243 @@
+/*
+ * 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
+ */
+
+#include "rrc_defs.h"
+#include "rrc_extern.h"
+#include "rrc_eNB_UE_context.h"
+#include "common/ran_context.h"
+#include "LTE_DL-DCCH-Message.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <unistd.h>
+
+extern RAN_CONTEXT_t RC;
+extern mui_t rrc_eNB_mui;
+
+int rrc_eNB_generate_RRCConnectionReconfiguration_endc(protocol_ctxt_t *ctxt,
+                                                       rrc_eNB_ue_context_t *ue_context,
+                                                       unsigned char *buffer,
+                                                       int buffer_size,
+                                                       OCTET_STRING_t *scg_group_config,
+                                                       OCTET_STRING_t *scg_RB_config)
+{
+  asn_enc_rval_t                                          enc_rval;
+  LTE_DL_DCCH_Message_t                                   dl_dcch_msg;
+  LTE_RRCConnectionReconfiguration_t                      *r;
+  int                                                     trans_id;
+  LTE_RadioResourceConfigDedicated_t                      rrcd;
+#if 0
+  LTE_DRB_ToAddModList_t                                  drb_list;
+  struct LTE_DRB_ToAddMod                                 drb;
+  long                                                    eps_bearer_id;
+  struct LTE_RLC_Config                                   rlc;
+  long                                                    lcid;
+  struct LTE_LogicalChannelConfig                         lc;
+#endif
+  LTE_DRB_ToReleaseList_t                                 drb_list;
+  LTE_DRB_Identity_t                                      drb;
+  struct LTE_LogicalChannelConfig__ul_SpecificParameters  ul_params;
+  long                                                    lcg;
+  struct LTE_RadioResourceConfigDedicated__mac_MainConfig mac;
+  struct LTE_MAC_MainConfig__ext4                         mac_ext4;
+  struct LTE_MAC_MainConfig__ext4__dualConnectivityPHR    dc_phr;
+
+  memset(&rrcd, 0, sizeof(rrcd));
+  memset(&drb_list, 0, sizeof(drb_list));
+  memset(&drb, 0, sizeof(drb));
+#if 0
+  memset(&rlc, 0, sizeof(rlc));
+  memset(&lc, 0, sizeof(lc));
+#endif
+  memset(&ul_params, 0, sizeof(ul_params));
+  memset(&mac, 0, sizeof(mac));
+  memset(&mac_ext4, 0, sizeof(mac_ext4));
+  memset(&dc_phr, 0, sizeof(dc_phr));
+
+  trans_id = rrc_eNB_get_next_transaction_identifier(ctxt->module_id);
+
+  memset(&dl_dcch_msg,0,sizeof(LTE_DL_DCCH_Message_t));
+
+  dl_dcch_msg.message.present           = LTE_DL_DCCH_MessageType_PR_c1;
+  dl_dcch_msg.message.choice.c1.present = LTE_DL_DCCH_MessageType__c1_PR_rrcConnectionReconfiguration;
+
+  r = &dl_dcch_msg.message.choice.c1.choice.rrcConnectionReconfiguration;
+
+  r->rrc_TransactionIdentifier = trans_id;
+  r->criticalExtensions.present = LTE_RRCConnectionReconfiguration__criticalExtensions_PR_c1;
+  r->criticalExtensions.choice.c1.present = LTE_RRCConnectionReconfiguration__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r8;
+  r->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated = &rrcd;
+
+#if 0
+  rrcd.drb_ToAddModList = &drb_list;
+
+  eps_bearer_id = 5;
+  drb.eps_BearerIdentity = &eps_bearer_id;
+  drb.drb_Identity = 5;
+  drb.rlc_Config = &rlc;
+  lcid = 4;
+  drb.logicalChannelIdentity = &lcid;
+  drb.logicalChannelConfig = &lc;
+
+  ASN_SEQUENCE_ADD(&drb_list.list, &drb);
+
+  rlc.present = LTE_RLC_Config_PR_am;
+  rlc.choice.am.ul_AM_RLC.t_PollRetransmit = LTE_T_PollRetransmit_ms50;
+  rlc.choice.am.ul_AM_RLC.pollPDU = LTE_PollPDU_p16;
+  rlc.choice.am.ul_AM_RLC.pollByte = LTE_PollByte_kBinfinity;
+  rlc.choice.am.ul_AM_RLC.maxRetxThreshold = LTE_UL_AM_RLC__maxRetxThreshold_t8;
+  rlc.choice.am.dl_AM_RLC.t_Reordering = LTE_T_Reordering_ms35;
+  rlc.choice.am.dl_AM_RLC.t_StatusProhibit = LTE_T_StatusProhibit_ms25;
+
+  lc.ul_SpecificParameters = &ul_params;
+#endif
+
+  /* release drb 1 */
+  drb = 1;
+  ASN_SEQUENCE_ADD(&drb_list.list, &drb);
+  rrcd.drb_ToReleaseList = &drb_list;
+
+  ul_params.priority = 12;
+  ul_params.prioritisedBitRate = LTE_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8;
+  ul_params.bucketSizeDuration = LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms300;
+  lcg = 3;
+  ul_params.logicalChannelGroup = &lcg;
+
+  rrcd.mac_MainConfig = &mac;
+
+  mac.present = LTE_RadioResourceConfigDedicated__mac_MainConfig_PR_explicitValue;
+  mac.choice.explicitValue.timeAlignmentTimerDedicated = LTE_TimeAlignmentTimer_sf10240;
+  mac.choice.explicitValue.ext4 = &mac_ext4;
+
+  mac_ext4.dualConnectivityPHR = &dc_phr;
+
+  dc_phr.present = LTE_MAC_MainConfig__ext4__dualConnectivityPHR_PR_setup;
+  dc_phr.choice.setup.phr_ModeOtherCG_r12 = LTE_MAC_MainConfig__ext4__dualConnectivityPHR__setup__phr_ModeOtherCG_r12_virtual;
+
+  /* NR config */
+  struct LTE_RRCConnectionReconfiguration_v890_IEs cr_890;
+  struct LTE_RRCConnectionReconfiguration_v920_IEs cr_920;
+  struct LTE_RRCConnectionReconfiguration_v1020_IEs cr_1020;
+  struct LTE_RRCConnectionReconfiguration_v1130_IEs cr_1130;
+  struct LTE_RRCConnectionReconfiguration_v1250_IEs cr_1250;
+  struct LTE_RRCConnectionReconfiguration_v1310_IEs cr_1310;
+  struct LTE_RRCConnectionReconfiguration_v1430_IEs cr_1430;
+  struct LTE_RRCConnectionReconfiguration_v1510_IEs cr_1510;
+  struct LTE_RRCConnectionReconfiguration_v1510_IEs__nr_Config_r15 nr;
+
+  memset(&cr_890, 0, sizeof(cr_890));
+  memset(&cr_920, 0, sizeof(cr_920));
+  memset(&cr_1020, 0, sizeof(cr_1020));
+  memset(&cr_1130, 0, sizeof(cr_1130));
+  memset(&cr_1250, 0, sizeof(cr_1250));
+  memset(&cr_1310, 0, sizeof(cr_1310));
+  memset(&cr_1430, 0, sizeof(cr_1430));
+  memset(&cr_1510, 0, sizeof(cr_1510));
+  memset(&nr, 0, sizeof(nr));
+
+  r->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.nonCriticalExtension = &cr_890;
+  cr_890.nonCriticalExtension = &cr_920;
+  cr_920.nonCriticalExtension = &cr_1020;
+  cr_1020.nonCriticalExtension = &cr_1130;
+  cr_1130.nonCriticalExtension = &cr_1250;
+  cr_1250.nonCriticalExtension = &cr_1310;
+  cr_1310.nonCriticalExtension = &cr_1430;
+  cr_1430.nonCriticalExtension = &cr_1510;
+
+  cr_1510.nr_Config_r15 = &nr;
+  nr.present = LTE_RRCConnectionReconfiguration_v1510_IEs__nr_Config_r15_PR_setup;
+  nr.choice.setup.endc_ReleaseAndAdd_r15 = 0;  /* FALSE */
+
+  OCTET_STRING_t dummy_scg_conf;
+  unsigned char scg_conf_buf[4] = { 0, 0, 0, 0 };
+  if (scg_group_config!=NULL)
+	  nr.choice.setup.nr_SecondaryCellGroupConfig_r15 = scg_group_config; //&scg_conf;
+  else{
+	  nr.choice.setup.nr_SecondaryCellGroupConfig_r15 = &dummy_scg_conf;
+	  dummy_scg_conf.buf = scg_conf_buf;
+	  dummy_scg_conf.size = 4;
+  }
+
+#ifdef DEBUG_SCG_CONFIG
+	{
+		int size_s = nr.choice.setup.nr_SecondaryCellGroupConfig_r15->size;
+		int i;
+		LOG_I(RRC, "Dumping nr_SecondaryCellGroupConfig: %d", size_s);
+		for (i=0; i<size_s; i++) printf("%2.2x", (unsigned char)nr.choice.setup.nr_SecondaryCellGroupConfig_r15->buf[i]);
+		printf("\n");
+
+	}
+#endif
+
+
+  long sk_counter = 0;
+  cr_1510.sk_Counter_r15 = &sk_counter;
+
+  OCTET_STRING_t dummy_nr1_conf;
+  unsigned char nr1_buf[4] = { 0, 0, 0, 0 };
+
+  if(scg_RB_config!=NULL)
+	  cr_1510.nr_RadioBearerConfig1_r15 = scg_RB_config;
+  else{
+	  cr_1510.nr_RadioBearerConfig1_r15 = &dummy_nr1_conf;
+	  dummy_nr1_conf.buf = nr1_buf;
+	  dummy_nr1_conf.size = 4;
+  }
+
+#ifdef DEBUG_SCG_CONFIG
+  {
+	  int size_s = cr_1510.nr_RadioBearerConfig1_r15->size;
+	  int i;
+	  LOG_I(RRC, "Dumping nr_RadioBearerConfig1: %d", size_s);
+	  for (i=0; i<size_s; i++) printf("%2.2x", (unsigned char)cr_1510.nr_RadioBearerConfig1_r15->buf[i]);
+	  printf("\n");
+
+  }
+#endif
+
+
+#if 0
+  OCTET_STRING_t nr2_conf;
+  unsigned char nr2_buf[4] = { 0, 0, 0, 0 };
+  cr_1510.nr_RadioBearerConfig2_r15 = &nr2_conf;
+  nr2_conf.buf = nr2_buf;
+  nr2_conf.size = 4;
+#endif
+
+  enc_rval = uper_encode_to_buffer(&asn_DEF_LTE_DL_DCCH_Message,
+                                   NULL,
+                                   (void *)&dl_dcch_msg,
+                                   buffer,
+                                   buffer_size);
+
+{
+int len = (enc_rval.encoded + 7) / 8;
+int i;
+printf("len = %d\n", len);
+for (i = 0; i < len; i++) printf(" %2.2x", buffer[i]);
+printf("\n");
+}
+
+  return (enc_rval.encoded + 7) / 8;
+}
diff --git a/openair2/RRC/NR/rrc_gNB_UE_context.c b/openair2/RRC/NR/rrc_gNB_UE_context.c
new file mode 100644
index 00000000000..b5fb50f5094
--- /dev/null
+++ b/openair2/RRC/NR/rrc_gNB_UE_context.c
@@ -0,0 +1,223 @@
+/*
+ * 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 rrc_gNB_UE_context.h
+ * \brief rrc procedures for UE context
+ * \author Lionel GAUTHIER
+ * \date 2015
+ * \version 1.0
+ * \company Eurecom
+ * \email: lionel.gauthier@eurecom.fr
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+
+#include "common/utils/LOG/log.h"
+#include "rrc_gNB_UE_context.h"
+#include "msc.h"
+
+
+//------------------------------------------------------------------------------
+void nr_uid_linear_allocator_init(
+  nr_uid_allocator_t *const uid_pP
+)
+//------------------------------------------------------------------------------
+{
+  memset(uid_pP, 0, sizeof(nr_uid_allocator_t));
+}
+
+//------------------------------------------------------------------------------
+uid_nr_t nr_uid_linear_allocator_new(gNB_RRC_INST *const rrc_instance_pP)
+//------------------------------------------------------------------------------
+{
+  unsigned int i;
+  unsigned int bit_index = 1;
+  uid_nr_t        uid = 0;
+  nr_uid_allocator_t *uia_p = &rrc_instance_pP->uid_allocator;
+
+  for (i=0; i < UID_LINEAR_ALLOCATOR_BITMAP_SIZE; i++) {
+    if (uia_p->bitmap[i] != UINT_MAX) {
+      bit_index = 1;
+      uid       = 0;
+
+      while ((uia_p->bitmap[i] & bit_index) == bit_index) {
+        bit_index = bit_index << 1;
+        uid       += 1;
+      }
+
+      uia_p->bitmap[i] |= bit_index;
+      return uid + (i*sizeof(unsigned int)*8);
+    } 
+  }
+
+  return UINT_MAX;
+}
+
+
+//------------------------------------------------------------------------------
+void
+nr_uid_linear_allocator_free(
+			     gNB_RRC_INST *rrc_instance_pP,
+			     uid_nr_t uidP
+)
+//------------------------------------------------------------------------------
+{
+  unsigned int i = uidP/sizeof(unsigned int)/8;
+  unsigned int bit = uidP % (sizeof(unsigned int) * 8);
+  unsigned int value = ~(0x00000001 << bit);
+
+  if (i < UID_LINEAR_ALLOCATOR_BITMAP_SIZE) {
+    rrc_instance_pP->uid_allocator.bitmap[i] &=  value;
+  }
+}
+
+
+//------------------------------------------------------------------------------
+int rrc_gNB_compare_ue_rnti_id(
+  struct rrc_gNB_ue_context_s *c1_pP, struct rrc_gNB_ue_context_s *c2_pP)
+//------------------------------------------------------------------------------
+{
+  if (c1_pP->ue_id_rnti > c2_pP->ue_id_rnti) {
+    return 1;
+  }
+
+  if (c1_pP->ue_id_rnti < c2_pP->ue_id_rnti) {
+    return -1;
+  }
+
+  return 0;
+}
+
+/* Generate the tree management functions */
+RB_GENERATE(rrc_nr_ue_tree_s, rrc_gNB_ue_context_s, entries,
+            rrc_gNB_compare_ue_rnti_id);
+
+
+
+//------------------------------------------------------------------------------
+struct rrc_gNB_ue_context_s *
+rrc_gNB_allocate_new_UE_context(
+  gNB_RRC_INST *rrc_instance_pP
+)
+//------------------------------------------------------------------------------
+{
+  struct rrc_gNB_ue_context_s *new_p;
+  new_p = (struct rrc_gNB_ue_context_s * )malloc(sizeof(struct rrc_gNB_ue_context_s));
+
+  if (new_p == NULL) {
+    LOG_E(RRC, "Cannot allocate new ue context\n");
+    return NULL;
+  }
+
+  memset(new_p, 0, sizeof(struct rrc_gNB_ue_context_s));
+  new_p->local_uid = nr_uid_linear_allocator_new(rrc_instance_pP);
+
+  for(int i = 0; i < NB_RB_MAX; i++) {
+    new_p->ue_context.e_rab[i].xid = -1;
+    new_p->ue_context.modify_e_rab[i].xid = -1;
+  }
+
+  LOG_I(NR_RRC,"Returning new UE context at %p\n",new_p);
+  return(new_p);
+}
+
+
+//------------------------------------------------------------------------------
+struct rrc_gNB_ue_context_s *
+rrc_gNB_get_ue_context(
+  gNB_RRC_INST *rrc_instance_pP,
+  rnti_t rntiP)
+//------------------------------------------------------------------------------
+{
+  rrc_gNB_ue_context_t temp;
+  memset(&temp, 0, sizeof(struct rrc_gNB_ue_context_s));
+  /* gNB ue rrc id = 24 bits wide */
+  temp.ue_id_rnti = rntiP;
+  struct rrc_gNB_ue_context_s   *ue_context_p = NULL;
+  ue_context_p = RB_FIND(rrc_nr_ue_tree_s, &rrc_instance_pP->rrc_ue_head, &temp);
+
+  if ( ue_context_p != NULL) {
+    return ue_context_p;
+  } else {
+    RB_FOREACH(ue_context_p, rrc_nr_ue_tree_s, &(rrc_instance_pP->rrc_ue_head)) {
+      if (ue_context_p->ue_context.rnti == rntiP) {
+        return ue_context_p;
+      }
+    }
+    return NULL;
+  }
+}
+
+void rrc_gNB_free_mem_UE_context(
+  const protocol_ctxt_t               *const ctxt_pP,
+  struct rrc_gNB_ue_context_s         *const ue_context_pP
+)
+//-----------------------------------------------------------------------------
+{
+
+  LOG_T(RRC,
+        PROTOCOL_RRC_CTXT_UE_FMT" Clearing UE context 0x%p (free internal structs)\n",
+        PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
+        ue_context_pP);
+
+  ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_LTE_SCellToAddMod_r10, &ue_context_pP->ue_context.sCell_config[0]);
+  ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_LTE_SCellToAddMod_r10, &ue_context_pP->ue_context.sCell_config[1]);
+
+  // empty the internal fields of the UE context here
+}
+
+//------------------------------------------------------------------------------
+void rrc_gNB_remove_ue_context(
+  const protocol_ctxt_t *const ctxt_pP,
+  gNB_RRC_INST                *rrc_instance_pP,
+  struct rrc_gNB_ue_context_s *ue_context_pP)
+//------------------------------------------------------------------------------
+{
+  if (rrc_instance_pP == NULL) {
+    LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Bad RRC instance\n",
+          PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+    return;
+  }
+
+  if (ue_context_pP == NULL) {
+    LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Trying to free a NULL UE context\n",
+          PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+    return;
+  }
+
+  RB_REMOVE(rrc_nr_ue_tree_s, &rrc_instance_pP->rrc_ue_head, ue_context_pP);
+  MSC_LOG_EVENT(
+    MSC_RRC_ENB,
+    "0 Removed UE %"PRIx16" ",
+    ue_context_pP->ue_context.rnti);
+  rrc_gNB_free_mem_UE_context(ctxt_pP, ue_context_pP);
+  nr_uid_linear_allocator_free(rrc_instance_pP, ue_context_pP->local_uid);
+  free(ue_context_pP);
+  rrc_instance_pP->Nb_ue --;
+  LOG_I(RRC,
+        PROTOCOL_RRC_CTXT_UE_FMT" Removed UE context\n",
+        PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
+}
+
+
diff --git a/openair2/RRC/NR/rrc_gNB_UE_context.h b/openair2/RRC/NR/rrc_gNB_UE_context.h
new file mode 100644
index 00000000000..4681cabb8f2
--- /dev/null
+++ b/openair2/RRC/NR/rrc_gNB_UE_context.h
@@ -0,0 +1,80 @@
+/*
+ * 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 rrc_eNB_UE_context.h
+ * \brief rrc procedures for UE context
+ * \author Lionel GAUTHIER
+ * \date 2015
+ * \version 1.0
+ * \company Eurecom
+ * \email: lionel.gauthier@eurecom.fr
+ */
+#ifndef __RRC_ENB_UE_CONTEXT_H__
+#include "collection/tree.h"
+#include "COMMON/platform_types.h"
+#include "nr_rrc_defs.h"
+
+
+void
+nr_uid_linear_allocator_init(
+  nr_uid_allocator_t* const uid_pP
+);
+
+uid_t
+nr_uid_linear_allocator_new(
+  gNB_RRC_INST* rrc_instance_pP
+);
+
+
+void
+nr_uid_linear_allocator_free(
+  gNB_RRC_INST* rrc_instance_pP,
+  uid_t uidP
+);
+
+
+
+
+int rrc_gNB_compare_ue_rnti_id(
+  struct rrc_gNB_ue_context_s* c1_pP,
+  struct rrc_gNB_ue_context_s* c2_pP
+);
+
+RB_PROTOTYPE(rrc_ue_tree_s, rrc_gNB_ue_context_s, entries, rrc_gNB_compare_ue_rnti_id);
+
+struct rrc_gNB_ue_context_s*
+rrc_gNB_allocate_new_UE_context(
+  gNB_RRC_INST* rrc_instance_pP
+);
+
+struct rrc_gNB_ue_context_s*
+rrc_gNB_get_ue_context(
+  gNB_RRC_INST* rrc_instance_pP,
+  rnti_t rntiP
+);
+
+void rrc_gNB_remove_ue_context(
+  const protocol_ctxt_t* const ctxt_pP,
+  gNB_RRC_INST*                rrc_instance_pP,
+  struct rrc_gNB_ue_context_s* ue_context_pP
+);
+
+#endif
diff --git a/openair2/RRC/NR/rrc_gNB_internode.c b/openair2/RRC/NR/rrc_gNB_internode.c
new file mode 100644
index 00000000000..581015db56d
--- /dev/null
+++ b/openair2/RRC/NR/rrc_gNB_internode.c
@@ -0,0 +1,127 @@
+/*
+ * 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 rrc_gNB_internode.c
+ * \brief rrc internode procedures for gNB
+ * \author Raymond Knopp
+ * \date 2019
+ * \version 1.0
+ * \company Eurecom
+ * \email: raymond.knopp@eurecom.fr
+ */
+#ifndef RRC_GNB_INTERNODE_C
+#define RRC_GNB_INTERNODE_C
+
+#include "nr_rrc_defs.h"
+#include "NR_RRCReconfiguration.h"
+#include "NR_UE-NR-Capability.h"
+#include "NR_CG-ConfigInfo.h"
+#include "NR_UE-CapabilityRAT-ContainerList.h"
+#include "LTE_UE-CapabilityRAT-ContainerList.h"
+#include "NR_CG-Config.h"
+
+int parse_CG_ConfigInfo(gNB_RRC_INST *rrc, NR_CG_ConfigInfo_t *CG_ConfigInfo) {
+
+  if (CG_ConfigInfo->criticalExtensions.present == NR_CG_ConfigInfo__criticalExtensions_PR_c1) {
+    if (CG_ConfigInfo->criticalExtensions.choice.c1) {
+      if (CG_ConfigInfo->criticalExtensions.choice.c1->present == NR_CG_ConfigInfo__criticalExtensions__c1_PR_cg_ConfigInfo) {
+	NR_CG_ConfigInfo_IEs_t *cg_ConfigInfo = CG_ConfigInfo->criticalExtensions.choice.c1->choice.cg_ConfigInfo;
+	if (cg_ConfigInfo->ue_CapabilityInfo) {
+	  // Decode UE-CapabilityRAT-ContainerList
+          LTE_UE_CapabilityRAT_ContainerList_t *UE_CapabilityRAT_ContainerList=NULL;
+	  asn_dec_rval_t dec_rval = uper_decode(NULL,
+					        &asn_DEF_LTE_UE_CapabilityRAT_ContainerList,
+						(void**)&UE_CapabilityRAT_ContainerList,
+						cg_ConfigInfo->ue_CapabilityInfo->buf,
+						cg_ConfigInfo->ue_CapabilityInfo->size, 0, 0);
+          if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
+	    AssertFatal(1==0,"[InterNode] Failed to decode NR_UE_CapabilityRAT_ContainerList (%zu bits), size of OCTET_STRING %lu\n",
+			dec_rval.consumed, cg_ConfigInfo->ue_CapabilityInfo->size);
+	  }
+	  rrc_parse_ue_capabilities(rrc,UE_CapabilityRAT_ContainerList);
+	}
+	if (cg_ConfigInfo->candidateCellInfoListMN) AssertFatal(1==0,"Can't handle candidateCellInfoListMN yet\n");
+      }
+      else AssertFatal(1==0,"c1 extension is not cg_ConfigInfo, returning\n");
+    }
+    else {
+      LOG_E(RRC,"c1 extension not found, returning\n");
+      return(-1); 
+    }
+  } else {
+    LOG_E(RRC,"Ignoring unknown CG_ConfigInfo extensions\n");
+    return(-1);
+  }
+  return(0);  
+}
+
+
+int generate_CG_Config(gNB_RRC_INST *rrc, 
+		       NR_CG_Config_t *cg_Config,
+		       NR_RRCReconfiguration_t *reconfig,
+		       NR_RadioBearerConfig_t *rbconfig) {
+
+
+  cg_Config->criticalExtensions.present = NR_CG_Config__criticalExtensions_PR_c1;
+  cg_Config->criticalExtensions.choice.c1 = calloc(1,sizeof(*cg_Config->criticalExtensions.choice.c1));
+  cg_Config->criticalExtensions.choice.c1->present = NR_CG_Config__criticalExtensions__c1_PR_cg_Config;
+  cg_Config->criticalExtensions.choice.c1->choice.cg_Config = calloc(1,sizeof(NR_CG_Config_IEs_t));
+  char buffer[1024];
+  int total_size;
+  asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_RRCReconfiguration, NULL, (void *)reconfig, buffer, 1024);
+  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+  cg_Config->criticalExtensions.choice.c1->choice.cg_Config->scg_CellGroupConfig = calloc(1,sizeof(OCTET_STRING_t));
+  OCTET_STRING_fromBuf(cg_Config->criticalExtensions.choice.c1->choice.cg_Config->scg_CellGroupConfig,
+		       (const char *)buffer,
+		       (enc_rval.encoded+7)>>3);
+  total_size = (enc_rval.encoded+7)>>3;
+
+  LOG_I(RRC,"Dumping NR_RRCReconfiguration message (%jd bytes)\n",(enc_rval.encoded+7)>>3);
+  for (int i=0;i<(enc_rval.encoded+7)>>3;i++) {
+    printf("%02x",((uint8_t *)buffer)[i]);
+  }
+  printf("\n");
+  FILE *fd = fopen("reconfig.raw","w");
+  fwrite((void*)buffer,1,(size_t)((enc_rval.encoded+7)>>3),fd);
+  fclose(fd);
+
+  enc_rval = uper_encode_to_buffer(&asn_DEF_NR_RadioBearerConfig, NULL, (void *)rbconfig, buffer, 1024);
+  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n",
+               enc_rval.failed_type->name, enc_rval.encoded);
+  cg_Config->criticalExtensions.choice.c1->choice.cg_Config->scg_RB_Config = calloc(1,sizeof(OCTET_STRING_t));
+  OCTET_STRING_fromBuf(cg_Config->criticalExtensions.choice.c1->choice.cg_Config->scg_RB_Config,
+		       (const char *)buffer,
+		       (enc_rval.encoded+7)>>3);  
+  LOG_I(RRC,"Dumping scg_RB_Config message (%jd bytes)\n",(enc_rval.encoded+7)>>3);
+  for (int i=0;i<(enc_rval.encoded+7)>>3;i++) {
+    printf("%02x",((uint8_t*)buffer)[i]);
+  }
+  printf("\n");
+  fd = fopen("rbconfig.raw","w");
+  fwrite((void*)buffer,1,(size_t)((enc_rval.encoded+7)>>3),fd);
+  fclose(fd);
+  total_size = total_size + ((enc_rval.encoded+7)>>3);
+
+  return(total_size);
+}
+
+#endif
diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c
new file mode 100644
index 00000000000..cf48aef4594
--- /dev/null
+++ b/openair2/RRC/NR/rrc_gNB_nsa.c
@@ -0,0 +1,159 @@
+/*
+ * 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 rrc_gNB_nsa.c
+ * \brief rrc NSA procedures for gNB
+ * \author Raymond Knopp
+ * \date 2019
+ * \version 1.0
+ * \company Eurecom
+ * \email: raymond.knopp@eurecom.fr
+ */
+#ifndef RRC_GNB_NSA_C
+#define RRC_GNB_NSA_C
+
+#include "nr_rrc_defs.h"
+#include "NR_RRCReconfiguration.h"
+#include "NR_UE-NR-Capability.h"
+//#include "NR_UE-CapabilityRAT-ContainerList.h"
+#include "LTE_UE-CapabilityRAT-ContainerList.h"
+#include "NR_CG-Config.h"
+#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
+
+void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc,LTE_UE_CapabilityRAT_ContainerList_t *UE_CapabilityRAT_ContainerList) {
+
+  struct rrc_gNB_ue_context_s        *ue_context_p = NULL;
+  OCTET_STRING_t *ueCapabilityRAT_Container_nr;
+  OCTET_STRING_t *ueCapabilityRAT_Container_MRDC;
+  int list_size;
+  AssertFatal(UE_CapabilityRAT_ContainerList!=NULL,"UE_CapabilityRAT_ContainerList is null\n");
+  AssertFatal((list_size=UE_CapabilityRAT_ContainerList->list.count) >= 2, "UE_CapabilityRAT_ContainerList->list.size %d < 2\n",UE_CapabilityRAT_ContainerList->list.count);
+  for (int i=0;i<list_size;i++) {
+    if (UE_CapabilityRAT_ContainerList->list.array[i]->rat_Type == LTE_RAT_Type_nr) ueCapabilityRAT_Container_nr = &UE_CapabilityRAT_ContainerList->list.array[i]->ueCapabilityRAT_Container;
+    else if (UE_CapabilityRAT_ContainerList->list.array[i]->rat_Type == LTE_RAT_Type_eutra_nr) ueCapabilityRAT_Container_MRDC = &UE_CapabilityRAT_ContainerList->list.array[i]->ueCapabilityRAT_Container;
+  }    
+
+  AssertFatal(ueCapabilityRAT_Container_nr!=NULL,"ueCapabilityRAT_Container_nr is NULL\n");
+  AssertFatal(ueCapabilityRAT_Container_MRDC!=NULL,"ueCapabilityRAT_Container_MRDC is NULL\n");
+  // decode and store capabilities
+  ue_context_p = rrc_gNB_allocate_new_UE_context(rrc);
+  
+  asn_dec_rval_t dec_rval = uper_decode(NULL,
+					&asn_DEF_NR_UE_NR_Capability,
+					(void **)&ue_context_p->ue_context.UE_Capability_nr,
+					ueCapabilityRAT_Container_nr->buf,
+					ueCapabilityRAT_Container_nr->size, 0, 0);
+
+  if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
+    LOG_E(RRC, "Failed to decode UE NR capabilities (%zu bytes) container size %lu\n", dec_rval.consumed,ueCapabilityRAT_Container_nr->size);
+      ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability,
+                      ue_context_p->ue_context.UE_Capability_nr);
+      ue_context_p->ue_context.UE_Capability_nr = 0;
+      AssertFatal(1==0,"exiting\n");
+  }
+
+  dec_rval = uper_decode(NULL,
+			 &asn_DEF_NR_UE_MRDC_Capability,
+			 (void **)&ue_context_p->ue_context.UE_Capability_MRDC,
+			 ueCapabilityRAT_Container_MRDC->buf,
+			 ueCapabilityRAT_Container_MRDC->size, 0, 0);
+
+  if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
+      LOG_E(RRC, "Failed to decode UE MRDC capabilities (%zu bytes)\n", dec_rval.consumed);
+      ASN_STRUCT_FREE(asn_DEF_NR_UE_MRDC_Capability,
+                      ue_context_p->ue_context.UE_Capability_MRDC);
+      ue_context_p->ue_context.UE_Capability_MRDC = 0;
+      AssertFatal(1==0,"exiting\n");
+  }
+
+  // dump ue_capabilities
+
+  if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+     xer_fprint(stdout, &asn_DEF_NR_UE_NR_Capability, ue_context_p->ue_context.UE_Capability_nr);
+  }  
+
+  if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) {
+     xer_fprint(stdout, &asn_DEF_NR_UE_MRDC_Capability, ue_context_p->ue_context.UE_Capability_MRDC);
+  }  
+
+  rrc_add_nsa_user(rrc,ue_context_p);
+}
+
+void rrc_add_nsa_user(gNB_RRC_INST *rrc,struct rrc_gNB_ue_context_s *ue_context_p) {
+
+// generate nr-Config-r15 containers for LTE RRC : inside message for X2 EN-DC (CG-Config Message from 38.331)
+
+  rrc_gNB_carrier_data_t *carrier=&rrc->carrier;
+
+  MessageDef *msg;
+  msg = itti_alloc_new_message(TASK_RRC_ENB, X2AP_ENDC_SGNB_ADDITION_REQ_ACK);
+
+// NR RRCReconfiguration
+
+  AssertFatal(rrc->Nb_ue < MAX_NR_RRC_UE_CONTEXTS,"cannot add another UE\n");
+
+  ue_context_p->ue_context.reconfig = calloc(1,sizeof(NR_RRCReconfiguration_t));
+  ue_context_p->ue_context.secondaryCellGroup = calloc(1,sizeof(NR_CellGroupConfig_t));
+  memset((void*)ue_context_p->ue_context.reconfig,0,sizeof(NR_RRCReconfiguration_t));
+  ue_context_p->ue_context.reconfig->rrc_TransactionIdentifier=0;
+  ue_context_p->ue_context.reconfig->criticalExtensions.present = NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration;
+  NR_RRCReconfiguration_IEs_t *reconfig_ies=calloc(1,sizeof(NR_RRCReconfiguration_IEs_t));
+  ue_context_p->ue_context.reconfig->criticalExtensions.choice.rrcReconfiguration = reconfig_ies;
+  carrier->initial_csi_index[rrc->Nb_ue] = 0;
+  fill_default_reconfig(carrier->servingcellconfigcommon,
+			reconfig_ies,
+			ue_context_p->ue_context.secondaryCellGroup,
+			carrier->pdsch_AntennaPorts,
+			carrier->initial_csi_index[rrc->Nb_ue]);
+
+  ue_context_p->ue_context.rb_config = calloc(1,sizeof(NR_RRCReconfiguration_t));
+
+  fill_default_rbconfig(ue_context_p->ue_context.rb_config);
+  ue_context_p->ue_id_rnti = ue_context_p->ue_context.secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity;
+  NR_CG_Config_t *CG_Config = calloc(1,sizeof(*CG_Config));
+  memset((void*)CG_Config,0,sizeof(*CG_Config));
+  int CG_Config_size = generate_CG_Config(rrc,CG_Config,ue_context_p->ue_context.reconfig,ue_context_p->ue_context.rb_config);
+
+  //X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).rrc_buffer_size = CG_Config_size; //Need to verify correct value for the buffer_size
+  // Send to X2 entity to transport to MeNB
+  asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CG_Config,
+          	  	  	  	  	  	  	  	  	  	  NULL,
+          	  	  	  	  	  	  	  	  	  	  (void *)CG_Config,
+          	  	  	  	  	  	  	  	  	  	  X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).rrc_buffer,
+												  1024);
+
+  X2AP_ENDC_SGNB_ADDITION_REQ_ACK(msg).rrc_buffer_size = (enc_rval.encoded+7)>>3;
+
+  itti_send_msg_to_task(TASK_X2AP, ENB_MODULE_ID_TO_INSTANCE(0), msg); //Check right id instead of hardcoding
+
+  rrc->Nb_ue++;
+  // configure MAC and RLC
+  rrc_mac_config_req_gNB(rrc->module_id,
+			 rrc->carrier.ssb_SubcarrierOffset,
+                         rrc->carrier.pdsch_AntennaPorts,
+			 NULL,
+			 1, // add_ue flag
+			 ue_context_p->ue_id_rnti,
+			 ue_context_p->ue_context.secondaryCellGroup);
+}
+
+
+#endif
diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c
new file mode 100644
index 00000000000..1df17a19aa0
--- /dev/null
+++ b/openair2/RRC/NR/rrc_gNB_reconfig.c
@@ -0,0 +1,2085 @@
+/*
+ * 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 rrc_gNB_reconfig.c
+ * \brief rrc gNB RRCreconfiguration support routines
+ * \author Raymond Knopp
+ * \date 2019
+ * \version 1.0
+ * \company Eurecom
+ * \email: raymond.knopp@eurecom.fr
+ */
+#ifndef RRC_GNB_NSA_C
+#define RRC_GNB_NSA_C
+
+#include "NR_ServingCellConfigCommon.h"
+#include "NR_RRCReconfiguration.h"
+#include "NR_RRCReconfiguration-IEs.h"
+#include "NR_CellGroupConfig.h"
+#include "NR_MAC-CellGroupConfig.h"
+#include "NR_BSR-Config.h"
+#include "NR_PDSCH-ServingCellConfig.h"
+#include "NR_RLC-BearerConfig.h"
+#include "BOOLEAN.h"
+#include "assertions.h"
+#include "common/utils/nr/nr_common.h"
+#include "SIMULATION/TOOLS/sim.h"
+#include "executables/softmodem-common.h"
+
+#define false 0
+#define true 1
+
+
+void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellconfigcommon,
+				     NR_CellGroupConfig_t *secondaryCellGroup,
+				     int scg_id,
+				     int servCellIndex,
+				     int n_physical_antenna_ports,
+				     int initial_csi_index) {
+  AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n");
+  AssertFatal(secondaryCellGroup!=NULL,"secondaryCellGroup is null\n");
+
+  memset(secondaryCellGroup,0,sizeof(NR_CellGroupConfig_t));
+  secondaryCellGroup->cellGroupId = scg_id;
+
+  NR_RLC_BearerConfig_t *RLC_BearerConfig = calloc(1,sizeof(*RLC_BearerConfig));
+
+  RLC_BearerConfig->logicalChannelIdentity = 4;
+  RLC_BearerConfig->servedRadioBearer = calloc(1,sizeof(*RLC_BearerConfig->servedRadioBearer));
+  RLC_BearerConfig->servedRadioBearer->present = 	NR_RLC_BearerConfig__servedRadioBearer_PR_drb_Identity;
+
+  RLC_BearerConfig->servedRadioBearer->choice.drb_Identity=1;
+  RLC_BearerConfig->reestablishRLC=calloc(1,sizeof(*RLC_BearerConfig->reestablishRLC));
+  *RLC_BearerConfig->reestablishRLC=NR_RLC_BearerConfig__reestablishRLC_true;
+  RLC_BearerConfig->rlc_Config=calloc(1,sizeof(*RLC_BearerConfig->rlc_Config));
+  RLC_BearerConfig->rlc_Config->present = NR_RLC_Config_PR_am;
+  RLC_BearerConfig->rlc_Config->choice.am = calloc(1,sizeof(*RLC_BearerConfig->rlc_Config->choice.am));
+  RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength = calloc(1,sizeof(*RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength));
+  *RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.sn_FieldLength   =	NR_SN_FieldLengthAM_size18;
+  RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.t_PollRetransmit = NR_T_PollRetransmit_ms45;
+  RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.pollPDU          = NR_PollPDU_p64;
+  RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.pollByte         = NR_PollByte_kB500;
+  RLC_BearerConfig->rlc_Config->choice.am->ul_AM_RLC.maxRetxThreshold = NR_UL_AM_RLC__maxRetxThreshold_t32;
+
+  RLC_BearerConfig->rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength = calloc(1,sizeof(*RLC_BearerConfig->rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength));
+  *RLC_BearerConfig->rlc_Config->choice.am->dl_AM_RLC.sn_FieldLength = NR_SN_FieldLengthAM_size18;
+  RLC_BearerConfig->rlc_Config->choice.am->dl_AM_RLC.t_Reassembly   = NR_T_Reassembly_ms15;
+  RLC_BearerConfig->rlc_Config->choice.am->dl_AM_RLC.t_StatusProhibit = NR_T_StatusProhibit_ms15;
+
+  RLC_BearerConfig->mac_LogicalChannelConfig = calloc(1,sizeof(*RLC_BearerConfig->mac_LogicalChannelConfig));
+  RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters = calloc(1,sizeof(*RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters));
+  RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->priority            = 1;
+  RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->prioritisedBitRate  = NR_LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity;
+  RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->bucketSizeDuration  = NR_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
+  RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->allowedServingCells = NULL;
+  RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->allowedSCS_List     = NULL;
+  RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->maxPUSCH_Duration   = NULL;
+  RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->configuredGrantType1Allowed = NULL;
+  RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->logicalChannelGroup   = calloc(1,sizeof(*RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->logicalChannelGroup));
+  *RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->logicalChannelGroup  = 1;
+  RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->schedulingRequestID   = NULL;
+  RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->logicalChannelSR_Mask = false;
+  RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->logicalChannelSR_DelayTimerApplied = false;
+  RLC_BearerConfig->mac_LogicalChannelConfig->ul_SpecificParameters->bitRateQueryProhibitTimer   = NULL;
+
+  secondaryCellGroup->rlc_BearerToAddModList = calloc(1,sizeof(*secondaryCellGroup->rlc_BearerToAddModList));
+  ASN_SEQUENCE_ADD(&secondaryCellGroup->rlc_BearerToAddModList->list, RLC_BearerConfig);
+
+  secondaryCellGroup->mac_CellGroupConfig=calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig));
+  secondaryCellGroup->mac_CellGroupConfig->drx_Config = NULL;
+  secondaryCellGroup->mac_CellGroupConfig->schedulingRequestConfig = NULL;
+  secondaryCellGroup->mac_CellGroupConfig->bsr_Config=calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->bsr_Config));
+  secondaryCellGroup->mac_CellGroupConfig->bsr_Config->periodicBSR_Timer = NR_BSR_Config__periodicBSR_Timer_sf80;
+  secondaryCellGroup->mac_CellGroupConfig->bsr_Config->retxBSR_Timer     = NR_BSR_Config__retxBSR_Timer_sf320;
+  secondaryCellGroup->mac_CellGroupConfig->tag_Config=calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->tag_Config));
+  secondaryCellGroup->mac_CellGroupConfig->tag_Config->tag_ToReleaseList = NULL;
+  secondaryCellGroup->mac_CellGroupConfig->tag_Config->tag_ToAddModList  = calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->tag_Config->tag_ToAddModList));
+  struct NR_TAG *tag=calloc(1,sizeof(*tag));
+  tag->tag_Id             = 0;
+  tag->timeAlignmentTimer = NR_TimeAlignmentTimer_infinity;
+  ASN_SEQUENCE_ADD(&secondaryCellGroup->mac_CellGroupConfig->tag_Config->tag_ToAddModList->list,tag);
+  secondaryCellGroup->mac_CellGroupConfig->phr_Config  = calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->phr_Config));
+  secondaryCellGroup->mac_CellGroupConfig->phr_Config->present = NR_SetupRelease_PHR_Config_PR_setup;
+  secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup  = calloc(1,sizeof(*secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup));
+  secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->phr_PeriodicTimer = NR_PHR_Config__phr_PeriodicTimer_sf20;
+  secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->phr_ProhibitTimer = NR_PHR_Config__phr_ProhibitTimer_sf0;
+  secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->phr_Tx_PowerFactorChange = NR_PHR_Config__phr_Tx_PowerFactorChange_dB3;
+  secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->multiplePHR=false;
+  secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->dummy=false;
+  secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->phr_Type2OtherCell = false;
+  secondaryCellGroup->mac_CellGroupConfig->phr_Config->choice.setup->phr_ModeOtherCG = NR_PHR_Config__phr_ModeOtherCG_real;
+
+  secondaryCellGroup->mac_CellGroupConfig->skipUplinkTxDynamic=false;
+  secondaryCellGroup->mac_CellGroupConfig->ext1 = NULL;
+
+
+  secondaryCellGroup->physicalCellGroupConfig = calloc(1,sizeof(*secondaryCellGroup->physicalCellGroupConfig));
+
+  secondaryCellGroup->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUCCH=NULL;
+  secondaryCellGroup->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUSCH=NULL;
+  secondaryCellGroup->physicalCellGroupConfig->p_NR_FR1=calloc(1,sizeof(*secondaryCellGroup->physicalCellGroupConfig->p_NR_FR1));
+  *secondaryCellGroup->physicalCellGroupConfig->p_NR_FR1=20;
+  secondaryCellGroup->physicalCellGroupConfig->pdsch_HARQ_ACK_Codebook=NR_PhysicalCellGroupConfig__pdsch_HARQ_ACK_Codebook_dynamic;  
+  secondaryCellGroup->physicalCellGroupConfig->tpc_SRS_RNTI=NULL;
+  secondaryCellGroup->physicalCellGroupConfig->tpc_PUCCH_RNTI=NULL;
+  secondaryCellGroup->physicalCellGroupConfig->tpc_PUSCH_RNTI=NULL;
+  secondaryCellGroup->physicalCellGroupConfig->sp_CSI_RNTI=NULL;
+  secondaryCellGroup->physicalCellGroupConfig->cs_RNTI=NULL;
+  secondaryCellGroup->physicalCellGroupConfig->ext1=NULL;
+
+  secondaryCellGroup->spCellConfig = calloc(1,sizeof(*secondaryCellGroup->spCellConfig));
+  secondaryCellGroup->spCellConfig->servCellIndex = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->servCellIndex));
+  *secondaryCellGroup->spCellConfig->servCellIndex = servCellIndex;
+  secondaryCellGroup->spCellConfig->reconfigurationWithSync=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->reconfigurationWithSync));
+  secondaryCellGroup->spCellConfig->reconfigurationWithSync->spCellConfigCommon=servingcellconfigcommon;
+  secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity=(get_softmodem_params()->phy_test==1) ? 0x1234 : (taus()&0xffff);
+  secondaryCellGroup->spCellConfig->reconfigurationWithSync->t304=NR_ReconfigurationWithSync__t304_ms2000;
+  secondaryCellGroup->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated = NULL;
+  secondaryCellGroup->spCellConfig->reconfigurationWithSync->ext1                 = NULL;
+
+  secondaryCellGroup->spCellConfig->rlf_TimersAndConstants = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->rlf_TimersAndConstants));
+  secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->present = NR_SetupRelease_RLF_TimersAndConstants_PR_setup;
+  secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup));
+  secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->t310 = NR_RLF_TimersAndConstants__t310_ms2000;
+  secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->n310 = NR_RLF_TimersAndConstants__n310_n10;
+  secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->n311 = NR_RLF_TimersAndConstants__n311_n1;
+  secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1 = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1));
+  secondaryCellGroup->spCellConfig->rlf_TimersAndConstants->choice.setup->ext1->t311_v1530 = NR_RLF_TimersAndConstants__ext1__t311_v1530_ms30000;
+
+  secondaryCellGroup->spCellConfig->rlmInSyncOutOfSyncThreshold                   = NULL;
+ 
+
+
+  secondaryCellGroup->spCellConfig->spCellConfigDedicated = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated));
+  secondaryCellGroup->spCellConfig->spCellConfigDedicated->tdd_UL_DL_ConfigurationDedicated = NULL;
+  secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP));
+
+  secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdcch_Config=NULL;
+  secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config));
+  secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->present = NR_SetupRelease_PDSCH_Config_PR_setup;
+  secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup));
+  secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dataScramblingIdentityPDSCH = NULL;
+  secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA));
+  secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->present= NR_SetupRelease_DMRS_DownlinkConfig_PR_setup;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup));
+
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type=NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->maxLength=NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID0=NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID1=NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS=NULL;
+
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition));
+ *secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0;
+
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList));
+
+ NR_TCI_State_t*tci0=calloc(1,sizeof(*tci0));
+ tci0->tci_StateId=0;
+ tci0->qcl_Type1.cell=NULL;
+ tci0->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci0->qcl_Type1.bwp_Id));
+ *tci0->qcl_Type1.bwp_Id=1;
+ tci0->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs;
+ tci0->qcl_Type1.referenceSignal.choice.csi_rs = 2;
+ tci0->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA;
+ ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci0);
+
+ NR_TCI_State_t*tci1=calloc(1,sizeof(*tci1));
+ tci1->tci_StateId=1;
+ tci1->qcl_Type1.cell=NULL;
+ tci1->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci1->qcl_Type1.bwp_Id));
+ *tci1->qcl_Type1.bwp_Id=1;
+ tci1->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs;
+ tci1->qcl_Type1.referenceSignal.choice.csi_rs = 6;
+ tci1->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA;
+ ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci1);
+
+ NR_TCI_State_t*tci2=calloc(1,sizeof(*tci2));
+ tci2->tci_StateId=2;
+ tci2->qcl_Type1.cell=NULL;
+ tci2->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci2->qcl_Type1.bwp_Id));
+ *tci2->qcl_Type1.bwp_Id=1;
+ tci2->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs;
+ tci2->qcl_Type1.referenceSignal.choice.csi_rs = 10;
+ tci2->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA;
+ ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci2);
+
+ NR_TCI_State_t *tci3=calloc(1,sizeof(*tci3));
+ tci3->tci_StateId=3;
+ tci3->qcl_Type1.cell=NULL;
+ tci3->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci3->qcl_Type1.bwp_Id));
+ *tci3->qcl_Type1.bwp_Id=1;
+ tci3->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs;
+ tci3->qcl_Type1.referenceSignal.choice.csi_rs = 14;
+ tci3->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA;
+ ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci3);
+
+ NR_TCI_State_t*tci4=calloc(1,sizeof(*tci4));
+ tci4->tci_StateId=4;
+ tci4->qcl_Type1.cell=NULL;
+ tci4->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci4->qcl_Type1.bwp_Id));
+ *tci4->qcl_Type1.bwp_Id=1;
+ tci4->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs;
+ tci4->qcl_Type1.referenceSignal.choice.csi_rs = 18;
+ tci4->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA;
+ ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci4);
+
+ NR_TCI_State_t*tci5=calloc(1,sizeof(*tci5));
+ tci5->tci_StateId=5;
+ tci5->qcl_Type1.cell=NULL;
+ tci5->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci5->qcl_Type1.bwp_Id));
+ *tci5->qcl_Type1.bwp_Id=1;
+ tci5->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs;
+ tci5->qcl_Type1.referenceSignal.choice.csi_rs = 22;
+ tci5->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA;
+ ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci5);
+
+ NR_TCI_State_t*tci6=calloc(1,sizeof(*tci6));
+ tci6->tci_StateId=6;
+ tci6->qcl_Type1.cell=NULL;
+ tci6->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci6->qcl_Type1.bwp_Id));
+ *tci6->qcl_Type1.bwp_Id=1;
+ tci6->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs;
+ tci6->qcl_Type1.referenceSignal.choice.csi_rs = 26;
+ tci6->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA;
+ ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci6);
+
+ NR_TCI_State_t*tci7=calloc(1,sizeof(*tci7));
+ tci7->tci_StateId=7;
+ tci7->qcl_Type1.cell=NULL;
+ tci7->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci7->qcl_Type1.bwp_Id));
+ *tci7->qcl_Type1.bwp_Id=1;
+ tci7->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs;
+ tci7->qcl_Type1.referenceSignal.choice.csi_rs = 30;
+ tci7->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA;
+ ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci7);
+
+ NR_TCI_State_t*tci8=calloc(1,sizeof(*tci8));
+ tci8->tci_StateId=8;
+ tci8->qcl_Type1.cell=NULL;
+ tci8->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci8->qcl_Type1.bwp_Id));
+ *tci8->qcl_Type1.bwp_Id=1;
+ tci8->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_ssb;
+ tci8->qcl_Type1.referenceSignal.choice.ssb = 0;
+ tci8->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeC;
+ ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci8);
+
+ NR_TCI_State_t*tci9=calloc(1,sizeof(*tci9));
+ tci9->tci_StateId=9;
+ tci9->qcl_Type1.cell=NULL;
+ tci9->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci9->qcl_Type1.bwp_Id));
+ *tci9->qcl_Type1.bwp_Id=1;
+ tci9->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_ssb;
+ tci9->qcl_Type1.referenceSignal.choice.ssb = 1;
+ tci9->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeC;
+ ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci9);
+
+ NR_TCI_State_t*tci10=calloc(1,sizeof(*tci10));
+ tci10->tci_StateId=10;
+ tci10->qcl_Type1.cell=NULL;
+ tci10->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci10->qcl_Type1.bwp_Id));
+ *tci10->qcl_Type1.bwp_Id=1;
+ tci10->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_ssb;
+ tci10->qcl_Type1.referenceSignal.choice.ssb = 2;
+ tci10->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeC;
+ ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci10);
+
+ NR_TCI_State_t*tci11=calloc(1,sizeof(*tci11));
+ tci11->tci_StateId=11;
+ tci11->qcl_Type1.cell=NULL;
+ tci11->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci11->qcl_Type1.bwp_Id));
+ *tci11->qcl_Type1.bwp_Id=1;
+ tci11->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_ssb;
+ tci11->qcl_Type1.referenceSignal.choice.ssb = 3;
+ tci11->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeC;
+ ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci11);
+
+ NR_TCI_State_t*tci12=calloc(1,sizeof(*tci12));
+ tci12->tci_StateId=12;
+ tci12->qcl_Type1.cell=NULL;
+ tci12->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci12->qcl_Type1.bwp_Id));
+ *tci12->qcl_Type1.bwp_Id=1;
+ tci12->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_ssb;
+ tci12->qcl_Type1.referenceSignal.choice.ssb = 4;
+ tci12->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeC;
+ ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci12);
+
+ NR_TCI_State_t*tci13=calloc(1,sizeof(*tci13));
+ tci13->tci_StateId=13;
+ tci13->qcl_Type1.cell=NULL;
+ tci13->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci13->qcl_Type1.bwp_Id));
+ *tci13->qcl_Type1.bwp_Id=1;
+ tci13->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_ssb;
+ tci13->qcl_Type1.referenceSignal.choice.ssb = 5;
+ tci13->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeC;
+ ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci13);
+
+ NR_TCI_State_t*tci14=calloc(1,sizeof(*tci14));
+ tci14->tci_StateId=14;
+ tci14->qcl_Type1.cell=NULL;
+ tci14->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci14->qcl_Type1.bwp_Id));
+ *tci14->qcl_Type1.bwp_Id=1;
+ tci14->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_ssb;
+ tci14->qcl_Type1.referenceSignal.choice.ssb = 6;
+ tci14->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeC;
+ ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci14);
+
+ NR_TCI_State_t*tci15=calloc(1,sizeof(*tci15));
+ tci15->tci_StateId=15;
+ tci15->qcl_Type1.cell=NULL;
+ tci15->qcl_Type1.bwp_Id=calloc(1,sizeof(*tci15->qcl_Type1.bwp_Id));
+ *tci15->qcl_Type1.bwp_Id=1;
+ tci15->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_ssb;
+ tci15->qcl_Type1.referenceSignal.choice.ssb = 7;
+ tci15->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeC;
+ ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tci15);
+
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToReleaseList=NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->vrb_ToPRB_Interleaver=NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->resourceAllocation=NR_PDSCH_Config__resourceAllocation_resourceAllocationType0;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList=NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->pdsch_AggregationFactor=NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rateMatchPatternToAddModList=NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rateMatchPatternToReleaseList=NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rateMatchPatternGroup1=NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rateMatchPatternGroup2=NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->rbg_Size=NR_PDSCH_Config__rbg_Size_config1;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->mcs_Table=NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI));
+ *secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = NR_PDSCH_Config__maxNrofCodeWordsScheduledByDCI_n1;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->prb_BundlingType.present = NR_PDSCH_Config__prb_BundlingType_PR_staticBundling;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling));
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize =
+   calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize));
+ *secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize = NR_PDSCH_Config__prb_BundlingType__staticBundling__bundleSize_wideband;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->zp_CSI_RS_ResourceToAddModList=NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->zp_CSI_RS_ResourceToReleaseList=NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->aperiodic_ZP_CSI_RS_ResourceSetsToAddModList=NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->aperiodic_ZP_CSI_RS_ResourceSetsToReleaseList=NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->sp_ZP_CSI_RS_ResourceSetsToAddModList=NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->sp_ZP_CSI_RS_ResourceSetsToReleaseList=NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->p_ZP_CSI_RS_ResourceSet=NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->sps_Config = NULL; //calloc(1,sizeof(struct NR_SetupRelease_SPS_Config));
+
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig));
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->present = NR_SetupRelease_RadioLinkMonitoringConfig_PR_setup;
+
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup));
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup->failureDetectionResourcesToAddModList=NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup->failureDetectionResourcesToReleaseList=NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup->beamFailureInstanceMaxCount = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup->beamFailureInstanceMaxCount));
+ *secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup->beamFailureInstanceMaxCount = NR_RadioLinkMonitoringConfig__beamFailureInstanceMaxCount_n3;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup->beamFailureDetectionTimer = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup->beamFailureDetectionTimer));
+ *secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->radioLinkMonitoringConfig->choice.setup->beamFailureDetectionTimer = NR_RadioLinkMonitoringConfig__beamFailureDetectionTimer_pbfd2;
+
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToReleaseList= NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList));
+
+ NR_BWP_Downlink_t *bwp=calloc(1,sizeof(*bwp));
+ bwp->bwp_Id=1;
+ bwp->bwp_Common=calloc(1,sizeof(*bwp->bwp_Common));
+ // copy common BWP size from initial BWP except for bandwdith
+ memcpy((void*)&bwp->bwp_Common->genericParameters,
+	&servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->genericParameters,
+	sizeof(bwp->bwp_Common->genericParameters));
+ bwp->bwp_Common->genericParameters.locationAndBandwidth=PRBalloc_to_locationandbandwidth(servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,0);
+
+ 
+ bwp->bwp_Common->pdcch_ConfigCommon=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon));
+ bwp->bwp_Common->pdcch_ConfigCommon->present = NR_SetupRelease_PDCCH_ConfigCommon_PR_setup;
+ bwp->bwp_Common->pdcch_ConfigCommon->choice.setup = calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup));
+ bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->controlResourceSetZero=NULL;
+ bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonControlResourceSet=NULL;
+ bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceZero=NULL;
+
+ bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList=NULL;
+ 
+ bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList));
+
+ NR_SearchSpace_t *ss=calloc(1,sizeof(*ss));
+ ss->searchSpaceId = 1;
+ ss->controlResourceSetId=calloc(1,sizeof(*ss->controlResourceSetId));
+ *ss->controlResourceSetId=0;
+ ss->monitoringSlotPeriodicityAndOffset = calloc(1,sizeof(*ss->monitoringSlotPeriodicityAndOffset));
+ ss->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
+ ss->duration=NULL; 
+ ss->monitoringSymbolsWithinSlot = calloc(1,sizeof(*ss->monitoringSymbolsWithinSlot));
+ ss->monitoringSymbolsWithinSlot->buf = calloc(1,2);
+ // should be '1100 0000 0000 00'B (LSB first!), first two symols in slot, adjust if needed
+ ss->monitoringSymbolsWithinSlot->buf[1] = 0;
+ ss->monitoringSymbolsWithinSlot->buf[0] = (1<<7) | (1<<6);
+ ss->monitoringSymbolsWithinSlot->size = 2;
+ ss->monitoringSymbolsWithinSlot->bits_unused = 2;
+ ss->nrofCandidates = calloc(1,sizeof(*ss->nrofCandidates));
+ ss->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0;
+ ss->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0;
+ ss->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n1;
+ ss->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0;
+ ss->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0;
+ ss->searchSpaceType = calloc(1,sizeof(*ss->searchSpaceType));
+ ss->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common;
+ ss->searchSpaceType->choice.common=calloc(1,sizeof(*ss->searchSpaceType->choice.common));
+ ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0));
+
+ ASN_SEQUENCE_ADD(&bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,ss);
+ 
+
+ bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=NULL;
+ bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation=NULL;
+ bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->pagingSearchSpace=NULL;
+ bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace=calloc(1,sizeof(*bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace));
+ *bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace=1;
+ bwp->bwp_Common->pdcch_ConfigCommon->choice.setup->ext1=NULL;
+
+ bwp->bwp_Common->pdsch_ConfigCommon=calloc(1,sizeof(*bwp->bwp_Common->pdsch_ConfigCommon));
+ bwp->bwp_Common->pdsch_ConfigCommon->present = NR_SetupRelease_PDSCH_ConfigCommon_PR_setup;
+ bwp->bwp_Common->pdsch_ConfigCommon->choice.setup = calloc(1,sizeof(*bwp->bwp_Common->pdsch_ConfigCommon->choice.setup));
+ bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList = calloc(1,sizeof(*bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList));
+
+ // copy PDSCH TimeDomainResourceAllocation from InitialBWP
+ 
+ NR_PDSCH_TimeDomainResourceAllocation_t *pdschi;
+ for (int i=0;i<servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.count;i++) {
+   pdschi= calloc(1,sizeof(*pdschi));
+   AssertFatal(servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->k0!=NULL,"element %d is null\n",i);
+ 
+   pdschi->k0 = calloc(1,sizeof(*pdschi->k0));
+   *pdschi->k0 = *servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->k0;
+   pdschi->mappingType = servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->mappingType;
+   pdschi->startSymbolAndLength = servingcellconfigcommon->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[i]->startSymbolAndLength;
+   ASN_SEQUENCE_ADD(&bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list,pdschi);
+ }
+
+ bwp->bwp_Dedicated=calloc(1,sizeof(*bwp->bwp_Dedicated));
+
+ bwp->bwp_Dedicated->pdcch_Config=calloc(1,sizeof(*bwp->bwp_Dedicated->pdcch_Config));
+ bwp->bwp_Dedicated->pdcch_Config->present = NR_SetupRelease_PDCCH_Config_PR_setup;
+ bwp->bwp_Dedicated->pdcch_Config->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdcch_Config->choice.setup));
+ bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList = calloc(1,sizeof(*bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList));
+ NR_ControlResourceSet_t *coreset0 = calloc(1,sizeof(*coreset0));
+ coreset0->controlResourceSetId=1; 
+ // frequencyDomainResources '11111111 11111111 00000000 00000000 00000000 00000'B,
+ coreset0->frequencyDomainResources.buf = calloc(1,6);
+ coreset0->frequencyDomainResources.buf[0] = 0xff;
+ coreset0->frequencyDomainResources.buf[1] = 0xff;
+ coreset0->frequencyDomainResources.buf[2] = 0;
+ coreset0->frequencyDomainResources.buf[3] = 0;
+ coreset0->frequencyDomainResources.buf[4] = 0;
+ coreset0->frequencyDomainResources.buf[5] = 0;
+ coreset0->frequencyDomainResources.size = 6;
+ coreset0->frequencyDomainResources.bits_unused = 3;
+ coreset0->duration=1;
+ coreset0->cce_REG_MappingType.present = NR_ControlResourceSet__cce_REG_MappingType_PR_nonInterleaved;
+ coreset0->precoderGranularity = NR_ControlResourceSet__precoderGranularity_sameAsREG_bundle;
+
+ coreset0->tci_StatesPDCCH_ToAddList=calloc(1,sizeof(*coreset0->tci_StatesPDCCH_ToAddList));
+ NR_TCI_StateId_t *tci[8];
+ for (int i=0;i<8;i++) {
+   tci[i]=calloc(1,sizeof(*tci[i]));
+   *tci[i] = i;
+   ASN_SEQUENCE_ADD(&coreset0->tci_StatesPDCCH_ToAddList->list,tci[i]);
+ }
+ coreset0->tci_StatesPDCCH_ToReleaseList = NULL;
+ coreset0->tci_PresentInDCI = NULL;
+ coreset0->pdcch_DMRS_ScramblingID = NULL;
+ ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdcch_Config->choice.setup->controlResourceSetToAddModList->list,
+		  coreset0);
+
+ bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList = calloc(1,sizeof(*bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList));
+ NR_SearchSpace_t *ss3 = calloc(1,sizeof(*ss3));
+ NR_SearchSpace_t *ss2 = calloc(1,sizeof(*ss2));
+ ss3->searchSpaceId=3;
+ ss3->controlResourceSetId=calloc(1,sizeof(*ss3->controlResourceSetId));
+ *ss3->controlResourceSetId=1;
+ ss3->monitoringSlotPeriodicityAndOffset=calloc(1,sizeof(*ss3->monitoringSlotPeriodicityAndOffset));
+ ss3->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
+ ss3->monitoringSlotPeriodicityAndOffset->choice.sl1=(NULL_t)0;
+ ss3->duration=NULL;
+ ss3->monitoringSymbolsWithinSlot = calloc(1,sizeof(*ss3->monitoringSymbolsWithinSlot));
+ ss3->monitoringSymbolsWithinSlot->buf = calloc(1,2);
+ ss3->monitoringSymbolsWithinSlot->size = 2;
+ ss3->monitoringSymbolsWithinSlot->bits_unused = 2;
+ ss3->monitoringSymbolsWithinSlot->buf[0]=0xc0;
+ ss3->monitoringSymbolsWithinSlot->buf[1]=0x0;
+ ss3->nrofCandidates=calloc(1,sizeof(*ss3->nrofCandidates));
+ ss3->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0;
+ ss3->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0;
+ ss3->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n1;
+ ss3->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0;
+ ss3->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0;
+ ss3->searchSpaceType=calloc(1,sizeof(*ss3->searchSpaceType));
+ ss3->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common;
+ ss3->searchSpaceType->choice.common = calloc(1,sizeof(*ss3->searchSpaceType->choice.common));
+ ss3->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0=calloc(1,sizeof(*ss3->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0));
+ ss3->searchSpaceType->choice.common->dci_Format2_0=NULL;
+ ss3->searchSpaceType->choice.common->dci_Format2_2=NULL;
+ ss3->searchSpaceType->choice.common->dci_Format2_3=NULL;
+
+ ss2->searchSpaceId=2;
+ ss2->controlResourceSetId=calloc(1,sizeof(*ss2->controlResourceSetId));
+ *ss2->controlResourceSetId=1;
+ ss2->monitoringSlotPeriodicityAndOffset=calloc(1,sizeof(*ss2->monitoringSlotPeriodicityAndOffset));
+ ss2->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1;
+ ss2->monitoringSlotPeriodicityAndOffset->choice.sl1=(NULL_t)0;
+ ss2->duration=NULL;
+ ss2->monitoringSymbolsWithinSlot = calloc(1,sizeof(*ss2->monitoringSymbolsWithinSlot));
+ ss2->monitoringSymbolsWithinSlot->buf = calloc(1,2);
+ ss2->monitoringSymbolsWithinSlot->size = 2;
+ ss2->monitoringSymbolsWithinSlot->bits_unused = 2;
+ ss2->monitoringSymbolsWithinSlot->buf[0]=0xc0;
+ ss2->monitoringSymbolsWithinSlot->buf[1]=0x0;
+ ss2->nrofCandidates=calloc(1,sizeof(*ss2->nrofCandidates));
+ ss2->nrofCandidates->aggregationLevel1 = NR_SearchSpace__nrofCandidates__aggregationLevel1_n0;
+ ss2->nrofCandidates->aggregationLevel2 = NR_SearchSpace__nrofCandidates__aggregationLevel2_n0;
+ ss2->nrofCandidates->aggregationLevel4 = NR_SearchSpace__nrofCandidates__aggregationLevel4_n4;
+ ss2->nrofCandidates->aggregationLevel8 = NR_SearchSpace__nrofCandidates__aggregationLevel8_n0;
+ ss2->nrofCandidates->aggregationLevel16 = NR_SearchSpace__nrofCandidates__aggregationLevel16_n0;
+ ss2->searchSpaceType=calloc(1,sizeof(*ss2->searchSpaceType));
+ ss2->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_ue_Specific;
+ ss2->searchSpaceType->choice.ue_Specific = calloc(1,sizeof(*ss2->searchSpaceType->choice.ue_Specific));
+ ss2->searchSpaceType->choice.ue_Specific->dci_Formats=NR_SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_0_And_1_0;
+
+ ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list,
+		  ss3);
+ ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list,
+		  ss2);
+
+
+ bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToReleaseList = NULL;
+
+ bwp->bwp_Dedicated->pdsch_Config = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config));
+
+  bwp->bwp_Dedicated->pdsch_Config->present = NR_SetupRelease_PDSCH_Config_PR_setup;
+  bwp->bwp_Dedicated->pdsch_Config->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup));
+  bwp->bwp_Dedicated->pdsch_Config->choice.setup->dataScramblingIdentityPDSCH = NULL;
+  bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA));
+  bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->present= NR_SetupRelease_DMRS_DownlinkConfig_PR_setup;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup));
+
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->maxLength=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID0=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->scramblingID1=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS=NULL;
+
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition));
+ *bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0;
+
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList=calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList));
+
+ NR_TCI_State_t*tcid0=calloc(1,sizeof(*tcid0));
+ tcid0->tci_StateId=0;
+ tcid0->qcl_Type1.cell=NULL;
+ tcid0->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid0->qcl_Type1.bwp_Id));
+ *tcid0->qcl_Type1.bwp_Id=1;
+ tcid0->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs;
+ tcid0->qcl_Type1.referenceSignal.choice.csi_rs = 2;
+ tcid0->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA;
+ ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid0);
+
+ NR_TCI_State_t*tcid1=calloc(1,sizeof(*tcid1));
+ tcid1->tci_StateId=0;
+ tcid1->qcl_Type1.cell=NULL;
+ tcid1->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid1->qcl_Type1.bwp_Id));
+ *tcid1->qcl_Type1.bwp_Id=1;
+ tcid1->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs;
+ tcid1->qcl_Type1.referenceSignal.choice.csi_rs = 6;
+ tcid1->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA;
+ ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid1);
+
+ NR_TCI_State_t*tcid2=calloc(1,sizeof(*tcid2));
+ tcid2->tci_StateId=2;
+ tcid2->qcl_Type1.cell=NULL;
+ tcid2->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid2->qcl_Type1.bwp_Id));
+ *tcid2->qcl_Type1.bwp_Id=1;
+ tcid2->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs;
+ tcid2->qcl_Type1.referenceSignal.choice.csi_rs = 10;
+ tcid2->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA;
+ ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid2);
+
+ NR_TCI_State_t*tcid3=calloc(1,sizeof(*tcid3));
+ tcid3->tci_StateId=3;
+ tcid3->qcl_Type1.cell=NULL;
+ tcid3->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid3->qcl_Type1.bwp_Id));
+ *tcid3->qcl_Type1.bwp_Id=1;
+ tcid3->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs;
+ tcid3->qcl_Type1.referenceSignal.choice.csi_rs = 14;
+ tcid3->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA;
+ ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid3);
+
+ NR_TCI_State_t*tcid4=calloc(1,sizeof(*tcid4));
+ tcid4->tci_StateId=4;
+ tcid4->qcl_Type1.cell=NULL;
+ tcid4->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid4->qcl_Type1.bwp_Id));
+ *tcid4->qcl_Type1.bwp_Id=1;
+ tcid4->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs;
+ tcid4->qcl_Type1.referenceSignal.choice.csi_rs = 18;
+ tcid4->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA;
+ ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid4);
+
+ NR_TCI_State_t*tcid5=calloc(1,sizeof(*tcid5));
+ tcid5->tci_StateId=5;
+ tcid5->qcl_Type1.cell=NULL;
+ tcid5->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid5->qcl_Type1.bwp_Id));
+ *tcid5->qcl_Type1.bwp_Id=1;
+ tcid5->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs;
+ tcid5->qcl_Type1.referenceSignal.choice.csi_rs = 22;
+ tcid5->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA;
+ ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid5);
+
+ NR_TCI_State_t*tcid6=calloc(1,sizeof(*tcid6));
+ tcid6->tci_StateId=6;
+ tcid6->qcl_Type1.cell=NULL;
+ tcid6->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid6->qcl_Type1.bwp_Id));
+ *tcid6->qcl_Type1.bwp_Id=1;
+ tcid6->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs;
+ tcid6->qcl_Type1.referenceSignal.choice.csi_rs = 26;
+ tcid6->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA;
+ ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid6);
+
+ NR_TCI_State_t*tcid7=calloc(1,sizeof(*tcid7));
+ tcid7->tci_StateId=7;
+ tcid7->qcl_Type1.cell=NULL;
+ tcid7->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid7->qcl_Type1.bwp_Id));
+ *tcid7->qcl_Type1.bwp_Id=1;
+ tcid7->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_csi_rs;
+ tcid7->qcl_Type1.referenceSignal.choice.csi_rs = 30;
+ tcid7->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeA;
+ ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid7);
+
+ NR_TCI_State_t*tcid8=calloc(1,sizeof(*tcid8));
+ tcid8->tci_StateId=8;
+ tcid8->qcl_Type1.cell=NULL;
+ tcid8->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid8->qcl_Type1.bwp_Id));
+ *tcid8->qcl_Type1.bwp_Id=1;
+ tcid8->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_ssb;
+ tcid8->qcl_Type1.referenceSignal.choice.ssb = 0;
+ tcid8->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeC;
+ ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid8);
+
+ NR_TCI_State_t*tcid9=calloc(1,sizeof(*tcid9));
+ tcid9->tci_StateId=9;
+ tcid9->qcl_Type1.cell=NULL;
+ tcid9->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid9->qcl_Type1.bwp_Id));
+ *tcid9->qcl_Type1.bwp_Id=1;
+ tcid9->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_ssb;
+ tcid9->qcl_Type1.referenceSignal.choice.ssb = 1;
+ tcid9->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeC;
+ ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid9);
+
+ NR_TCI_State_t*tcid10=calloc(1,sizeof(*tcid10));
+ tcid10->tci_StateId=10;
+ tcid10->qcl_Type1.cell=NULL;
+ tcid10->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid10->qcl_Type1.bwp_Id));
+ *tcid10->qcl_Type1.bwp_Id=1;
+ tcid10->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_ssb;
+ tcid10->qcl_Type1.referenceSignal.choice.ssb = 2;
+ tcid10->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeC;
+ ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid10);
+
+ NR_TCI_State_t*tcid11=calloc(1,sizeof(*tcid11));
+ tcid11->tci_StateId=11;
+ tcid11->qcl_Type1.cell=NULL;
+ tcid11->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid11->qcl_Type1.bwp_Id));
+ *tcid11->qcl_Type1.bwp_Id=1;
+ tcid11->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_ssb;
+ tcid11->qcl_Type1.referenceSignal.choice.ssb = 3;
+ tcid11->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeC;
+ ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid11);
+
+ NR_TCI_State_t*tcid12=calloc(1,sizeof(*tcid12));
+ tcid12->tci_StateId=12;
+ tcid12->qcl_Type1.cell=NULL;
+ tcid12->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid12->qcl_Type1.bwp_Id));
+ *tcid12->qcl_Type1.bwp_Id=1;
+ tcid12->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_ssb;
+ tcid12->qcl_Type1.referenceSignal.choice.ssb = 4;
+ tcid12->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeC;
+ ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid12);
+
+ NR_TCI_State_t*tcid13=calloc(1,sizeof(*tcid13));
+ tcid13->tci_StateId=13;
+ tcid13->qcl_Type1.cell=NULL;
+ tcid13->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid13->qcl_Type1.bwp_Id));
+ *tcid13->qcl_Type1.bwp_Id=1;
+ tcid13->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_ssb;
+ tcid13->qcl_Type1.referenceSignal.choice.ssb = 5;
+ tcid13->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeC;
+ ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid13);
+
+ NR_TCI_State_t*tcid14=calloc(1,sizeof(*tcid14));
+ tcid14->tci_StateId=14;
+ tcid14->qcl_Type1.cell=NULL;
+ tcid14->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid14->qcl_Type1.bwp_Id));
+ *tcid14->qcl_Type1.bwp_Id=1;
+ tcid14->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_ssb;
+ tcid14->qcl_Type1.referenceSignal.choice.ssb = 6;
+ tcid14->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeC;
+ ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid14);
+
+ NR_TCI_State_t*tcid15=calloc(1,sizeof(*tcid15));
+ tcid15->tci_StateId=15;
+ tcid15->qcl_Type1.cell=NULL;
+ tcid15->qcl_Type1.bwp_Id=calloc(1,sizeof(*tcid15->qcl_Type1.bwp_Id));
+ *tcid15->qcl_Type1.bwp_Id=1;
+ tcid15->qcl_Type1.referenceSignal.present = NR_QCL_Info__referenceSignal_PR_ssb;
+ tcid15->qcl_Type1.referenceSignal.choice.ssb = 7;
+ tcid15->qcl_Type1.qcl_Type=NR_QCL_Info__qcl_Type_typeC;
+ ASN_SEQUENCE_ADD(&bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList->list,tcid15);
+
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToReleaseList=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->vrb_ToPRB_Interleaver=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->resourceAllocation=NR_PDSCH_Config__resourceAllocation_resourceAllocationType0;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_AggregationFactor=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternToAddModList=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternToReleaseList=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternGroup1=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternGroup2=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->rbg_Size=NR_PDSCH_Config__rbg_Size_config1;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI));
+ *bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = NR_PDSCH_Config__maxNrofCodeWordsScheduledByDCI_n1;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.present = NR_PDSCH_Config__prb_BundlingType_PR_staticBundling;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling));
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize =
+   calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize));
+ *bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize = NR_PDSCH_Config__prb_BundlingType__staticBundling__bundleSize_wideband;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->zp_CSI_RS_ResourceToAddModList=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->zp_CSI_RS_ResourceToReleaseList=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->aperiodic_ZP_CSI_RS_ResourceSetsToAddModList=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->aperiodic_ZP_CSI_RS_ResourceSetsToReleaseList=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->sp_ZP_CSI_RS_ResourceSetsToAddModList=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->sp_ZP_CSI_RS_ResourceSetsToReleaseList=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->p_ZP_CSI_RS_ResourceSet=NULL;
+
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToReleaseList=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->vrb_ToPRB_Interleaver=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->resourceAllocation=NR_PDSCH_Config__resourceAllocation_resourceAllocationType0;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_TimeDomainAllocationList=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->pdsch_AggregationFactor=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternToAddModList=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternToReleaseList=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternGroup1=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->rateMatchPatternGroup2=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->rbg_Size=NR_PDSCH_Config__rbg_Size_config1;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI));
+ *bwp->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI = NR_PDSCH_Config__maxNrofCodeWordsScheduledByDCI_n1;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.present = NR_PDSCH_Config__prb_BundlingType_PR_staticBundling;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling));
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize =
+   calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize));
+ *bwp->bwp_Dedicated->pdsch_Config->choice.setup->prb_BundlingType.choice.staticBundling->bundleSize = NR_PDSCH_Config__prb_BundlingType__staticBundling__bundleSize_wideband;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->zp_CSI_RS_ResourceToAddModList=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->zp_CSI_RS_ResourceToReleaseList=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->aperiodic_ZP_CSI_RS_ResourceSetsToAddModList=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->aperiodic_ZP_CSI_RS_ResourceSetsToReleaseList=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->sp_ZP_CSI_RS_ResourceSetsToAddModList=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->sp_ZP_CSI_RS_ResourceSetsToReleaseList=NULL;
+ bwp->bwp_Dedicated->pdsch_Config->choice.setup->p_ZP_CSI_RS_ResourceSet=NULL;
+ bwp->bwp_Dedicated->sps_Config = NULL; //calloc(1,sizeof(struct NR_SetupRelease_SPS_Config));
+
+ bwp->bwp_Dedicated->radioLinkMonitoringConfig = calloc(1,sizeof(*bwp->bwp_Dedicated->radioLinkMonitoringConfig));
+ bwp->bwp_Dedicated->radioLinkMonitoringConfig->present = NR_SetupRelease_RadioLinkMonitoringConfig_PR_setup;
+
+ bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup = calloc(1,sizeof(*bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup));
+ bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->failureDetectionResourcesToAddModList=NULL;
+ bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->failureDetectionResourcesToReleaseList=NULL;
+ bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->beamFailureInstanceMaxCount = calloc(1,sizeof(*bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->beamFailureInstanceMaxCount));
+ *bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->beamFailureInstanceMaxCount = NR_RadioLinkMonitoringConfig__beamFailureInstanceMaxCount_n3;
+ bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->beamFailureDetectionTimer = calloc(1,sizeof(*bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->beamFailureDetectionTimer));
+ *bwp->bwp_Dedicated->radioLinkMonitoringConfig->choice.setup->beamFailureDetectionTimer = NR_RadioLinkMonitoringConfig__beamFailureDetectionTimer_pbfd2;
+ 
+ ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list,bwp);
+
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id));
+ 
+ *secondaryCellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id=1;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->bwp_InactivityTimer = NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->defaultDownlinkBWP_Id = NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig));
+
+ NR_BWP_UplinkDedicated_t *initialUplinkBWP = calloc(1,sizeof(*initialUplinkBWP));
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP = initialUplinkBWP;
+ initialUplinkBWP->pucch_Config = NULL;
+ initialUplinkBWP->pusch_Config = calloc(1,sizeof(*initialUplinkBWP->pusch_Config));
+ initialUplinkBWP->pusch_Config->present = NR_SetupRelease_PUSCH_Config_PR_setup;
+ NR_PUSCH_Config_t *pusch_Config = calloc(1,sizeof(*pusch_Config));
+ initialUplinkBWP->pusch_Config->choice.setup = pusch_Config;
+ pusch_Config->txConfig=calloc(1,sizeof(*pusch_Config->txConfig));
+ *pusch_Config->txConfig= NR_PUSCH_Config__txConfig_codebook;
+ pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA = NULL;
+ pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB = calloc(1,sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB));
+ pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->present = NR_SetupRelease_DMRS_UplinkConfig_PR_setup;
+ pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup = calloc(1,sizeof(*pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup));
+ NR_DMRS_UplinkConfig_t *NR_DMRS_UplinkConfig = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup;
+ NR_DMRS_UplinkConfig->dmrs_Type = NULL;
+ NR_DMRS_UplinkConfig->dmrs_AdditionalPosition =NR_DMRS_UplinkConfig__dmrs_AdditionalPosition_pos0;
+ NR_DMRS_UplinkConfig->phaseTrackingRS=NULL;
+ NR_DMRS_UplinkConfig->maxLength=NULL;
+ NR_DMRS_UplinkConfig->transformPrecodingDisabled = calloc(1,sizeof(*NR_DMRS_UplinkConfig->transformPrecodingDisabled));
+ NR_DMRS_UplinkConfig->transformPrecodingDisabled->scramblingID0 = NULL;
+ NR_DMRS_UplinkConfig->transformPrecodingDisabled->scramblingID1 = NULL;
+ NR_DMRS_UplinkConfig->transformPrecodingEnabled = NULL;
+ pusch_Config->pusch_PowerControl = calloc(1,sizeof(*pusch_Config->pusch_PowerControl));
+ pusch_Config->pusch_PowerControl->tpc_Accumulation = NULL;
+ pusch_Config->pusch_PowerControl->msg3_Alpha = calloc(1,sizeof(*pusch_Config->pusch_PowerControl->msg3_Alpha));
+ *pusch_Config->pusch_PowerControl->msg3_Alpha = NR_Alpha_alpha1;
+ pusch_Config->pusch_PowerControl->p0_NominalWithoutGrant = NULL;
+ pusch_Config->pusch_PowerControl->p0_AlphaSets = calloc(1,sizeof(*pusch_Config->pusch_PowerControl->p0_AlphaSets));
+ NR_P0_PUSCH_AlphaSet_t *aset = calloc(1,sizeof(*aset));
+ aset->p0_PUSCH_AlphaSetId=0;
+ aset->p0=calloc(1,sizeof(*aset->p0));
+ *aset->p0 = 0;
+ aset->alpha=calloc(1,sizeof(*aset->alpha));
+ *aset->alpha=NR_Alpha_alpha1;
+ ASN_SEQUENCE_ADD(&pusch_Config->pusch_PowerControl->p0_AlphaSets->list,aset);
+ pusch_Config->pusch_PowerControl->pathlossReferenceRSToAddModList = calloc(1,sizeof(*pusch_Config->pusch_PowerControl->pathlossReferenceRSToAddModList));
+ NR_PUSCH_PathlossReferenceRS_t *pl = calloc(1,sizeof(*pl));
+ pl->pusch_PathlossReferenceRS_Id=0;
+ pl->referenceSignal.present = NR_PUSCH_PathlossReferenceRS__referenceSignal_PR_csi_RS_Index;
+ pl->referenceSignal.choice.csi_RS_Index=0;
+ ASN_SEQUENCE_ADD(&pusch_Config->pusch_PowerControl->pathlossReferenceRSToAddModList->list,pl);
+ pusch_Config->pusch_PowerControl->pathlossReferenceRSToReleaseList = NULL;
+ pusch_Config->pusch_PowerControl->twoPUSCH_PC_AdjustmentStates = NULL;
+ pusch_Config->pusch_PowerControl->deltaMCS = NULL;
+ pusch_Config->pusch_PowerControl->sri_PUSCH_MappingToAddModList = NULL;
+ pusch_Config->pusch_PowerControl->sri_PUSCH_MappingToReleaseList = NULL;
+ pusch_Config->frequencyHopping=NULL;
+ pusch_Config->frequencyHoppingOffsetLists=NULL;
+ pusch_Config->resourceAllocation = NR_PUSCH_Config__resourceAllocation_resourceAllocationType1;
+ pusch_Config->pusch_TimeDomainAllocationList = NULL;
+ pusch_Config->pusch_AggregationFactor=NULL;
+ pusch_Config->mcs_Table=NULL;
+ pusch_Config->mcs_TableTransformPrecoder=NULL;
+ pusch_Config->transformPrecoder=calloc(1,sizeof(*pusch_Config->transformPrecoder));
+ *pusch_Config->transformPrecoder = NR_PUSCH_Config__transformPrecoder_disabled;
+ pusch_Config->codebookSubset=calloc(1,sizeof(*pusch_Config->codebookSubset));
+ *pusch_Config->codebookSubset = NR_PUSCH_Config__codebookSubset_nonCoherent;
+ pusch_Config->maxRank=calloc(1,sizeof(*pusch_Config->maxRank));
+ *pusch_Config->maxRank= 1;
+ pusch_Config->rbg_Size=NULL;
+ pusch_Config->uci_OnPUSCH=NULL;
+ pusch_Config->tp_pi2BPSK=NULL;
+
+ initialUplinkBWP->srs_Config = calloc(1,sizeof(*initialUplinkBWP->srs_Config));
+ initialUplinkBWP->srs_Config->present = NR_SetupRelease_SRS_Config_PR_setup;
+ NR_SRS_Config_t *srs_Config = calloc(1,sizeof(*srs_Config));
+ initialUplinkBWP->srs_Config->choice.setup=srs_Config;
+ srs_Config->srs_ResourceSetToReleaseList=NULL;
+ srs_Config->srs_ResourceSetToAddModList=calloc(1,sizeof(*srs_Config->srs_ResourceSetToAddModList));
+ NR_SRS_ResourceSet_t *srs_resset0=calloc(1,sizeof(*srs_resset0));
+ srs_resset0->srs_ResourceSetId = 0;
+ srs_resset0->srs_ResourceIdList=calloc(1,sizeof(*srs_resset0->srs_ResourceIdList));
+ NR_SRS_ResourceId_t *srs_resset0_id=calloc(1,sizeof(*srs_resset0_id));
+ *srs_resset0_id=0;
+ ASN_SEQUENCE_ADD(&srs_resset0->srs_ResourceIdList->list,srs_resset0_id);
+ srs_Config->srs_ResourceToReleaseList=NULL;
+ srs_resset0->resourceType.present =  NR_SRS_ResourceSet__resourceType_PR_aperiodic;
+ srs_resset0->resourceType.choice.aperiodic = calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic));
+ srs_resset0->resourceType.choice.aperiodic->aperiodicSRS_ResourceTrigger=1;
+ srs_resset0->resourceType.choice.aperiodic->csi_RS=NULL;
+ srs_resset0->resourceType.choice.aperiodic->slotOffset= calloc(1,sizeof(*srs_resset0->resourceType.choice.aperiodic->slotOffset));
+ *srs_resset0->resourceType.choice.aperiodic->slotOffset=2;
+ srs_resset0->resourceType.choice.aperiodic->ext1=NULL;
+ srs_resset0->usage=NR_SRS_ResourceSet__usage_codebook;
+ srs_resset0->alpha = calloc(1,sizeof(*srs_resset0->alpha));
+ *srs_resset0->alpha = NR_Alpha_alpha1;
+ srs_resset0->p0=calloc(1,sizeof(*srs_resset0->p0));
+ *srs_resset0->p0=-80;
+ srs_resset0->pathlossReferenceRS=NULL;
+ srs_resset0->srs_PowerControlAdjustmentStates=NULL;
+ ASN_SEQUENCE_ADD(&srs_Config->srs_ResourceSetToAddModList->list,srs_resset0);
+ srs_Config->srs_ResourceToReleaseList=NULL;
+ srs_Config->srs_ResourceToAddModList=calloc(1,sizeof(*srs_Config->srs_ResourceToAddModList));
+ NR_SRS_Resource_t *srs_res0=calloc(1,sizeof(*srs_res0));
+ srs_res0->srs_ResourceId=0;
+ srs_res0->nrofSRS_Ports=NR_SRS_Resource__nrofSRS_Ports_port1;
+ srs_res0->ptrs_PortIndex=NULL;
+ srs_res0->transmissionComb.present=NR_SRS_Resource__transmissionComb_PR_n2; 
+ srs_res0->transmissionComb.choice.n2=calloc(1,sizeof(*srs_res0->transmissionComb.choice.n2));
+ srs_res0->transmissionComb.choice.n2->combOffset_n2=0;
+ srs_res0->transmissionComb.choice.n2->cyclicShift_n2=0;
+ srs_res0->resourceMapping.startPosition=2;
+ srs_res0->resourceMapping.nrofSymbols=NR_SRS_Resource__resourceMapping__nrofSymbols_n1;
+ srs_res0->resourceMapping.repetitionFactor=NR_SRS_Resource__resourceMapping__repetitionFactor_n1;
+ srs_res0->freqDomainPosition=0;
+ srs_res0->freqDomainShift=0;
+ srs_res0->freqHopping.c_SRS = 61;
+ srs_res0->freqHopping.b_SRS=0;
+ srs_res0->freqHopping.b_hop=0;
+ srs_res0->groupOrSequenceHopping=NR_SRS_Resource__groupOrSequenceHopping_neither;
+ srs_res0->resourceType.present= NR_SRS_Resource__resourceType_PR_aperiodic;
+ srs_res0->resourceType.choice.aperiodic=calloc(1,sizeof(*srs_res0->resourceType.choice.aperiodic));
+ srs_res0->sequenceId=40;
+ srs_res0->spatialRelationInfo=calloc(1,sizeof(*srs_res0->spatialRelationInfo));
+ srs_res0->spatialRelationInfo->servingCellId=NULL;
+ srs_res0->spatialRelationInfo->referenceSignal.present=NR_SRS_SpatialRelationInfo__referenceSignal_PR_csi_RS_Index;
+ srs_res0->spatialRelationInfo->referenceSignal.choice.csi_RS_Index=0;
+ ASN_SEQUENCE_ADD(&srs_Config->srs_ResourceToAddModList->list,srs_res0);
+
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToReleaseList = NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList));
+ NR_BWP_Uplink_t *ubwp = calloc(1,sizeof(*ubwp));
+ ubwp->bwp_Id=1;
+ ubwp->bwp_Common = calloc(1,sizeof(*ubwp->bwp_Common));
+ // copy bwp_Common from Initial UL BWP except for bandwidth
+ memcpy((void*)&ubwp->bwp_Common->genericParameters,
+	(void*)&servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->genericParameters,
+	sizeof(servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->genericParameters));
+ ubwp->bwp_Common->genericParameters.locationAndBandwidth=PRBalloc_to_locationandbandwidth(servingcellconfigcommon->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth,0);
+
+ ubwp->bwp_Common->rach_ConfigCommon  = servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon;
+ ubwp->bwp_Common->pusch_ConfigCommon = servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon;
+ ubwp->bwp_Common->pucch_ConfigCommon = servingcellconfigcommon->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon;
+ 
+ ubwp->bwp_Dedicated = calloc(1,sizeof(*ubwp->bwp_Dedicated));
+ ubwp->bwp_Dedicated->pucch_Config = calloc(1,sizeof(*ubwp->bwp_Dedicated->pucch_Config));
+ ubwp->bwp_Dedicated->pucch_Config->present = NR_SetupRelease_PUCCH_Config_PR_setup;
+ NR_PUCCH_Config_t *pucch_Config = calloc(1,sizeof(*pucch_Config));
+ ubwp->bwp_Dedicated->pucch_Config->choice.setup=pucch_Config;
+ pucch_Config->resourceSetToAddModList = calloc(1,sizeof(*pucch_Config->resourceSetToAddModList));
+ pucch_Config->resourceSetToReleaseList = NULL;
+ NR_PUCCH_ResourceSet_t *pucchresset0=calloc(1,sizeof(*pucchresset0));
+ NR_PUCCH_ResourceSet_t *pucchresset1=calloc(1,sizeof(*pucchresset1));
+ pucchresset0->pucch_ResourceSetId = 0;
+ NR_PUCCH_ResourceId_t *pucchresset0id0=calloc(1,sizeof(*pucchresset0id0));
+ NR_PUCCH_ResourceId_t *pucchresset0id1=calloc(1,sizeof(*pucchresset0id1));
+ *pucchresset0id0=1;
+ ASN_SEQUENCE_ADD(&pucchresset0->resourceList.list,pucchresset0id0);
+ *pucchresset0id1=2;
+ ASN_SEQUENCE_ADD(&pucchresset0->resourceList.list,pucchresset0id1);
+ pucchresset0->maxPayloadMinus1=NULL;
+
+ ASN_SEQUENCE_ADD(&pucch_Config->resourceSetToAddModList->list,pucchresset0);
+
+ pucchresset1->pucch_ResourceSetId = 1;
+ NR_PUCCH_ResourceId_t *pucchresset1id0=calloc(1,sizeof(*pucchresset1id0));
+ NR_PUCCH_ResourceId_t *pucchresset1id1=calloc(1,sizeof(*pucchresset1id1));
+ *pucchresset1id0=3;
+ ASN_SEQUENCE_ADD(&pucchresset1->resourceList.list,pucchresset1id0);
+ *pucchresset1id1=4;
+ ASN_SEQUENCE_ADD(&pucchresset1->resourceList.list,pucchresset1id1);
+ pucchresset1->maxPayloadMinus1=NULL;
+ ASN_SEQUENCE_ADD(&pucch_Config->resourceSetToAddModList->list,pucchresset1);
+
+ pucch_Config->resourceToAddModList = calloc(1,sizeof(*pucch_Config->resourceToAddModList));
+ pucch_Config->resourceToReleaseList = NULL;
+ NR_PUCCH_Resource_t *pucchres0=calloc(1,sizeof(*pucchres0));
+ NR_PUCCH_Resource_t *pucchres1=calloc(1,sizeof(*pucchres1));
+ NR_PUCCH_Resource_t *pucchres2=calloc(1,sizeof(*pucchres2));
+ NR_PUCCH_Resource_t *pucchres3=calloc(1,sizeof(*pucchres3));
+ pucchres0->pucch_ResourceId=1;
+ pucchres0->startingPRB=48;
+ pucchres0->intraSlotFrequencyHopping=NULL;
+ pucchres0->secondHopPRB=NULL;
+ pucchres0->format.present= NR_PUCCH_Resource__format_PR_format0;
+ pucchres0->format.choice.format0=calloc(1,sizeof(*pucchres0->format.choice.format0));
+ pucchres0->format.choice.format0->initialCyclicShift=0;
+ pucchres0->format.choice.format0->nrofSymbols=1;
+ pucchres0->format.choice.format0->startingSymbolIndex=13;
+ ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres0);
+
+ pucchres1->pucch_ResourceId=2;
+ pucchres1->startingPRB=48;
+ pucchres1->intraSlotFrequencyHopping=NULL;
+ pucchres1->secondHopPRB=NULL;
+ pucchres1->format.present= NR_PUCCH_Resource__format_PR_format0;
+ pucchres1->format.choice.format0=calloc(1,sizeof(*pucchres1->format.choice.format0));
+ pucchres1->format.choice.format0->initialCyclicShift=0;
+ pucchres1->format.choice.format0->nrofSymbols=1;
+ pucchres1->format.choice.format0->startingSymbolIndex=12;
+ ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres1);
+
+ pucchres2->pucch_ResourceId=3;
+ pucchres2->startingPRB=40;
+ pucchres2->intraSlotFrequencyHopping=NULL;
+ pucchres2->secondHopPRB=NULL;
+ pucchres2->format.present= NR_PUCCH_Resource__format_PR_format2;
+ pucchres2->format.choice.format2=calloc(1,sizeof(*pucchres2->format.choice.format2));
+ pucchres2->format.choice.format2->nrofPRBs=16;
+ pucchres2->format.choice.format2->nrofSymbols=1;
+ pucchres2->format.choice.format2->startingSymbolIndex=13;
+ ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres2);
+
+ pucchres3->pucch_ResourceId=4;
+ pucchres3->startingPRB=40;
+ pucchres3->intraSlotFrequencyHopping=NULL;
+ pucchres3->secondHopPRB=NULL;
+ pucchres3->format.present= NR_PUCCH_Resource__format_PR_format2;
+ pucchres3->format.choice.format2=calloc(1,sizeof(*pucchres3->format.choice.format2));
+ pucchres3->format.choice.format2->nrofPRBs=16;
+ pucchres3->format.choice.format2->nrofSymbols=1;
+ pucchres3->format.choice.format2->startingSymbolIndex=12;
+ ASN_SEQUENCE_ADD(&pucch_Config->resourceToAddModList->list,pucchres3);
+
+ pucch_Config->format2=calloc(1,sizeof(*pucch_Config->format2));
+ pucch_Config->format2->present=NR_SetupRelease_PUCCH_FormatConfig_PR_setup;
+ NR_PUCCH_FormatConfig_t *pucchfmt2 = calloc(1,sizeof(*pucchfmt2));
+ pucch_Config->format2->choice.setup = pucchfmt2;
+ pucchfmt2->interslotFrequencyHopping=NULL;
+ pucchfmt2->additionalDMRS=NULL;
+ pucchfmt2->maxCodeRate=calloc(1,sizeof(*pucchfmt2->maxCodeRate));
+ *pucchfmt2->maxCodeRate=NR_PUCCH_MaxCodeRate_zeroDot15;
+ pucchfmt2->nrofSlots=NULL;
+ pucchfmt2->pi2BPSK=NULL;
+ pucchfmt2->simultaneousHARQ_ACK_CSI=NULL;
+ pucch_Config->schedulingRequestResourceToAddModList=NULL;
+ pucch_Config->schedulingRequestResourceToReleaseList=NULL;
+ pucch_Config->multi_CSI_PUCCH_ResourceList=NULL;
+ pucch_Config->dl_DataToUL_ACK = calloc(1,sizeof(*pucch_Config->dl_DataToUL_ACK));
+ long *delay[8];
+ for (int i=0;i<8;i++) {
+   delay[i] = calloc(1,sizeof(*delay[i]));
+   *delay[i] = (i<6) ? (i+2) : 0;
+   ASN_SEQUENCE_ADD(&pucch_Config->dl_DataToUL_ACK->list,delay[i]);
+ }
+ pucch_Config->spatialRelationInfoToAddModList = calloc(1,sizeof(*pucch_Config->spatialRelationInfoToAddModList));
+ NR_PUCCH_SpatialRelationInfo_t *pucchspatial = calloc(1,sizeof(*pucchspatial));
+ pucchspatial->pucch_SpatialRelationInfoId = 1;
+ pucchspatial->servingCellId = NULL;
+ pucchspatial->referenceSignal.present = NR_PUCCH_SpatialRelationInfo__referenceSignal_PR_csi_RS_Index;
+ pucchspatial->referenceSignal.choice.csi_RS_Index = 0;
+ pucchspatial->pucch_PathlossReferenceRS_Id = 0;
+ pucchspatial->p0_PUCCH_Id = 1;
+ pucchspatial->closedLoopIndex = NR_PUCCH_SpatialRelationInfo__closedLoopIndex_i0;
+ ASN_SEQUENCE_ADD(&pucch_Config->spatialRelationInfoToAddModList->list,pucchspatial);
+ pucch_Config->spatialRelationInfoToReleaseList=NULL;
+ pucch_Config->pucch_PowerControl=calloc(1,sizeof(*pucch_Config->pucch_PowerControl));
+ pucch_Config->pucch_PowerControl->deltaF_PUCCH_f0 = calloc(1,sizeof(*pucch_Config->pucch_PowerControl->deltaF_PUCCH_f0));
+ *pucch_Config->pucch_PowerControl->deltaF_PUCCH_f0 = 0;
+ pucch_Config->pucch_PowerControl->deltaF_PUCCH_f1 = calloc(1,sizeof(*pucch_Config->pucch_PowerControl->deltaF_PUCCH_f1));
+ *pucch_Config->pucch_PowerControl->deltaF_PUCCH_f1 = 0;
+ pucch_Config->pucch_PowerControl->deltaF_PUCCH_f2 = calloc(1,sizeof(*pucch_Config->pucch_PowerControl->deltaF_PUCCH_f2));
+ *pucch_Config->pucch_PowerControl->deltaF_PUCCH_f2 = 0;
+ pucch_Config->pucch_PowerControl->deltaF_PUCCH_f3 = calloc(1,sizeof(*pucch_Config->pucch_PowerControl->deltaF_PUCCH_f3));
+ *pucch_Config->pucch_PowerControl->deltaF_PUCCH_f3 = 0;
+ pucch_Config->pucch_PowerControl->deltaF_PUCCH_f4 = calloc(1,sizeof(*pucch_Config->pucch_PowerControl->deltaF_PUCCH_f4));
+ *pucch_Config->pucch_PowerControl->deltaF_PUCCH_f4 = 0;
+ pucch_Config->pucch_PowerControl->p0_Set = calloc(1,sizeof(*pucch_Config->pucch_PowerControl->p0_Set));
+ NR_P0_PUCCH_t *p00 = calloc(1,sizeof(*p00));
+ p00->p0_PUCCH_Id=1;
+ p00->p0_PUCCH_Value = 0;
+ ASN_SEQUENCE_ADD(&pucch_Config->pucch_PowerControl->p0_Set->list,p00);
+ pucch_Config->pucch_PowerControl->pathlossReferenceRSs = calloc(1,sizeof(*pucch_Config->pucch_PowerControl->pathlossReferenceRSs));
+ NR_PUCCH_PathlossReferenceRS_t *pucchPLRef=calloc(1,sizeof(*pucchPLRef));
+ pucchPLRef->pucch_PathlossReferenceRS_Id=0;
+ pucchPLRef->referenceSignal.present = NR_PUCCH_PathlossReferenceRS__referenceSignal_PR_csi_RS_Index;
+ pucchPLRef->referenceSignal.choice.csi_RS_Index=0;
+ ASN_SEQUENCE_ADD(&pucch_Config->pucch_PowerControl->pathlossReferenceRSs->list,pucchPLRef);
+
+ // copy pusch_Config from dedicated initialBWP
+ ubwp->bwp_Dedicated->pusch_Config = calloc(1,sizeof(*ubwp->bwp_Dedicated->pusch_Config));
+ ubwp->bwp_Dedicated->pusch_Config->present = NR_SetupRelease_PUSCH_Config_PR_setup;
+ ubwp->bwp_Dedicated->pusch_Config->choice.setup = pusch_Config;
+
+ ubwp->bwp_Dedicated->configuredGrantConfig = NULL;
+ ubwp->bwp_Dedicated->srs_Config = calloc(1,sizeof(*ubwp->bwp_Dedicated->srs_Config));
+ ubwp->bwp_Dedicated->srs_Config->present = NR_SetupRelease_SRS_Config_PR_setup;
+ ubwp->bwp_Dedicated->srs_Config->choice.setup = srs_Config;
+
+ ubwp->bwp_Dedicated->beamFailureRecoveryConfig = NULL;
+
+ ASN_SEQUENCE_ADD(&secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list,ubwp);
+
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id));
+ *secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->firstActiveUplinkBWP_Id = 1;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig = NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->carrierSwitching = NULL;
+
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->supplementaryUplink=NULL;
+
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdcch_ServingCellConfig=NULL;
+
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig));
+ NR_PDSCH_ServingCellConfig_t *pdsch_servingcellconfig = calloc(1,sizeof(*pdsch_servingcellconfig));
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->present = NR_SetupRelease_PDSCH_ServingCellConfig_PR_setup;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->pdsch_ServingCellConfig->choice.setup = pdsch_servingcellconfig;
+ pdsch_servingcellconfig->codeBlockGroupTransmission = NULL;
+ pdsch_servingcellconfig->xOverhead = NULL;
+ pdsch_servingcellconfig->nrofHARQ_ProcessesForPDSCH = NULL;
+ pdsch_servingcellconfig->pucch_Cell= NULL;
+ pdsch_servingcellconfig->ext1=calloc(1,sizeof(*pdsch_servingcellconfig->ext1));
+ pdsch_servingcellconfig->ext1->maxMIMO_Layers = calloc(1,sizeof(*pdsch_servingcellconfig->ext1->maxMIMO_Layers));
+ *pdsch_servingcellconfig->ext1->maxMIMO_Layers = 2;
+ pdsch_servingcellconfig->ext1->processingType2Enabled = NULL;
+ 
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig));
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->present = NR_SetupRelease_CSI_MeasConfig_PR_setup;
+
+
+ NR_CSI_MeasConfig_t *csi_MeasConfig = calloc(1,sizeof(*csi_MeasConfig));
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup = csi_MeasConfig;
+ csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList = calloc(1,sizeof(*csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList));
+
+ NR_NZP_CSI_RS_Resource_t *nzpres0 = calloc(1,sizeof(*nzpres0));
+ nzpres0->nzp_CSI_RS_ResourceId=0;
+ nzpres0->resourceMapping.frequencyDomainAllocation.present = NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_other;
+ nzpres0->resourceMapping.frequencyDomainAllocation.choice.other.buf = calloc(1,1);
+ nzpres0->resourceMapping.frequencyDomainAllocation.choice.other.size = 1;
+ nzpres0->resourceMapping.frequencyDomainAllocation.choice.other.bits_unused = 2;
+ nzpres0->resourceMapping.frequencyDomainAllocation.choice.other.buf[0]=1<<2;
+ nzpres0->resourceMapping.nrofPorts = (n_physical_antenna_ports==1)? NR_CSI_RS_ResourceMapping__nrofPorts_p1 : NR_CSI_RS_ResourceMapping__nrofPorts_p2;
+ nzpres0->resourceMapping.firstOFDMSymbolInTimeDomain=7;
+ nzpres0->resourceMapping.firstOFDMSymbolInTimeDomain2=NULL;
+ nzpres0->resourceMapping.cdm_Type = (n_physical_antenna_ports==1)? NR_CSI_RS_ResourceMapping__cdm_Type_noCDM : NR_CSI_RS_ResourceMapping__cdm_Type_fd_CDM2;
+ nzpres0->resourceMapping.density.present=NR_CSI_RS_ResourceMapping__density_PR_one;
+ nzpres0->resourceMapping.density.choice.one=(NULL_t)0;
+ nzpres0->resourceMapping.freqBand.startingRB=0;
+ nzpres0->resourceMapping.freqBand.nrofRBs= servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
+ nzpres0->powerControlOffset=13;
+ nzpres0->powerControlOffsetSS=NULL;
+ nzpres0->scramblingID=40;
+ nzpres0->periodicityAndOffset = calloc(1,sizeof(*nzpres0->periodicityAndOffset));
+ nzpres0->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots320;
+ nzpres0->periodicityAndOffset->choice.slots320 = 2;
+ nzpres0->qcl_InfoPeriodicCSI_RS=NULL;
+ ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpres0);
+
+ if (n_physical_antenna_ports > 1) {
+   NR_NZP_CSI_RS_Resource_t *nzpres2 = calloc(1,sizeof(*nzpres2));
+   nzpres2->nzp_CSI_RS_ResourceId=2;
+   nzpres2->resourceMapping.frequencyDomainAllocation.present = NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1;
+   nzpres2->resourceMapping.frequencyDomainAllocation.choice.row1.buf = calloc(1,1);
+   nzpres2->resourceMapping.frequencyDomainAllocation.choice.row1.size = 1;
+   nzpres2->resourceMapping.frequencyDomainAllocation.choice.row1.bits_unused = 4;
+   nzpres2->resourceMapping.frequencyDomainAllocation.choice.row1.buf[0]=1;
+   nzpres2->resourceMapping.nrofPorts = NR_CSI_RS_ResourceMapping__nrofPorts_p1;
+   nzpres2->resourceMapping.firstOFDMSymbolInTimeDomain=4;
+   nzpres2->resourceMapping.firstOFDMSymbolInTimeDomain2=NULL;
+   nzpres2->resourceMapping.cdm_Type = NR_CSI_RS_ResourceMapping__cdm_Type_noCDM;
+   nzpres2->resourceMapping.density.present=NR_CSI_RS_ResourceMapping__density_PR_three;
+   nzpres2->resourceMapping.density.choice.three=(NULL_t)0;
+   nzpres2->resourceMapping.freqBand.startingRB=0;
+   nzpres2->resourceMapping.freqBand.nrofRBs= servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
+   nzpres2->powerControlOffset=0;
+   nzpres2->powerControlOffsetSS=calloc(1,sizeof(*nzpres2->powerControlOffsetSS));
+   *nzpres2->powerControlOffsetSS=NR_NZP_CSI_RS_Resource__powerControlOffsetSS_db0;
+   nzpres2->scramblingID=40;
+   nzpres2->periodicityAndOffset = calloc(1,sizeof(*nzpres2->periodicityAndOffset));
+   nzpres2->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots160;
+   nzpres2->periodicityAndOffset->choice.slots160 = 25;
+   nzpres2->qcl_InfoPeriodicCSI_RS=calloc(1,sizeof(*nzpres2->qcl_InfoPeriodicCSI_RS));
+   *nzpres2->qcl_InfoPeriodicCSI_RS=8;
+   ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpres2);
+   
+   
+   NR_NZP_CSI_RS_Resource_t *nzpres3 = calloc(1,sizeof(*nzpres3));
+   nzpres3->nzp_CSI_RS_ResourceId=3;
+   nzpres3->resourceMapping.frequencyDomainAllocation.present = NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1;
+   nzpres3->resourceMapping.frequencyDomainAllocation.choice.row1.buf = calloc(1,1);
+   nzpres3->resourceMapping.frequencyDomainAllocation.choice.row1.size = 1;
+   nzpres3->resourceMapping.frequencyDomainAllocation.choice.row1.bits_unused = 4;
+   nzpres3->resourceMapping.frequencyDomainAllocation.choice.row1.buf[0]=1;
+   nzpres3->resourceMapping.nrofPorts = NR_CSI_RS_ResourceMapping__nrofPorts_p1;
+   nzpres3->resourceMapping.firstOFDMSymbolInTimeDomain=8;
+   nzpres3->resourceMapping.firstOFDMSymbolInTimeDomain2=NULL;
+   nzpres3->resourceMapping.cdm_Type = NR_CSI_RS_ResourceMapping__cdm_Type_noCDM;
+   nzpres3->resourceMapping.density.present=NR_CSI_RS_ResourceMapping__density_PR_three;
+   nzpres3->resourceMapping.density.choice.three=(NULL_t)0;
+   nzpres3->resourceMapping.freqBand.startingRB=0;
+   nzpres3->resourceMapping.freqBand.nrofRBs= servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
+   nzpres3->powerControlOffset=0;
+   nzpres3->powerControlOffsetSS=calloc(1,sizeof(*nzpres3->powerControlOffsetSS));
+   *nzpres3->powerControlOffsetSS=NR_NZP_CSI_RS_Resource__powerControlOffsetSS_db0;
+   nzpres3->scramblingID=40;
+   nzpres3->periodicityAndOffset = calloc(1,sizeof(*nzpres3->periodicityAndOffset));
+   nzpres3->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots160;
+   nzpres3->periodicityAndOffset->choice.slots160 = 25;
+   nzpres3->qcl_InfoPeriodicCSI_RS=calloc(1,sizeof(*nzpres3->qcl_InfoPeriodicCSI_RS));
+   *nzpres3->qcl_InfoPeriodicCSI_RS=8;
+   ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpres3);
+ }
+ if (n_physical_antenna_ports > 3) {
+   NR_NZP_CSI_RS_Resource_t *nzpres4 = calloc(1,sizeof(*nzpres4));
+   nzpres4->nzp_CSI_RS_ResourceId=4;
+   nzpres4->resourceMapping.frequencyDomainAllocation.present = NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1;
+   nzpres4->resourceMapping.frequencyDomainAllocation.choice.row1.buf = calloc(1,1);
+   nzpres4->resourceMapping.frequencyDomainAllocation.choice.row1.size = 1;
+   nzpres4->resourceMapping.frequencyDomainAllocation.choice.row1.bits_unused = 4;
+   nzpres4->resourceMapping.frequencyDomainAllocation.choice.row1.buf[0]=1;
+   nzpres4->resourceMapping.nrofPorts = NR_CSI_RS_ResourceMapping__nrofPorts_p1;
+   nzpres4->resourceMapping.firstOFDMSymbolInTimeDomain=4;
+   nzpres4->resourceMapping.firstOFDMSymbolInTimeDomain2=NULL;
+   nzpres4->resourceMapping.cdm_Type = NR_CSI_RS_ResourceMapping__cdm_Type_noCDM;
+   nzpres4->resourceMapping.density.present=NR_CSI_RS_ResourceMapping__density_PR_three;
+   nzpres4->resourceMapping.density.choice.three=(NULL_t)0;
+   nzpres4->resourceMapping.freqBand.startingRB=0;
+   nzpres4->resourceMapping.freqBand.nrofRBs= servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
+   nzpres4->powerControlOffset=0;
+   nzpres4->powerControlOffsetSS=calloc(1,sizeof(*nzpres4->powerControlOffsetSS));
+   *nzpres4->powerControlOffsetSS=NR_NZP_CSI_RS_Resource__powerControlOffsetSS_db0;
+   nzpres4->scramblingID=40;
+   nzpres4->periodicityAndOffset = calloc(1,sizeof(*nzpres4->periodicityAndOffset));
+   nzpres4->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots160;
+   nzpres4->periodicityAndOffset->choice.slots160 = 26;
+   nzpres4->qcl_InfoPeriodicCSI_RS=calloc(1,sizeof(*nzpres4->qcl_InfoPeriodicCSI_RS));
+   *nzpres4->qcl_InfoPeriodicCSI_RS=8;
+   ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpres4);
+   
+   NR_NZP_CSI_RS_Resource_t *nzpres5 = calloc(1,sizeof(*nzpres5));
+   nzpres5->nzp_CSI_RS_ResourceId=5;
+   nzpres5->resourceMapping.frequencyDomainAllocation.present = NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1;
+   nzpres5->resourceMapping.frequencyDomainAllocation.choice.row1.buf = calloc(1,1);
+   nzpres5->resourceMapping.frequencyDomainAllocation.choice.row1.size = 1;
+   nzpres5->resourceMapping.frequencyDomainAllocation.choice.row1.bits_unused = 4;
+   nzpres5->resourceMapping.frequencyDomainAllocation.choice.row1.buf[0]=1;
+   nzpres5->resourceMapping.nrofPorts = NR_CSI_RS_ResourceMapping__nrofPorts_p1;
+   nzpres5->resourceMapping.firstOFDMSymbolInTimeDomain=8;
+   nzpres5->resourceMapping.firstOFDMSymbolInTimeDomain2=NULL;
+   nzpres5->resourceMapping.cdm_Type = NR_CSI_RS_ResourceMapping__cdm_Type_noCDM;
+   nzpres5->resourceMapping.density.present=NR_CSI_RS_ResourceMapping__density_PR_three;
+   nzpres5->resourceMapping.density.choice.three=(NULL_t)0;
+   nzpres5->resourceMapping.freqBand.startingRB=0;
+   nzpres5->resourceMapping.freqBand.nrofRBs= servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
+   nzpres5->powerControlOffset=0;
+   nzpres5->powerControlOffsetSS=calloc(1,sizeof(*nzpres5->powerControlOffsetSS));
+   *nzpres5->powerControlOffsetSS=NR_NZP_CSI_RS_Resource__powerControlOffsetSS_db0;
+   nzpres5->scramblingID=40;
+   nzpres5->periodicityAndOffset = calloc(1,sizeof(*nzpres5->periodicityAndOffset));
+   nzpres5->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots160;
+   nzpres5->periodicityAndOffset->choice.slots160 = 26;
+   nzpres5->qcl_InfoPeriodicCSI_RS=calloc(1,sizeof(*nzpres5->qcl_InfoPeriodicCSI_RS));
+   *nzpres5->qcl_InfoPeriodicCSI_RS=8;
+   ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpres5);
+ }
+ if (n_physical_antenna_ports > 7) {
+   NR_NZP_CSI_RS_Resource_t *nzpres6 = calloc(1,sizeof(*nzpres6));
+   nzpres6->nzp_CSI_RS_ResourceId=6;
+   nzpres6->resourceMapping.frequencyDomainAllocation.present = NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1;
+   nzpres6->resourceMapping.frequencyDomainAllocation.choice.row1.buf = calloc(1,1);
+   nzpres6->resourceMapping.frequencyDomainAllocation.choice.row1.size = 1;
+   nzpres6->resourceMapping.frequencyDomainAllocation.choice.row1.bits_unused = 4;
+   nzpres6->resourceMapping.frequencyDomainAllocation.choice.row1.buf[0]=4;
+   nzpres6->resourceMapping.nrofPorts = NR_CSI_RS_ResourceMapping__nrofPorts_p1;
+   nzpres6->resourceMapping.firstOFDMSymbolInTimeDomain=4;
+   nzpres6->resourceMapping.firstOFDMSymbolInTimeDomain2=NULL;
+   nzpres6->resourceMapping.cdm_Type = NR_CSI_RS_ResourceMapping__cdm_Type_noCDM;
+   nzpres6->resourceMapping.density.present=NR_CSI_RS_ResourceMapping__density_PR_three;
+   nzpres6->resourceMapping.density.choice.three=(NULL_t)0;
+   nzpres6->resourceMapping.freqBand.startingRB=0;
+   nzpres6->resourceMapping.freqBand.nrofRBs= servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
+   nzpres6->powerControlOffset=0;
+   nzpres6->powerControlOffsetSS=calloc(1,sizeof(*nzpres6->powerControlOffsetSS));
+   *nzpres6->powerControlOffsetSS=NR_NZP_CSI_RS_Resource__powerControlOffsetSS_db0;
+   nzpres6->scramblingID=40;
+   nzpres6->periodicityAndOffset = calloc(1,sizeof(*nzpres6->periodicityAndOffset));
+   nzpres6->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots160;
+   nzpres6->periodicityAndOffset->choice.slots160 = 25;
+   nzpres6->qcl_InfoPeriodicCSI_RS=calloc(1,sizeof(*nzpres6->qcl_InfoPeriodicCSI_RS));
+   *nzpres6->qcl_InfoPeriodicCSI_RS=8;
+   ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpres6);
+   
+   NR_NZP_CSI_RS_Resource_t *nzpres7 = calloc(1,sizeof(*nzpres7));
+   nzpres7->nzp_CSI_RS_ResourceId=7;
+   nzpres7->resourceMapping.frequencyDomainAllocation.present = NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1;
+   nzpres7->resourceMapping.frequencyDomainAllocation.choice.row1.buf = calloc(1,1);
+   nzpres7->resourceMapping.frequencyDomainAllocation.choice.row1.size = 1;
+   nzpres7->resourceMapping.frequencyDomainAllocation.choice.row1.bits_unused = 4;
+   nzpres7->resourceMapping.frequencyDomainAllocation.choice.row1.buf[0]=4;
+   nzpres7->resourceMapping.nrofPorts = NR_CSI_RS_ResourceMapping__nrofPorts_p1;
+   nzpres7->resourceMapping.firstOFDMSymbolInTimeDomain=8;
+   nzpres7->resourceMapping.firstOFDMSymbolInTimeDomain2=NULL;
+   nzpres7->resourceMapping.cdm_Type = NR_CSI_RS_ResourceMapping__cdm_Type_noCDM;
+   nzpres7->resourceMapping.density.present=NR_CSI_RS_ResourceMapping__density_PR_three;
+   nzpres7->resourceMapping.density.choice.three=(NULL_t)0;
+   nzpres7->resourceMapping.freqBand.startingRB=0;
+   nzpres7->resourceMapping.freqBand.nrofRBs= servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
+   nzpres7->powerControlOffset=0;
+   nzpres7->powerControlOffsetSS=calloc(1,sizeof(*nzpres7->powerControlOffsetSS));
+   *nzpres7->powerControlOffsetSS=NR_NZP_CSI_RS_Resource__powerControlOffsetSS_db0;
+   nzpres7->scramblingID=40;
+   nzpres7->periodicityAndOffset = calloc(1,sizeof(*nzpres7->periodicityAndOffset));
+   nzpres7->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots160;
+   nzpres7->periodicityAndOffset->choice.slots160 = 25;
+   nzpres7->qcl_InfoPeriodicCSI_RS=calloc(1,sizeof(*nzpres7->qcl_InfoPeriodicCSI_RS));
+   *nzpres7->qcl_InfoPeriodicCSI_RS=8;
+   ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpres7);
+   NR_NZP_CSI_RS_Resource_t *nzpres8 = calloc(1,sizeof(*nzpres8));
+   nzpres8->nzp_CSI_RS_ResourceId=8;
+   nzpres8->resourceMapping.frequencyDomainAllocation.present = NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1;
+   nzpres8->resourceMapping.frequencyDomainAllocation.choice.row1.buf = calloc(1,1);
+   nzpres8->resourceMapping.frequencyDomainAllocation.choice.row1.size = 1;
+   nzpres8->resourceMapping.frequencyDomainAllocation.choice.row1.bits_unused = 4;
+   nzpres8->resourceMapping.frequencyDomainAllocation.choice.row1.buf[0]=4;
+   nzpres8->resourceMapping.nrofPorts = NR_CSI_RS_ResourceMapping__nrofPorts_p1;
+   nzpres8->resourceMapping.firstOFDMSymbolInTimeDomain=4;
+   nzpres8->resourceMapping.firstOFDMSymbolInTimeDomain2=NULL;
+   nzpres8->resourceMapping.cdm_Type = NR_CSI_RS_ResourceMapping__cdm_Type_noCDM;
+   nzpres8->resourceMapping.density.present=NR_CSI_RS_ResourceMapping__density_PR_three;
+   nzpres8->resourceMapping.density.choice.three=(NULL_t)0;
+   nzpres8->resourceMapping.freqBand.startingRB=0;
+   nzpres8->resourceMapping.freqBand.nrofRBs= servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
+   nzpres8->powerControlOffset=0;
+   nzpres8->powerControlOffsetSS=calloc(1,sizeof(*nzpres8->powerControlOffsetSS));
+   *nzpres8->powerControlOffsetSS=NR_NZP_CSI_RS_Resource__powerControlOffsetSS_db0;
+   nzpres8->scramblingID=40;
+   nzpres8->periodicityAndOffset = calloc(1,sizeof(*nzpres8->periodicityAndOffset));
+   nzpres8->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots160;
+   nzpres8->periodicityAndOffset->choice.slots160 = 26;
+   nzpres8->qcl_InfoPeriodicCSI_RS=calloc(1,sizeof(*nzpres8->qcl_InfoPeriodicCSI_RS));
+   *nzpres8->qcl_InfoPeriodicCSI_RS=8;
+   ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpres8);
+   
+   NR_NZP_CSI_RS_Resource_t *nzpres9 = calloc(1,sizeof(*nzpres9));
+   nzpres9->nzp_CSI_RS_ResourceId=9;
+   nzpres9->resourceMapping.frequencyDomainAllocation.present = NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1;
+   nzpres9->resourceMapping.frequencyDomainAllocation.choice.row1.buf = calloc(1,1);
+   nzpres9->resourceMapping.frequencyDomainAllocation.choice.row1.size = 1;
+   nzpres9->resourceMapping.frequencyDomainAllocation.choice.row1.bits_unused = 4;
+   nzpres9->resourceMapping.frequencyDomainAllocation.choice.row1.buf[0]=4;
+   nzpres9->resourceMapping.nrofPorts = NR_CSI_RS_ResourceMapping__nrofPorts_p1;
+   nzpres9->resourceMapping.firstOFDMSymbolInTimeDomain=8;
+   nzpres9->resourceMapping.firstOFDMSymbolInTimeDomain2=NULL;
+   nzpres9->resourceMapping.cdm_Type = NR_CSI_RS_ResourceMapping__cdm_Type_noCDM;
+   nzpres9->resourceMapping.density.present=NR_CSI_RS_ResourceMapping__density_PR_three;
+   nzpres9->resourceMapping.density.choice.three=(NULL_t)0;
+   nzpres9->resourceMapping.freqBand.startingRB=0;
+   nzpres9->resourceMapping.freqBand.nrofRBs= servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
+   nzpres9->powerControlOffset=0;
+   nzpres9->powerControlOffsetSS=calloc(1,sizeof(*nzpres9->powerControlOffsetSS));
+   *nzpres9->powerControlOffsetSS=NR_NZP_CSI_RS_Resource__powerControlOffsetSS_db0;
+   nzpres9->scramblingID=40;
+   nzpres9->periodicityAndOffset = calloc(1,sizeof(*nzpres9->periodicityAndOffset));
+   nzpres9->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots160;
+   nzpres9->periodicityAndOffset->choice.slots160 = 26;
+   nzpres9->qcl_InfoPeriodicCSI_RS=calloc(1,sizeof(*nzpres9->qcl_InfoPeriodicCSI_RS));
+   *nzpres9->qcl_InfoPeriodicCSI_RS=8;
+   ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpres9);
+ }
+ if (n_physical_antenna_ports > 15) {
+   NR_NZP_CSI_RS_Resource_t *nzpres10 = calloc(1,sizeof(*nzpres10));
+   nzpres10->nzp_CSI_RS_ResourceId=10;
+   nzpres10->resourceMapping.frequencyDomainAllocation.present = NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1;
+   nzpres10->resourceMapping.frequencyDomainAllocation.choice.row1.buf = calloc(1,1);
+   nzpres10->resourceMapping.frequencyDomainAllocation.choice.row1.size = 1;
+   nzpres10->resourceMapping.frequencyDomainAllocation.choice.row1.bits_unused = 4;
+   nzpres10->resourceMapping.frequencyDomainAllocation.choice.row1.buf[0]=2;
+   nzpres10->resourceMapping.nrofPorts = NR_CSI_RS_ResourceMapping__nrofPorts_p1;
+   nzpres10->resourceMapping.firstOFDMSymbolInTimeDomain=4;
+   nzpres10->resourceMapping.firstOFDMSymbolInTimeDomain2=NULL;
+   nzpres10->resourceMapping.cdm_Type = NR_CSI_RS_ResourceMapping__cdm_Type_noCDM;
+   nzpres10->resourceMapping.density.present=NR_CSI_RS_ResourceMapping__density_PR_three;
+   nzpres10->resourceMapping.density.choice.three=(NULL_t)0;
+   nzpres10->resourceMapping.freqBand.startingRB=0;
+   nzpres10->resourceMapping.freqBand.nrofRBs= servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
+   nzpres10->powerControlOffset=0;
+   nzpres10->powerControlOffsetSS=calloc(1,sizeof(*nzpres10->powerControlOffsetSS));
+   *nzpres10->powerControlOffsetSS=NR_NZP_CSI_RS_Resource__powerControlOffsetSS_db0;
+   nzpres10->scramblingID=40;
+   nzpres10->periodicityAndOffset = calloc(1,sizeof(*nzpres10->periodicityAndOffset));
+   nzpres10->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots160;
+   nzpres10->periodicityAndOffset->choice.slots160 = 25;
+   nzpres10->qcl_InfoPeriodicCSI_RS=calloc(1,sizeof(*nzpres10->qcl_InfoPeriodicCSI_RS));
+   *nzpres10->qcl_InfoPeriodicCSI_RS=8;
+   ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpres10);
+   
+   NR_NZP_CSI_RS_Resource_t *nzpres11 = calloc(1,sizeof(*nzpres11));
+   nzpres11->nzp_CSI_RS_ResourceId=11;
+   nzpres11->resourceMapping.frequencyDomainAllocation.present = NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1;
+   nzpres11->resourceMapping.frequencyDomainAllocation.choice.row1.buf = calloc(1,1);
+   nzpres11->resourceMapping.frequencyDomainAllocation.choice.row1.size = 1;
+   nzpres11->resourceMapping.frequencyDomainAllocation.choice.row1.bits_unused = 4;
+   nzpres11->resourceMapping.frequencyDomainAllocation.choice.row1.buf[0]=2;
+   nzpres11->resourceMapping.nrofPorts = NR_CSI_RS_ResourceMapping__nrofPorts_p1;
+   nzpres11->resourceMapping.firstOFDMSymbolInTimeDomain=8;
+   nzpres11->resourceMapping.firstOFDMSymbolInTimeDomain2=NULL;
+   nzpres11->resourceMapping.cdm_Type = NR_CSI_RS_ResourceMapping__cdm_Type_noCDM;
+   nzpres11->resourceMapping.density.present=NR_CSI_RS_ResourceMapping__density_PR_three;
+   nzpres11->resourceMapping.density.choice.three=(NULL_t)0;
+   nzpres11->resourceMapping.freqBand.startingRB=0;
+   nzpres11->resourceMapping.freqBand.nrofRBs= servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
+   nzpres11->powerControlOffset=0;
+   nzpres11->powerControlOffsetSS=calloc(1,sizeof(*nzpres11->powerControlOffsetSS));
+   *nzpres11->powerControlOffsetSS=NR_NZP_CSI_RS_Resource__powerControlOffsetSS_db0;
+   nzpres11->scramblingID=40;
+   nzpres11->periodicityAndOffset = calloc(1,sizeof(*nzpres11->periodicityAndOffset));
+   nzpres11->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots160;
+   nzpres11->periodicityAndOffset->choice.slots160 = 25;
+   nzpres11->qcl_InfoPeriodicCSI_RS=calloc(1,sizeof(*nzpres11->qcl_InfoPeriodicCSI_RS));
+   *nzpres11->qcl_InfoPeriodicCSI_RS=8;
+   ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpres11);
+   NR_NZP_CSI_RS_Resource_t *nzpres12 = calloc(1,sizeof(*nzpres12));
+   nzpres12->nzp_CSI_RS_ResourceId=12;
+   nzpres12->resourceMapping.frequencyDomainAllocation.present = NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1;
+   nzpres12->resourceMapping.frequencyDomainAllocation.choice.row1.buf = calloc(1,1);
+   nzpres12->resourceMapping.frequencyDomainAllocation.choice.row1.size = 1;
+   nzpres12->resourceMapping.frequencyDomainAllocation.choice.row1.bits_unused = 4;
+   nzpres12->resourceMapping.frequencyDomainAllocation.choice.row1.buf[0]=2;
+   nzpres12->resourceMapping.nrofPorts = NR_CSI_RS_ResourceMapping__nrofPorts_p1;
+   nzpres12->resourceMapping.firstOFDMSymbolInTimeDomain=4;
+   nzpres12->resourceMapping.firstOFDMSymbolInTimeDomain2=NULL;
+   nzpres12->resourceMapping.cdm_Type = NR_CSI_RS_ResourceMapping__cdm_Type_noCDM;
+   nzpres12->resourceMapping.density.present=NR_CSI_RS_ResourceMapping__density_PR_three;
+   nzpres12->resourceMapping.density.choice.three=(NULL_t)0;
+   nzpres12->resourceMapping.freqBand.startingRB=0;
+   nzpres12->resourceMapping.freqBand.nrofRBs= servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
+   nzpres12->powerControlOffset=0;
+   nzpres12->powerControlOffsetSS=calloc(1,sizeof(*nzpres12->powerControlOffsetSS));
+   *nzpres12->powerControlOffsetSS=NR_NZP_CSI_RS_Resource__powerControlOffsetSS_db0;
+   nzpres12->scramblingID=40;
+   nzpres12->periodicityAndOffset = calloc(1,sizeof(*nzpres12->periodicityAndOffset));
+   nzpres12->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots160;
+   nzpres12->periodicityAndOffset->choice.slots160 = 26;
+   nzpres12->qcl_InfoPeriodicCSI_RS=calloc(1,sizeof(*nzpres12->qcl_InfoPeriodicCSI_RS));
+   *nzpres12->qcl_InfoPeriodicCSI_RS=8;
+   ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpres12);
+   
+   NR_NZP_CSI_RS_Resource_t *nzpres13 = calloc(1,sizeof(*nzpres13));
+   nzpres13->nzp_CSI_RS_ResourceId=13;
+   nzpres13->resourceMapping.frequencyDomainAllocation.present = NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1;
+   nzpres13->resourceMapping.frequencyDomainAllocation.choice.row1.buf = calloc(1,1);
+   nzpres13->resourceMapping.frequencyDomainAllocation.choice.row1.size = 1;
+   nzpres13->resourceMapping.frequencyDomainAllocation.choice.row1.bits_unused = 4;
+   nzpres13->resourceMapping.frequencyDomainAllocation.choice.row1.buf[0]=2;
+   nzpres13->resourceMapping.nrofPorts = NR_CSI_RS_ResourceMapping__nrofPorts_p1;
+   nzpres13->resourceMapping.firstOFDMSymbolInTimeDomain=8;
+   nzpres13->resourceMapping.firstOFDMSymbolInTimeDomain2=NULL;
+   nzpres13->resourceMapping.cdm_Type = NR_CSI_RS_ResourceMapping__cdm_Type_noCDM;
+   nzpres13->resourceMapping.density.present=NR_CSI_RS_ResourceMapping__density_PR_three;
+   nzpres13->resourceMapping.density.choice.three=(NULL_t)0;
+   nzpres13->resourceMapping.freqBand.startingRB=0;
+   nzpres13->resourceMapping.freqBand.nrofRBs= servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
+   nzpres13->powerControlOffset=0;
+   nzpres13->powerControlOffsetSS=calloc(1,sizeof(*nzpres13->powerControlOffsetSS));
+   *nzpres13->powerControlOffsetSS=NR_NZP_CSI_RS_Resource__powerControlOffsetSS_db0;
+   nzpres13->scramblingID=40;
+   nzpres13->periodicityAndOffset = calloc(1,sizeof(*nzpres13->periodicityAndOffset));
+   nzpres13->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots160;
+   nzpres13->periodicityAndOffset->choice.slots160 = 26;
+   nzpres13->qcl_InfoPeriodicCSI_RS=calloc(1,sizeof(*nzpres13->qcl_InfoPeriodicCSI_RS));
+   *nzpres13->qcl_InfoPeriodicCSI_RS=8;
+   ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpres13);
+   NR_NZP_CSI_RS_Resource_t *nzpres14 = calloc(1,sizeof(*nzpres14));
+   nzpres14->nzp_CSI_RS_ResourceId=14;
+   nzpres14->resourceMapping.frequencyDomainAllocation.present = NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1;
+   nzpres14->resourceMapping.frequencyDomainAllocation.choice.row1.buf = calloc(1,1);
+   nzpres14->resourceMapping.frequencyDomainAllocation.choice.row1.size = 1;
+   nzpres14->resourceMapping.frequencyDomainAllocation.choice.row1.bits_unused = 4;
+   nzpres14->resourceMapping.frequencyDomainAllocation.choice.row1.buf[0]=8;
+   nzpres14->resourceMapping.nrofPorts = NR_CSI_RS_ResourceMapping__nrofPorts_p1;
+   nzpres14->resourceMapping.firstOFDMSymbolInTimeDomain=4;
+   nzpres14->resourceMapping.firstOFDMSymbolInTimeDomain2=NULL;
+   nzpres14->resourceMapping.cdm_Type = NR_CSI_RS_ResourceMapping__cdm_Type_noCDM;
+   nzpres14->resourceMapping.density.present=NR_CSI_RS_ResourceMapping__density_PR_three;
+   nzpres14->resourceMapping.density.choice.three=(NULL_t)0;
+   nzpres14->resourceMapping.freqBand.startingRB=0;
+   nzpres14->resourceMapping.freqBand.nrofRBs= servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
+   nzpres14->powerControlOffset=0;
+   nzpres14->powerControlOffsetSS=calloc(1,sizeof(*nzpres14->powerControlOffsetSS));
+   *nzpres14->powerControlOffsetSS=NR_NZP_CSI_RS_Resource__powerControlOffsetSS_db0;
+   nzpres14->scramblingID=40;
+   nzpres14->periodicityAndOffset = calloc(1,sizeof(*nzpres14->periodicityAndOffset));
+   nzpres14->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots160;
+   nzpres14->periodicityAndOffset->choice.slots160 = 25;
+   nzpres14->qcl_InfoPeriodicCSI_RS=calloc(1,sizeof(*nzpres14->qcl_InfoPeriodicCSI_RS));
+   *nzpres14->qcl_InfoPeriodicCSI_RS=8;
+   ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpres14);
+   
+   NR_NZP_CSI_RS_Resource_t *nzpres15 = calloc(1,sizeof(*nzpres15));
+   nzpres15->nzp_CSI_RS_ResourceId=15;
+   nzpres15->resourceMapping.frequencyDomainAllocation.present = NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1;
+   nzpres15->resourceMapping.frequencyDomainAllocation.choice.row1.buf = calloc(1,1);
+   nzpres15->resourceMapping.frequencyDomainAllocation.choice.row1.size = 1;
+   nzpres15->resourceMapping.frequencyDomainAllocation.choice.row1.bits_unused = 4;
+   nzpres15->resourceMapping.frequencyDomainAllocation.choice.row1.buf[0]=8;
+   nzpres15->resourceMapping.nrofPorts = NR_CSI_RS_ResourceMapping__nrofPorts_p1;
+   nzpres15->resourceMapping.firstOFDMSymbolInTimeDomain=8;
+   nzpres15->resourceMapping.firstOFDMSymbolInTimeDomain2=NULL;
+   nzpres15->resourceMapping.cdm_Type = NR_CSI_RS_ResourceMapping__cdm_Type_noCDM;
+   nzpres15->resourceMapping.density.present=NR_CSI_RS_ResourceMapping__density_PR_three;
+   nzpres15->resourceMapping.density.choice.three=(NULL_t)0;
+   nzpres15->resourceMapping.freqBand.startingRB=0;
+   nzpres15->resourceMapping.freqBand.nrofRBs= servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
+   nzpres15->powerControlOffset=0;
+   nzpres15->powerControlOffsetSS=calloc(1,sizeof(*nzpres15->powerControlOffsetSS));
+   *nzpres15->powerControlOffsetSS=NR_NZP_CSI_RS_Resource__powerControlOffsetSS_db0;
+   nzpres15->scramblingID=40;
+   nzpres15->periodicityAndOffset = calloc(1,sizeof(*nzpres15->periodicityAndOffset));
+   nzpres15->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots160;
+   nzpres15->periodicityAndOffset->choice.slots160 = 25;
+   nzpres15->qcl_InfoPeriodicCSI_RS=calloc(1,sizeof(*nzpres15->qcl_InfoPeriodicCSI_RS));
+   *nzpres15->qcl_InfoPeriodicCSI_RS=8;
+   ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpres15);
+   NR_NZP_CSI_RS_Resource_t *nzpres16 = calloc(1,sizeof(*nzpres16));
+   nzpres16->nzp_CSI_RS_ResourceId=16;
+   nzpres16->resourceMapping.frequencyDomainAllocation.present = NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1;
+   nzpres16->resourceMapping.frequencyDomainAllocation.choice.row1.buf = calloc(1,1);
+   nzpres16->resourceMapping.frequencyDomainAllocation.choice.row1.size = 1;
+   nzpres16->resourceMapping.frequencyDomainAllocation.choice.row1.bits_unused = 4;
+   nzpres16->resourceMapping.frequencyDomainAllocation.choice.row1.buf[0]=8;
+   nzpres16->resourceMapping.nrofPorts = NR_CSI_RS_ResourceMapping__nrofPorts_p1;
+   nzpres16->resourceMapping.firstOFDMSymbolInTimeDomain=5;
+   nzpres16->resourceMapping.firstOFDMSymbolInTimeDomain2=NULL;
+   nzpres16->resourceMapping.cdm_Type = NR_CSI_RS_ResourceMapping__cdm_Type_noCDM;
+   nzpres16->resourceMapping.density.present=NR_CSI_RS_ResourceMapping__density_PR_three;
+   nzpres16->resourceMapping.density.choice.three=(NULL_t)0;
+   nzpres16->resourceMapping.freqBand.startingRB=0;
+   nzpres16->resourceMapping.freqBand.nrofRBs= servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
+   nzpres16->powerControlOffset=0;
+   nzpres16->powerControlOffsetSS=calloc(1,sizeof(*nzpres16->powerControlOffsetSS));
+   *nzpres16->powerControlOffsetSS=NR_NZP_CSI_RS_Resource__powerControlOffsetSS_db0;
+   nzpres16->scramblingID=40;
+   nzpres16->periodicityAndOffset = calloc(1,sizeof(*nzpres16->periodicityAndOffset));
+   nzpres16->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots160;
+   nzpres16->periodicityAndOffset->choice.slots160 = 26;
+   nzpres16->qcl_InfoPeriodicCSI_RS=calloc(1,sizeof(*nzpres16->qcl_InfoPeriodicCSI_RS));
+   *nzpres16->qcl_InfoPeriodicCSI_RS=8;
+   ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpres16);
+   
+   NR_NZP_CSI_RS_Resource_t *nzpres17 = calloc(1,sizeof(*nzpres17));
+   nzpres17->nzp_CSI_RS_ResourceId=9;
+   nzpres17->resourceMapping.frequencyDomainAllocation.present = NR_CSI_RS_ResourceMapping__frequencyDomainAllocation_PR_row1;
+   nzpres17->resourceMapping.frequencyDomainAllocation.choice.row1.buf = calloc(1,1);
+   nzpres17->resourceMapping.frequencyDomainAllocation.choice.row1.size = 1;
+   nzpres17->resourceMapping.frequencyDomainAllocation.choice.row1.bits_unused = 4;
+   nzpres17->resourceMapping.frequencyDomainAllocation.choice.row1.buf[0]=8;
+   nzpres17->resourceMapping.nrofPorts = NR_CSI_RS_ResourceMapping__nrofPorts_p1;
+   nzpres17->resourceMapping.firstOFDMSymbolInTimeDomain=9;
+   nzpres17->resourceMapping.firstOFDMSymbolInTimeDomain2=NULL;
+   nzpres17->resourceMapping.cdm_Type = NR_CSI_RS_ResourceMapping__cdm_Type_noCDM;
+   nzpres17->resourceMapping.density.present=NR_CSI_RS_ResourceMapping__density_PR_three;
+   nzpres17->resourceMapping.density.choice.three=(NULL_t)0;
+   nzpres17->resourceMapping.freqBand.startingRB=0;
+   nzpres17->resourceMapping.freqBand.nrofRBs= servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
+   nzpres17->powerControlOffset=0;
+   nzpres17->powerControlOffsetSS=calloc(1,sizeof(*nzpres17->powerControlOffsetSS));
+   *nzpres17->powerControlOffsetSS=NR_NZP_CSI_RS_Resource__powerControlOffsetSS_db0;
+   nzpres17->scramblingID=40;
+   nzpres17->periodicityAndOffset = calloc(1,sizeof(*nzpres17->periodicityAndOffset));
+   nzpres17->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots160;
+   nzpres17->periodicityAndOffset->choice.slots160 = 26;
+   nzpres17->qcl_InfoPeriodicCSI_RS=calloc(1,sizeof(*nzpres17->qcl_InfoPeriodicCSI_RS));
+   *nzpres17->qcl_InfoPeriodicCSI_RS=8;
+   ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceToAddModList->list,nzpres17);
+ }
+
+ if (n_physical_antenna_ports > 16) AssertFatal(1==0,"Fill in for more than 16 antenna elements\n");
+ 
+ csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList  = calloc(1,sizeof(*csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList));
+ csi_MeasConfig->nzp_CSI_RS_ResourceSetToReleaseList = NULL;
+ NR_NZP_CSI_RS_ResourceSet_t *nzpresset0=calloc(1,sizeof(*nzpresset0));
+ nzpresset0->nzp_CSI_ResourceSetId=0;
+ NR_NZP_CSI_RS_ResourceSetId_t *nzpresset00=calloc(1,sizeof(*nzpresset00));
+ *nzpresset00=0;
+ ASN_SEQUENCE_ADD(&nzpresset0->nzp_CSI_RS_Resources.list,nzpresset00);
+ nzpresset0->repetition=NULL;
+ nzpresset0->aperiodicTriggeringOffset=NULL;
+ nzpresset0->trs_Info=NULL;
+ ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list,nzpresset0);
+ if (n_physical_antenna_ports > 1) {
+   NR_NZP_CSI_RS_ResourceSet_t *nzpresset3=calloc(1,sizeof(*nzpresset3));
+   nzpresset3->nzp_CSI_ResourceSetId=3;
+   NR_NZP_CSI_RS_ResourceSetId_t *nzpresset30=calloc(1,sizeof(*nzpresset30));
+   *nzpresset30=2;
+   ASN_SEQUENCE_ADD(&nzpresset3->nzp_CSI_RS_Resources.list,nzpresset30);
+   if (n_physical_antenna_ports > 3) {
+   NR_NZP_CSI_RS_ResourceSetId_t *nzpresset31=calloc(1,sizeof(*nzpresset31));
+   *nzpresset31=3;
+   ASN_SEQUENCE_ADD(&nzpresset3->nzp_CSI_RS_Resources.list,nzpresset31);
+   NR_NZP_CSI_RS_ResourceSetId_t *nzpresset32=calloc(1,sizeof(*nzpresset32));
+   *nzpresset32=4;
+   ASN_SEQUENCE_ADD(&nzpresset3->nzp_CSI_RS_Resources.list,nzpresset32);
+   NR_NZP_CSI_RS_ResourceSetId_t *nzpresset33=calloc(1,sizeof(*nzpresset33));
+   *nzpresset33=5;
+   ASN_SEQUENCE_ADD(&nzpresset3->nzp_CSI_RS_Resources.list,nzpresset33);
+   ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list,nzpresset3);
+   }
+   nzpresset3->repetition=calloc(1,sizeof(*nzpresset3->repetition));
+   *nzpresset3->repetition=NR_NZP_CSI_RS_ResourceSet__repetition_off;
+   nzpresset3->aperiodicTriggeringOffset=NULL;
+   nzpresset3->trs_Info=calloc(1,sizeof(*nzpresset3->trs_Info));
+   *nzpresset3->trs_Info=NR_NZP_CSI_RS_ResourceSet__trs_Info_true;
+   ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list,nzpresset3);
+ }
+
+ if (n_physical_antenna_ports > 7) {
+   NR_NZP_CSI_RS_ResourceSet_t *nzpresset4=calloc(1,sizeof(*nzpresset4));
+   nzpresset4->nzp_CSI_ResourceSetId=4;
+   NR_NZP_CSI_RS_ResourceSetId_t *nzpresset40=calloc(1,sizeof(*nzpresset40));
+   *nzpresset40=6;
+   ASN_SEQUENCE_ADD(&nzpresset4->nzp_CSI_RS_Resources.list,nzpresset40);
+   NR_NZP_CSI_RS_ResourceSetId_t *nzpresset41=calloc(1,sizeof(*nzpresset41));
+   *nzpresset41=7;
+   ASN_SEQUENCE_ADD(&nzpresset4->nzp_CSI_RS_Resources.list,nzpresset41);
+   NR_NZP_CSI_RS_ResourceSetId_t *nzpresset42=calloc(1,sizeof(*nzpresset42));
+   *nzpresset42=8;
+   ASN_SEQUENCE_ADD(&nzpresset4->nzp_CSI_RS_Resources.list,nzpresset42);
+   NR_NZP_CSI_RS_ResourceSetId_t *nzpresset43=calloc(1,sizeof(*nzpresset43));
+   *nzpresset43=9;
+   ASN_SEQUENCE_ADD(&nzpresset4->nzp_CSI_RS_Resources.list,nzpresset43);
+   nzpresset4->repetition=calloc(1,sizeof(*nzpresset4->repetition));
+   *nzpresset4->repetition=NR_NZP_CSI_RS_ResourceSet__repetition_off;
+   nzpresset4->aperiodicTriggeringOffset=NULL;
+   nzpresset4->trs_Info=calloc(1,sizeof(*nzpresset4->trs_Info));
+   *nzpresset4->trs_Info=NR_NZP_CSI_RS_ResourceSet__trs_Info_true;
+   ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list,nzpresset4);
+ }
+ if (n_physical_antenna_ports > 15) {
+   NR_NZP_CSI_RS_ResourceSet_t *nzpresset5=calloc(1,sizeof(*nzpresset5));
+   nzpresset5->nzp_CSI_ResourceSetId=5;
+   NR_NZP_CSI_RS_ResourceSetId_t *nzpresset50=calloc(1,sizeof(*nzpresset50));
+   *nzpresset50=10;
+   ASN_SEQUENCE_ADD(&nzpresset5->nzp_CSI_RS_Resources.list,nzpresset50);
+   NR_NZP_CSI_RS_ResourceSetId_t *nzpresset51=calloc(1,sizeof(*nzpresset51));
+   *nzpresset51=11;
+   ASN_SEQUENCE_ADD(&nzpresset5->nzp_CSI_RS_Resources.list,nzpresset51);
+   NR_NZP_CSI_RS_ResourceSetId_t *nzpresset52=calloc(1,sizeof(*nzpresset52));
+   *nzpresset52=12;
+   ASN_SEQUENCE_ADD(&nzpresset5->nzp_CSI_RS_Resources.list,nzpresset52);
+   NR_NZP_CSI_RS_ResourceSetId_t *nzpresset53=calloc(1,sizeof(*nzpresset53));
+   *nzpresset53=13;
+   ASN_SEQUENCE_ADD(&nzpresset5->nzp_CSI_RS_Resources.list,nzpresset53);
+   nzpresset5->repetition=calloc(1,sizeof(*nzpresset5->repetition));
+   *nzpresset5->repetition=NR_NZP_CSI_RS_ResourceSet__repetition_off;
+   nzpresset5->aperiodicTriggeringOffset=NULL;
+   nzpresset5->trs_Info=calloc(1,sizeof(*nzpresset5->trs_Info));
+   *nzpresset5->trs_Info=NR_NZP_CSI_RS_ResourceSet__trs_Info_true;
+   ASN_SEQUENCE_ADD(&csi_MeasConfig->nzp_CSI_RS_ResourceSetToAddModList->list,nzpresset5);
+ }
+
+ csi_MeasConfig->csi_IM_ResourceToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_IM_ResourceToAddModList));
+ csi_MeasConfig->csi_IM_ResourceToReleaseList = NULL;
+ NR_CSI_IM_Resource_t *imres0 = calloc(1,sizeof(*imres0));
+ imres0->csi_IM_ResourceId=0;
+ imres0->csi_IM_ResourceElementPattern=calloc(1,sizeof(*imres0->csi_IM_ResourceElementPattern));
+ imres0->csi_IM_ResourceElementPattern->present = NR_CSI_IM_Resource__csi_IM_ResourceElementPattern_PR_pattern1 ;
+ imres0->csi_IM_ResourceElementPattern->choice.pattern1=calloc(1,sizeof(*imres0->csi_IM_ResourceElementPattern->choice.pattern1));
+ imres0->csi_IM_ResourceElementPattern->choice.pattern1->subcarrierLocation_p1 = NR_CSI_IM_Resource__csi_IM_ResourceElementPattern__pattern1__subcarrierLocation_p1_s4;
+ imres0->csi_IM_ResourceElementPattern->choice.pattern1->symbolLocation_p1=7;
+ imres0->freqBand=calloc(1,sizeof(*imres0->freqBand));
+ imres0->freqBand->startingRB=0;
+ imres0->freqBand->nrofRBs=276;
+ imres0->periodicityAndOffset=calloc(1,sizeof(*imres0->periodicityAndOffset));
+ imres0->periodicityAndOffset->present = NR_CSI_ResourcePeriodicityAndOffset_PR_slots320;
+ imres0->periodicityAndOffset->choice.slots320 = 2;
+ ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_IM_ResourceToAddModList->list,imres0);
+ csi_MeasConfig->csi_IM_ResourceSetToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_IM_ResourceSetToAddModList));
+ csi_MeasConfig->csi_IM_ResourceSetToReleaseList = NULL;
+ NR_CSI_IM_ResourceSet_t *imresset0 = calloc(1,sizeof(*imresset0));
+ imresset0->csi_IM_ResourceSetId=0;
+ NR_CSI_IM_ResourceId_t *imresset00=calloc(1,sizeof(*imresset00));
+ *imresset00=0;
+ ASN_SEQUENCE_ADD(&imresset0->csi_IM_Resources.list,imresset00);
+ ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_IM_ResourceSetToAddModList->list,imresset0);
+ 
+ csi_MeasConfig->csi_SSB_ResourceSetToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_SSB_ResourceSetToAddModList));
+ csi_MeasConfig->csi_SSB_ResourceSetToReleaseList = NULL;
+ NR_CSI_SSB_ResourceSet_t *ssbresset0 = calloc(1,sizeof(*ssbresset0));
+ ssbresset0->csi_SSB_ResourceSetId=0; 
+ NR_SSB_Index_t *ssbresset00=calloc(1,sizeof(*ssbresset00));
+ *ssbresset00=0;
+ ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset00);
+ if (n_physical_antenna_ports > 1) {
+   NR_SSB_Index_t *ssbresset01=calloc(1,sizeof(*ssbresset01));
+   *ssbresset01=1;
+   ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset01);
+ }
+ if (n_physical_antenna_ports > 3) {
+   NR_SSB_Index_t *ssbresset02=calloc(1,sizeof(*ssbresset02));
+   *ssbresset02=2;
+   ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset02);
+   NR_SSB_Index_t *ssbresset03=calloc(1,sizeof(*ssbresset03));
+   *ssbresset03=3;
+   ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset03);
+ }
+ if (n_physical_antenna_ports > 7) {
+   NR_SSB_Index_t *ssbresset04=calloc(1,sizeof(*ssbresset04));
+   *ssbresset04=4;
+   ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset04);
+   NR_SSB_Index_t *ssbresset05=calloc(1,sizeof(*ssbresset05));
+   *ssbresset05=5;
+   ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset05);
+   NR_SSB_Index_t *ssbresset06=calloc(1,sizeof(*ssbresset06));
+   *ssbresset06=6;
+   ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset06);
+   NR_SSB_Index_t *ssbresset07=calloc(1,sizeof(*ssbresset07));
+   *ssbresset07=7;
+   ASN_SEQUENCE_ADD(&ssbresset0->csi_SSB_ResourceList.list,ssbresset07);
+ }
+ ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list,ssbresset0);
+
+ csi_MeasConfig->csi_ResourceConfigToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_ResourceConfigToAddModList));
+ csi_MeasConfig->csi_ResourceConfigToReleaseList = NULL;
+ NR_CSI_ResourceConfig_t *csires0 = calloc(1,sizeof(*csires0));
+ csires0->csi_ResourceConfigId=0;
+ csires0->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB;
+ csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB = calloc(1,sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB));
+ csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList = calloc(1,sizeof(*csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList));
+ csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList = NULL;
+ NR_NZP_CSI_RS_ResourceSetId_t *csires00 = calloc(1,sizeof(*csires00));
+ *csires00 = 0;
+ ASN_SEQUENCE_ADD(&csires0->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list,csires00);
+ csires0->bwp_Id = 1;
+ csires0->resourceType = NR_CSI_ResourceConfig__resourceType_periodic;
+ ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ResourceConfigToAddModList->list,csires0);
+
+ NR_CSI_ResourceConfig_t *csires11 = calloc(1,sizeof(*csires11));
+ csires11->csi_ResourceConfigId=11;
+ csires11->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_csi_IM_ResourceSetList;
+ csires11->csi_RS_ResourceSetList.choice.csi_IM_ResourceSetList = calloc(1,sizeof(*csires11->csi_RS_ResourceSetList.choice.csi_IM_ResourceSetList));
+ NR_NZP_CSI_RS_ResourceSetId_t *csires110 = calloc(1,sizeof(*csires110));
+ *csires110 = 0;
+ ASN_SEQUENCE_ADD(&csires11->csi_RS_ResourceSetList.choice.csi_IM_ResourceSetList->list,csires110);
+ csires11->bwp_Id = 1;
+ csires11->resourceType = NR_CSI_ResourceConfig__resourceType_periodic;
+ ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ResourceConfigToAddModList->list,csires11);
+
+ NR_CSI_ResourceConfig_t *csires10 = calloc(1,sizeof(*csires10));
+ csires10->csi_ResourceConfigId=10;
+ csires10->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB;
+ csires10->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB = calloc(1,sizeof(*csires10->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB));
+ csires10->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList = calloc(1,sizeof(*csires10->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList));
+ csires10->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList = NULL;
+ NR_NZP_CSI_RS_ResourceSetId_t *csires100 = calloc(1,sizeof(*csires100));
+ *csires100 = 0;
+ ASN_SEQUENCE_ADD(&csires10->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list,csires100);
+ csires10->bwp_Id = 1;
+ csires10->resourceType = NR_CSI_ResourceConfig__resourceType_periodic;
+ ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ResourceConfigToAddModList->list,csires10);
+
+ NR_CSI_ResourceConfig_t *csires2 = calloc(1,sizeof(*csires2));
+ csires2->csi_ResourceConfigId=2;
+ csires2->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB;
+ csires2->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB = calloc(1,sizeof(*csires2->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB));
+ csires2->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList = calloc(1,sizeof(*csires2->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList));
+ csires2->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList = NULL;
+ NR_NZP_CSI_RS_ResourceSetId_t *csires20 = calloc(1,sizeof(*csires20));
+ *csires20 = 0;
+ ASN_SEQUENCE_ADD(&csires2->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list,csires20);
+ csires2->bwp_Id = 1;
+ csires2->resourceType = NR_CSI_ResourceConfig__resourceType_periodic;
+ ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ResourceConfigToAddModList->list,csires2);
+
+ NR_CSI_ResourceConfig_t *csires3 = calloc(1,sizeof(*csires3));
+ csires3->csi_ResourceConfigId=3;
+ csires3->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB;
+ csires3->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB = calloc(1,sizeof(*csires3->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB));
+ csires3->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList = calloc(1,sizeof(*csires3->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList));
+ csires3->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList = NULL;
+ NR_NZP_CSI_RS_ResourceSetId_t *csires30 = calloc(1,sizeof(*csires30));
+ *csires30 = 0;
+ ASN_SEQUENCE_ADD(&csires3->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list,csires30);
+ csires3->bwp_Id = 1;
+ csires3->resourceType = NR_CSI_ResourceConfig__resourceType_periodic;
+ ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ResourceConfigToAddModList->list,csires3);
+
+ NR_CSI_ResourceConfig_t *csires4 = calloc(1,sizeof(*csires4));
+ csires4->csi_ResourceConfigId=4;
+ csires4->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB;
+ csires4->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB = calloc(1,sizeof(*csires4->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB));
+ csires4->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList = calloc(1,sizeof(*csires4->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList));
+ csires4->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList = NULL;
+ NR_NZP_CSI_RS_ResourceSetId_t *csires40 = calloc(1,sizeof(*csires40));
+ *csires40 = 0;
+ ASN_SEQUENCE_ADD(&csires4->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list,csires40);
+ csires4->bwp_Id = 1;
+ csires4->resourceType = NR_CSI_ResourceConfig__resourceType_periodic;
+ ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ResourceConfigToAddModList->list,csires4);
+
+ NR_CSI_ResourceConfig_t *csires5 = calloc(1,sizeof(*csires5));
+ csires5->csi_ResourceConfigId=5;
+ csires5->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB;
+ csires5->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB = calloc(1,sizeof(*csires5->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB));
+ csires5->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList = calloc(1,sizeof(*csires5->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList));
+ csires5->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList = NULL;
+ NR_NZP_CSI_RS_ResourceSetId_t *csires50 = calloc(1,sizeof(*csires50));
+ *csires50 = 0;
+ ASN_SEQUENCE_ADD(&csires5->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list,csires50);
+ csires5->bwp_Id = 1;
+ csires5->resourceType = NR_CSI_ResourceConfig__resourceType_periodic;
+ ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ResourceConfigToAddModList->list,csires5);
+
+ NR_CSI_ResourceConfig_t *csires6 = calloc(1,sizeof(*csires6));
+ csires6->csi_ResourceConfigId=6;
+ csires6->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB;
+ csires6->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB = calloc(1,sizeof(*csires6->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB));
+ csires6->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList = calloc(1,sizeof(*csires6->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList));
+ csires6->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList = NULL;
+ NR_NZP_CSI_RS_ResourceSetId_t *csires60 = calloc(1,sizeof(*csires60));
+ *csires60 = 0;
+ ASN_SEQUENCE_ADD(&csires6->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list,csires60);
+ csires6->bwp_Id = 1;
+ csires6->resourceType = NR_CSI_ResourceConfig__resourceType_periodic;
+ ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ResourceConfigToAddModList->list,csires6);
+
+ NR_CSI_ResourceConfig_t *csires7 = calloc(1,sizeof(*csires7));
+ csires7->csi_ResourceConfigId=7;
+ csires7->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB;
+ csires7->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB = calloc(1,sizeof(*csires7->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB));
+ csires7->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList = calloc(1,sizeof(*csires7->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList));
+ csires7->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList = NULL;
+ NR_NZP_CSI_RS_ResourceSetId_t *csires70 = calloc(1,sizeof(*csires70));
+ *csires70 = 0;
+ ASN_SEQUENCE_ADD(&csires7->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list,csires70);
+ csires7->bwp_Id = 1;
+ csires7->resourceType = NR_CSI_ResourceConfig__resourceType_periodic;
+ ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ResourceConfigToAddModList->list,csires7);
+
+ NR_CSI_ResourceConfig_t *csires8 = calloc(1,sizeof(*csires8));
+ csires8->csi_ResourceConfigId=8;
+ csires8->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB;
+ csires8->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB = calloc(1,sizeof(*csires8->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB));
+ csires8->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList = calloc(1,sizeof(*csires8->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList));
+ csires8->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList = NULL;
+ NR_NZP_CSI_RS_ResourceSetId_t *csires80 = calloc(1,sizeof(*csires80));
+ *csires80 = 0;
+ ASN_SEQUENCE_ADD(&csires8->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list,csires80);
+ csires8->bwp_Id = 1;
+ csires8->resourceType = NR_CSI_ResourceConfig__resourceType_periodic;
+ ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ResourceConfigToAddModList->list,csires8);
+
+ NR_CSI_ResourceConfig_t *csires9 = calloc(1,sizeof(*csires9));
+ csires9->csi_ResourceConfigId=9;
+ csires9->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB;
+ csires9->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB = calloc(1,sizeof(*csires9->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB));
+ csires9->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList = calloc(1,sizeof(*csires9->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList));
+ csires9->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList = NULL;
+ NR_NZP_CSI_RS_ResourceSetId_t *csires90 = calloc(1,sizeof(*csires90));
+ *csires90 = 0;
+ ASN_SEQUENCE_ADD(&csires9->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList->list,csires90);
+ csires9->bwp_Id = 1; 
+ csires9->resourceType = NR_CSI_ResourceConfig__resourceType_periodic;
+ ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ResourceConfigToAddModList->list,csires9);
+
+ csi_MeasConfig->csi_ReportConfigToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_ReportConfigToAddModList));
+ csi_MeasConfig->csi_ReportConfigToReleaseList = NULL;
+ NR_CSI_ReportConfig_t *csirep0 = calloc(1,sizeof(*csirep0));
+ csirep0->reportConfigId=0;
+ csirep0->carrier=NULL;
+ csirep0->resourcesForChannelMeasurement=0;
+ csirep0->csi_IM_ResourcesForInterference=calloc(1,sizeof(*csirep0->csi_IM_ResourcesForInterference));
+ *csirep0->csi_IM_ResourcesForInterference=11;
+ csirep0->nzp_CSI_RS_ResourcesForInterference=NULL;
+ csirep0->reportConfigType.present = NR_CSI_ReportConfig__reportConfigType_PR_periodic;
+ csirep0->reportConfigType.choice.periodic = calloc(1,sizeof(*csirep0->reportConfigType.choice.periodic));
+ csirep0->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots320;
+ csirep0->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = 9;
+
+ NR_PUCCH_CSI_Resource_t *pucchcsires0 = calloc(1,sizeof(*pucchcsires0));
+ pucchcsires0->uplinkBandwidthPartId=1;
+ pucchcsires0->pucch_Resource=11;
+ ASN_SEQUENCE_ADD(&csirep0->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires0);
+ csirep0->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_LI_PMI_CQI;
+ csirep0->reportQuantity.choice.cri_RI_PMI_CQI = (NULL_t)0;
+ csirep0->reportFreqConfiguration = calloc(1,sizeof(*csirep0->reportFreqConfiguration));
+ csirep0->reportFreqConfiguration->cqi_FormatIndicator=NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI;
+ csirep0->reportFreqConfiguration->pmi_FormatIndicator=NR_CSI_ReportConfig__reportFreqConfiguration__pmi_FormatIndicator_widebandPMI;
+ csirep0->reportFreqConfiguration->csi_ReportingBand=calloc(1,sizeof(*csirep0->reportFreqConfiguration->csi_ReportingBand));
+ 
+ 
+ AssertFatal(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id>0,"firstActiveDownlinkBWP_Id %d\n",(int)*secondaryCellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id);
+ int NPRB  = NRRIV2BW(secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[*secondaryCellGroup->spCellConfig->spCellConfigDedicated->firstActiveDownlinkBWP_Id-1]->bwp_Common->genericParameters.locationAndBandwidth,275);
+ int sbsize = get_subband_size(NPRB,0);
+ int numsb = NPRB/sbsize;
+ if (NPRB%sbsize == 0) numsb++;
+ csirep0->reportFreqConfiguration->csi_ReportingBand->present= 	NR_CSI_ReportConfig__reportFreqConfiguration__csi_ReportingBand_PR_NOTHING+(numsb-2);
+ csirep0->reportFreqConfiguration->csi_ReportingBand->choice.subbands18.size=numsb/8;
+ if ((numsb&7) > 0) csirep0->reportFreqConfiguration->csi_ReportingBand->choice.subbands18.size++;
+ csirep0->reportFreqConfiguration->csi_ReportingBand->choice.subbands18.bits_unused = (8-(numsb&7))&7;
+ csirep0->reportFreqConfiguration->csi_ReportingBand->choice.subbands18.buf=malloc(csirep0->reportFreqConfiguration->csi_ReportingBand->choice.subbands18.size);
+ for (int i=0;i<csirep0->reportFreqConfiguration->csi_ReportingBand->choice.subbands18.size;i++) 
+   csirep0->reportFreqConfiguration->csi_ReportingBand->choice.subbands18.buf[i]=0xff;
+ csirep0->reportFreqConfiguration->csi_ReportingBand->choice.subbands18.buf[csirep0->reportFreqConfiguration->csi_ReportingBand->choice.subbands18.size-1]&=~((1<<csirep0->reportFreqConfiguration->csi_ReportingBand->choice.subbands18.bits_unused)-1);
+
+ csirep0->timeRestrictionForChannelMeasurements= NR_CSI_ReportConfig__timeRestrictionForChannelMeasurements_configured;
+ csirep0->timeRestrictionForInterferenceMeasurements=NR_CSI_ReportConfig__timeRestrictionForInterferenceMeasurements_configured;
+ csirep0->codebookConfig=calloc(1,sizeof(*csirep0->codebookConfig));
+ csirep0->codebookConfig->codebookType.present = NR_CodebookConfig__codebookType_PR_type1;
+ csirep0->codebookConfig->codebookType.choice.type1 = calloc(1,sizeof(*csirep0->codebookConfig->codebookType.choice.type1));
+ csirep0->codebookConfig->codebookType.choice.type1->subType.present = NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel; 
+ csirep0->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel=calloc(1,sizeof(*csirep0->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel));
+ csirep0->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present=NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two;
+ csirep0->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two=
+   calloc(1,sizeof(*csirep0->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two));
+ csirep0->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.size=1;
+ csirep0->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.bits_unused=2;
+ csirep0->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.buf=malloc(1);
+ csirep0->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.buf[0]=0xfc;
+ //'111111'B
+
+
+ csirep0->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.size=1; 
+ csirep0->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.bits_unused=0;
+ csirep0->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf=malloc(1); 
+ csirep0->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]=0xc0; //'00000011'B
+
+ csirep0->codebookConfig->codebookType.choice.type1->codebookMode=1;
+ csirep0->dummy = NULL;
+ csirep0->groupBasedBeamReporting.present = NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled;
+ csirep0->groupBasedBeamReporting.choice.disabled=calloc(1,sizeof(*csirep0->groupBasedBeamReporting.choice.disabled));
+ csirep0->groupBasedBeamReporting.choice.disabled->nrofReportedRS = NULL;
+ csirep0->cqi_Table = calloc(1,sizeof(*csirep0->cqi_Table));
+ *csirep0->cqi_Table = NR_CSI_ReportConfig__cqi_Table_table1;
+ csirep0->subbandSize = NR_CSI_ReportConfig__subbandSize_value1;
+ csirep0->non_PMI_PortIndication = NULL;
+ csirep0->ext1 = NULL;
+
+ ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ReportConfigToAddModList->list,csirep0);
+
+ NR_CSI_ReportConfig_t *csirep1 = calloc(1,sizeof(*csirep1));
+ csirep1->reportConfigId=2;
+ csirep1->carrier=NULL;
+ csirep1->resourcesForChannelMeasurement=initial_csi_index;
+ csirep1->csi_IM_ResourcesForInterference=NULL;
+ csirep1->nzp_CSI_RS_ResourcesForInterference=NULL;
+ csirep1->reportConfigType.present = NR_CSI_ReportConfig__reportConfigType_PR_periodic;
+ csirep1->reportConfigType.choice.periodic = calloc(1,sizeof(*csirep1->reportConfigType.choice.periodic));
+ csirep1->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots320;
+ csirep1->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = 49;
+ NR_PUCCH_CSI_Resource_t *pucchcsires1 = calloc(1,sizeof(*pucchcsires1));
+ pucchcsires1->uplinkBandwidthPartId=1;
+ pucchcsires1->pucch_Resource=12;
+ ASN_SEQUENCE_ADD(&csirep1->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires1);
+ csirep1->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP;
+ csirep1->reportQuantity.choice.ssb_Index_RSRP=(NULL_t)0;
+ csirep1->reportFreqConfiguration = calloc(1,sizeof(*csirep1->reportFreqConfiguration));
+ csirep1->reportFreqConfiguration->cqi_FormatIndicator=NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI;
+ csirep1->reportFreqConfiguration->pmi_FormatIndicator=NR_CSI_ReportConfig__reportFreqConfiguration__pmi_FormatIndicator_widebandPMI;
+ csirep1->reportFreqConfiguration->csi_ReportingBand=NULL;
+ csirep1->timeRestrictionForChannelMeasurements= NR_CSI_ReportConfig__timeRestrictionForChannelMeasurements_configured;
+ csirep1->timeRestrictionForInterferenceMeasurements=NR_CSI_ReportConfig__timeRestrictionForInterferenceMeasurements_configured;
+ csirep1->codebookConfig=calloc(1,sizeof(*csirep1->codebookConfig));
+ csirep1->codebookConfig->codebookType.present = NR_CodebookConfig__codebookType_PR_type1;
+ csirep1->codebookConfig->codebookType.choice.type1 = calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1));
+ csirep1->codebookConfig->codebookType.choice.type1->subType.present=NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel;
+ csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel=calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel));
+ csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.present=NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two;
+ csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two=
+   calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two));
+ csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.size=1;
+ csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.bits_unused=2;
+ csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.buf=malloc(1);
+ csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.buf[0]=0xfc;
+ //'111111'B
+
+
+ csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.size=1; 
+ csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.bits_unused=0;
+ csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf=malloc(1); 
+ csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel->typeI_SinglePanel_ri_Restriction.buf[0]=0xc0; //'00000011'B
+
+ csirep1->codebookConfig->codebookType.choice.type1->codebookMode=1;
+ csirep1->dummy = NULL;
+ csirep1->groupBasedBeamReporting.present = NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled;
+ csirep1->groupBasedBeamReporting.choice.disabled=calloc(1,sizeof(*csirep1->groupBasedBeamReporting.choice.disabled));
+ csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS = calloc(1,sizeof(*csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS));
+ *csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS=NR_CSI_ReportConfig__groupBasedBeamReporting__disabled__nrofReportedRS_n2;
+ // this corresponds to:
+ //if the UE is configured with the higher layer parameter groupBasedBeamReporting set to 'disabled', the UE is not required to update measurements for more than 64 CSI-RS and/or SSB resources, and the UE shall report in a single report nrofReportedRS (higher layer configured) different CRI or SSBRI for each report setting. 
+
+ csirep1->cqi_Table = calloc(1,sizeof(*csirep1->cqi_Table));
+ *csirep1->cqi_Table = NR_CSI_ReportConfig__cqi_Table_table1;
+ csirep1->subbandSize = NR_CSI_ReportConfig__subbandSize_value1;
+ csirep1->non_PMI_PortIndication = NULL;
+ csirep1->ext1 = NULL;
+
+ ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ReportConfigToAddModList->list,csirep1);
+
+
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->sCellDeactivationTimer=NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->crossCarrierSchedulingConfig=NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->tag_Id=0;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->dummy=NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->pathlossReferenceLinking=NULL;
+ secondaryCellGroup->spCellConfig->spCellConfigDedicated->servingCellMO=NULL;
+
+}
+void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon,
+			   NR_RRCReconfiguration_IEs_t *reconfig,
+			   NR_CellGroupConfig_t *secondaryCellGroup,
+			   int n_physical_antenna_ports,
+			   int initial_csi_index) {
+
+  AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n");
+  AssertFatal(reconfig!=NULL,"reconfig is null\n");
+  AssertFatal(secondaryCellGroup!=NULL,"secondaryCellGroup is null\n");
+
+  // radioBearerConfig
+  reconfig->radioBearerConfig=NULL;
+  // secondaryCellGroup
+  fill_default_secondaryCellGroup(servingcellconfigcommon,secondaryCellGroup,0,0,n_physical_antenna_ports,initial_csi_index);
+  xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)secondaryCellGroup);
+
+  char scg_buffer[1024];
+  asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, NULL, (void *)secondaryCellGroup, scg_buffer, 1024);
+  AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n", enc_rval.failed_type->name, enc_rval.encoded);
+  
+ 
+  reconfig->secondaryCellGroup = calloc(1,sizeof(*reconfig->secondaryCellGroup));
+  OCTET_STRING_fromBuf(reconfig->secondaryCellGroup,
+		       (const char*)scg_buffer,
+		       (enc_rval.encoded+7)>>3);
+  // measConfig
+  reconfig->measConfig=NULL;
+  // lateNonCriticalExtension
+  reconfig->lateNonCriticalExtension = NULL;
+  // nonCriticalExtension
+  reconfig->nonCriticalExtension = NULL;
+}
+
+void fill_default_rbconfig(NR_RadioBearerConfig_t *rbconfig) {
+
+  rbconfig->srb_ToAddModList = NULL;
+  rbconfig->srb3_ToRelease = NULL;
+  rbconfig->drb_ToAddModList = calloc(1,sizeof(*rbconfig->drb_ToAddModList));
+  NR_DRB_ToAddMod_t *drb_ToAddMod = calloc(1,sizeof(*drb_ToAddMod));
+  drb_ToAddMod->cnAssociation = calloc(1,sizeof(*drb_ToAddMod->cnAssociation));
+  drb_ToAddMod->cnAssociation->present = NR_DRB_ToAddMod__cnAssociation_PR_eps_BearerIdentity;
+  drb_ToAddMod->cnAssociation->choice.eps_BearerIdentity=5;
+  drb_ToAddMod->drb_Identity = 1;
+  drb_ToAddMod->reestablishPDCP = NULL;
+  drb_ToAddMod->recoverPDCP = NULL;
+  drb_ToAddMod->pdcp_Config = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config));
+  drb_ToAddMod->pdcp_Config->drb = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb));
+  drb_ToAddMod->pdcp_Config->drb->discardTimer = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->discardTimer));
+  *drb_ToAddMod->pdcp_Config->drb->discardTimer=NR_PDCP_Config__drb__discardTimer_ms30;
+  drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL));
+  *drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeUL = NR_PDCP_Config__drb__pdcp_SN_SizeUL_len18bits;
+  drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeDL = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeDL));
+  *drb_ToAddMod->pdcp_Config->drb->pdcp_SN_SizeDL = NR_PDCP_Config__drb__pdcp_SN_SizeDL_len18bits;
+  drb_ToAddMod->pdcp_Config->drb->headerCompression.present = NR_PDCP_Config__drb__headerCompression_PR_notUsed;
+  drb_ToAddMod->pdcp_Config->drb->headerCompression.choice.notUsed = 0;
+
+  drb_ToAddMod->pdcp_Config->drb->integrityProtection=NULL;	
+  drb_ToAddMod->pdcp_Config->drb->statusReportRequired=NULL;	
+  drb_ToAddMod->pdcp_Config->drb->outOfOrderDelivery=NULL;
+  drb_ToAddMod->pdcp_Config->moreThanOneRLC = NULL;
+
+  drb_ToAddMod->pdcp_Config->t_Reordering = calloc(1,sizeof(*drb_ToAddMod->pdcp_Config->t_Reordering));
+  *drb_ToAddMod->pdcp_Config->t_Reordering = NR_PDCP_Config__t_Reordering_ms0;
+  drb_ToAddMod->pdcp_Config->ext1 = NULL;
+  
+  ASN_SEQUENCE_ADD(&rbconfig->drb_ToAddModList->list,drb_ToAddMod);
+
+  rbconfig->drb_ToReleaseList = NULL;
+
+  rbconfig->securityConfig = calloc(1,sizeof(*rbconfig->securityConfig));
+  rbconfig->securityConfig->securityAlgorithmConfig = calloc(1,sizeof(*rbconfig->securityConfig->securityAlgorithmConfig));
+  rbconfig->securityConfig->securityAlgorithmConfig->cipheringAlgorithm = NR_CipheringAlgorithm_nea0;
+  rbconfig->securityConfig->securityAlgorithmConfig->integrityProtAlgorithm=NULL;
+  rbconfig->securityConfig->keyToUse = calloc(1,sizeof(*rbconfig->securityConfig->keyToUse));
+  *rbconfig->securityConfig->keyToUse = NR_SecurityConfig__keyToUse_master;
+
+  xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void*)rbconfig);
+}
+#endif
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.master.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.master.conf
new file mode 100644
index 00000000000..c0decd362f9
--- /dev/null
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.master.conf
@@ -0,0 +1,298 @@
+Active_eNBs = ( "eNB-Eurecom-LTEBox");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+eNBs =
+(
+ {
+    ////////// Identification parameters:
+    eNB_ID    =  0xe01;
+
+    cell_type =  "CELL_MACRO_ENB";
+
+    eNB_name  =  "eNB-Eurecom-LTEBox";
+
+    // Tracking area code, 0x0000 and 0xfffe are reserved values
+    tracking_area_code  =  1;
+
+    plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2; } );
+
+    tr_s_preference     = "local_mac"
+
+    ////////// Physical parameters:
+
+    component_carriers = (
+      {
+      node_function             = "3GPP_eNODEB";
+      node_timing               = "synch_to_ext_device";
+      node_synch_ref            = 0;
+      frame_type					      = "FDD";
+      tdd_config 					      = 3;
+      tdd_config_s            			      = 0;
+      prefix_type             			      = "NORMAL";
+      eutra_band              			      = 7;
+      downlink_frequency      			      = 2685000000L;
+      uplink_frequency_offset 			      = -120000000;
+      Nid_cell					      = 1;
+      N_RB_DL                 			      = 50;
+      Nid_cell_mbsfn          			      = 0;
+      nb_antenna_ports                                = 1;
+      nb_antennas_tx          			      = 1;
+      nb_antennas_rx          			      = 1;
+      tx_gain                                            = 90;
+      rx_gain                                            = 125;
+      pbch_repetition                                 = "FALSE";
+      prach_root              			      = 0;
+      prach_config_index      			      = 0;
+      prach_high_speed        			      = "DISABLE";
+      prach_zero_correlation  			      = 1;
+      prach_freq_offset       			      = 2;
+      pucch_delta_shift       			      = 1;
+      pucch_nRB_CQI           			      = 0;
+      pucch_nCS_AN            			      = 0;
+      pucch_n1_AN             			      = 0;
+      pdsch_referenceSignalPower 			      = -27;
+      pdsch_p_b                  			      = 0;
+      pusch_n_SB                 			      = 1;
+      pusch_enable64QAM          			      = "DISABLE";
+      pusch_hoppingMode                                  = "interSubFrame";
+      pusch_hoppingOffset                                = 0;
+      pusch_groupHoppingEnabled  			      = "ENABLE";
+      pusch_groupAssignment      			      = 0;
+      pusch_sequenceHoppingEnabled		   	      = "DISABLE";
+      pusch_nDMRS1                                       = 1;
+      phich_duration                                     = "NORMAL";
+      phich_resource                                     = "ONESIXTH";
+      srs_enable                                         = "DISABLE";
+      /*  srs_BandwidthConfig                                =;
+      srs_SubframeConfig                                 =;
+      srs_ackNackST                                      =;
+      srs_MaxUpPts                                       =;*/
+
+      pusch_p0_Nominal                                   = -96;
+      pusch_alpha                                        = "AL1";
+      pucch_p0_Nominal                                   = -104;
+      msg3_delta_Preamble                                = 6;
+      pucch_deltaF_Format1                               = "deltaF2";
+      pucch_deltaF_Format1b                              = "deltaF3";
+      pucch_deltaF_Format2                               = "deltaF0";
+      pucch_deltaF_Format2a                              = "deltaF0";
+      pucch_deltaF_Format2b		    	      = "deltaF0";
+
+      rach_numberOfRA_Preambles                          = 64;
+      rach_preamblesGroupAConfig                         = "DISABLE";
+      /*
+      rach_sizeOfRA_PreamblesGroupA                      = ;
+      rach_messageSizeGroupA                             = ;
+      rach_messagePowerOffsetGroupB                      = ;
+      */
+      rach_powerRampingStep                              = 4;
+      rach_preambleInitialReceivedTargetPower            = -108;
+      rach_preambleTransMax                              = 10;
+      rach_raResponseWindowSize                          = 10;
+      rach_macContentionResolutionTimer                  = 48;
+      rach_maxHARQ_Msg3Tx                                = 4;
+
+      pcch_default_PagingCycle                           = 128;
+      pcch_nB                                            = "oneT";
+      bcch_modificationPeriodCoeff			      = 2;
+      ue_TimersAndConstants_t300			      = 1000;
+      ue_TimersAndConstants_t301			      = 1000;
+      ue_TimersAndConstants_t310			      = 1000;
+      ue_TimersAndConstants_t311			      = 10000;
+      ue_TimersAndConstants_n310			      = 20;
+      ue_TimersAndConstants_n311			      = 1;
+      ue_TransmissionMode                                    = 1;
+
+      //Parameters for SIB18
+      rxPool_sc_CP_Len                                       = "normal";
+      rxPool_sc_Period                                       = "sf40";
+      rxPool_data_CP_Len                                     = "normal";
+      rxPool_ResourceConfig_prb_Num                          = 20;
+      rxPool_ResourceConfig_prb_Start                        = 5;
+      rxPool_ResourceConfig_prb_End                          = 44;
+      rxPool_ResourceConfig_offsetIndicator_present          = "prSmall";
+      rxPool_ResourceConfig_offsetIndicator_choice           = 0;
+      rxPool_ResourceConfig_subframeBitmap_present           = "prBs40";
+      rxPool_ResourceConfig_subframeBitmap_choice_bs_buf              = "00000000000000000000";
+      rxPool_ResourceConfig_subframeBitmap_choice_bs_size             = 5;
+      rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused      = 0;
+/*    rxPool_dataHoppingConfig_hoppingParameter                       = 0;
+      rxPool_dataHoppingConfig_numSubbands                            = "ns1";
+      rxPool_dataHoppingConfig_rbOffset                               = 0;
+      rxPool_commTxResourceUC-ReqAllowed                              = "TRUE";
+*/
+      // Parameters for SIB19
+      discRxPool_cp_Len                                               = "normal"
+      discRxPool_discPeriod                                           = "rf32"
+      discRxPool_numRetx                                              = 1;
+      discRxPool_numRepetition                                        = 2;
+      discRxPool_ResourceConfig_prb_Num                               = 5;
+      discRxPool_ResourceConfig_prb_Start                             = 3;
+      discRxPool_ResourceConfig_prb_End                               = 21;
+      discRxPool_ResourceConfig_offsetIndicator_present               = "prSmall";
+      discRxPool_ResourceConfig_offsetIndicator_choice                = 0;
+      discRxPool_ResourceConfig_subframeBitmap_present                = "prBs40";
+      discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf          = "f0ffffffff";
+      discRxPool_ResourceConfig_subframeBitmap_choice_bs_size         = 5;
+      discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused  = 0;
+
+      }
+    );
+
+
+    srb1_parameters :
+    {
+        # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500]
+        timer_poll_retransmit    = 80;
+
+        # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200]
+        timer_reordering         = 35;
+
+        # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500]
+        timer_status_prohibit    = 0;
+
+        # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)]
+        poll_pdu                 =  4;
+
+        # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)]
+        poll_byte                =  99999;
+
+        # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32]
+        max_retx_threshold       =  4;
+    }
+
+    # ------- SCTP definitions
+    SCTP :
+    {
+        # Number of streams to use in input/output
+        SCTP_INSTREAMS  = 2;
+        SCTP_OUTSTREAMS = 2;
+    };
+
+
+    ////////// MME parameters:
+    mme_ip_address      = ( { ipv4       = "192.168.12.26";
+                              ipv6       = "192:168:30::17";
+                              active     = "yes";
+                              preference = "ipv4";
+                            }
+                          );
+
+    ///X2
+    enable_x2 = "yes";
+    t_reloc_prep      = 1000;      /* unit: millisecond */
+    tx2_reloc_overall = 2000;      /* unit: millisecond */
+
+    NETWORK_INTERFACES :
+    {
+        ENB_INTERFACE_NAME_FOR_S1_MME            = "enp0s31f6";
+        ENB_IPV4_ADDRESS_FOR_S1_MME              = "192.168.12.188/23";
+        ENB_INTERFACE_NAME_FOR_S1U               = "enp0s31f6";
+        ENB_IPV4_ADDRESS_FOR_S1U                 = "192.168.12.188/23";
+        ENB_PORT_FOR_S1U                         = 2152; # Spec 2152
+
+        ENB_IPV4_ADDRESS_FOR_X2C                 = "192.168.12.188/23";
+        ENB_PORT_FOR_X2C                         = 36422; # Spec 36422
+    }; 
+    
+  }
+);
+
+DU = (
+    {
+	DU_INTERFACE_NAME_FOR_F1U           = "lo";
+	DU_IPV4_ADDRESS_FOR_F1U             = "127.0.0.1/16";
+	DU_PORT_FOR_F1U                     = 22100;
+	F1_U_DU_TRANSPORT_TYPE		    = "TCP";
+    }
+    );
+    
+CU = (
+    {     
+        CU_INTERFACE_NAME_FOR_F1U           = "lo";
+        CU_IPV4_ADDRESS_FOR_F1U             = "127.0.0.1";   //Address to search the DU
+        CU_PORT_FOR_F1U                     = 22100;
+        F1_U_CU_TRANSPORT_TYPE              = "TCP";	     // One of TCP/UDP/SCTP
+        DU_TYPE 			    = "LTE";
+    }//,
+//    {     
+//        CU_INTERFACE_NAME_FOR_F1U           = "eth0";
+//        CU_IPV4_ADDRESS_FOR_F1U             = "10.64.93.142";   //Address to search the DU
+//        CU_PORT_FOR_F1U                     = 2211;
+//        F1_U_CU_TRANSPORT_TYPE              = "TCP";          // One of TCP/UDP/SCTP
+//        DU_TYPE 			    = "WiFi";
+//    }
+    );
+
+    CU_BALANCING = "ALL";
+
+MACRLCs = (
+	{
+	num_cc = 1;
+	tr_s_preference = "local_L1";
+	tr_n_preference = "local_RRC";
+	phy_test_mode = 0;
+        puSch10xSnr     =  200;
+        puCch10xSnr     =  200;
+        }  
+);
+
+L1s = (
+    	{
+	num_cc = 1;
+	tr_n_preference = "local_mac";
+        }  
+);
+
+RUs = (
+    {		  
+       local_rf       = "yes"
+         nb_tx          = 1
+         nb_rx          = 1
+         att_tx         = 0
+         att_rx         = 0;
+         bands          = [7];
+         max_pdschReferenceSignalPower = -27;
+         max_rxgain                    = 125;
+         eNB_instances  = [0];
+
+    }
+);  
+
+NETWORK_CONTROLLER :
+{
+    FLEXRAN_ENABLED        = "no";
+    FLEXRAN_INTERFACE_NAME = "lo";
+    FLEXRAN_IPV4_ADDRESS   = "127.0.0.1";
+    FLEXRAN_PORT           = 2210;
+    FLEXRAN_CACHE          = "/mnt/oai_agent_cache";
+    FLEXRAN_AWAIT_RECONF   = "no";
+};
+
+THREAD_STRUCT = (
+  {
+    #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
+    parallel_config    = "PARALLEL_SINGLE_THREAD";
+    #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
+    worker_config      = "WORKER_ENABLE";
+  }
+);
+
+     log_config :
+     {
+       global_log_level                      ="info";
+       global_log_verbosity                  ="medium";
+       hw_log_level                          ="info";
+       hw_log_verbosity                      ="medium";
+       phy_log_level                         ="info";
+       phy_log_verbosity                     ="medium";
+       mac_log_level                         ="info";
+       mac_log_verbosity                     ="high";
+       rlc_log_level                         ="info";
+       rlc_log_verbosity                     ="medium";
+       pdcp_log_level                        ="info";
+       pdcp_log_verbosity                    ="medium";
+       rrc_log_level                         ="info";
+       rrc_log_verbosity                     ="medium";
+    };
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf
new file mode 100644
index 00000000000..1363be3bce6
--- /dev/null
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.32PRB.usrpx300.conf
@@ -0,0 +1,271 @@
+Active_gNBs = ( "gNB-Eurecom-5GNRBox");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+gNBs =
+(
+ {
+    ////////// Identification parameters:
+    gNB_ID    =  0xe00;
+
+    cell_type =  "CELL_MACRO_GNB";
+
+    gNB_name  =  "gNB-Eurecom-5GNRBox";
+
+    // Tracking area code, 0x0000 and 0xfffe are reserved values
+    tracking_area_code  =  1;
+
+    plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;});	 
+
+    tr_s_preference     = "local_mac"
+
+    ////////// Physical parameters:
+
+    ssb_SubcarrierOffset                                      = 0;
+    pdsch_AntennaPorts                                        = 1;
+	
+    servingCellConfigCommon = (
+    {
+ #spCellConfigCommon
+
+      physCellId                                                    = 0;
+
+#  downlinkConfigCommon
+    #frequencyInfoDL
+      # this is pointA + 23 PRBs@120kHz SCS (same as initial BWP)
+      absoluteFrequencySSB                                          = 2077907;
+      dl_frequencyBand                                                 = 257;
+      # this is 27.900 GHz
+      dl_absoluteFrequencyPointA                                       = 2077499;
+      #scs-SpecificCarrierList
+        dl_offstToCarrier                                              = 0;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+        dl_subcarrierSpacing                                           = 3;
+        dl_carrierBandwidth                                            = 32;
+     #initialDownlinkBWP
+      #genericParameters
+        # this is RBstart=0,L=50 (275*(L-1))+RBstart
+        initialDLBWPlocationAndBandwidth                                        = 8525;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+        initialDLBWPsubcarrierSpacing                                           = 3;
+      #pdcch-ConfigCommon
+        initialDLBWPcontrolResourceSetZero                                      = 12;
+        initialDLBWPsearchSpaceZero                                             = 0;
+      #pdsch-ConfigCommon
+        #pdschTimeDomainAllocationList (up to 16 entries)
+             initialDLBWPk0_0                    = 0;
+             #initialULBWPmappingType
+	     #0=typeA,1=typeB
+             initialDLBWPmappingType_0           = 0;
+             #this is SS=2,L=3
+             initialDLBWPstartSymbolAndLength_0  = 40;
+
+             initialDLBWPk0_1                    = 0;
+             initialDLBWPmappingType_1           = 0;
+             #this is SS=2,L=12 
+             initialDLBWPstartSymbolAndLength_1  = 53;
+
+             initialDLBWPk0_2                    = 0;
+             initialDLBWPmappingType_2           = 0;
+             #this is SS=1,L=12 
+             initialDLBWPstartSymbolAndLength_2  = 54;
+  #uplinkConfigCommon 
+     #frequencyInfoUL
+      ul_frequencyBand                                                 = 257;
+      #scs-SpecificCarrierList
+      ul_offstToCarrier                                              = 0;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+      ul_subcarrierSpacing                                           = 3;
+      ul_carrierBandwidth                                            = 32;
+      pMax                                                          = 20;
+     #initialUplinkBWP
+      #genericParameters
+        initialULBWPlocationAndBandwidth                                        = 8525;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+        initialULBWPsubcarrierSpacing                                           = 3;
+      #rach-ConfigCommon
+        #rach-ConfigGeneric
+          prach_ConfigurationIndex                                  = 98;
+#prach_msg1_FDM
+#0 = one, 1=two, 2=four, 3=eight
+          prach_msg1_FDM                                            = 0;
+          prach_msg1_FrequencyStart                                 = 0;
+          zeroCorrelationZoneConfig                                 = 13;
+          preambleReceivedTargetPower                               = -118;
+#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200)
+          preambleTransMax                                          = 6;
+#powerRampingStep
+# 0=dB0,1=dB2,2=dB4,3=dB6
+        powerRampingStep                                            = 1;
+#ra_ReponseWindow
+#1,2,4,8,10,20,40,80
+        ra_ResponseWindow                                           = 4;
+#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR
+#0=oneeighth,1=onefourth,2=half,3=one,4=two,5=four,6=eight,7=sixteen
+        ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR                = 3;
+#oneHalf (0..15) 4,8,12,16,...60,64
+        ssb_perRACH_OccasionAndCB_PreamblesPerSSB                   = 15;
+#ra_ContentionResolutionTimer
+#(0..7) 8,16,24,32,40,48,56,64
+        ra_ContentionResolutionTimer                                = 7;
+        rsrp_ThresholdSSB                                           = 19;
+#prach-RootSequenceIndex_PR
+#0 = 839, 1 = 139
+        prach_RootSequenceIndex_PR                                  = 1;
+        prach_RootSequenceIndex                                     = 1;
+        # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex
+        #  
+        msg1_SubcarrierSpacing                                      = 1,
+
+# restrictedSetConfig
+# 0=unrestricted, 1=restricted type A, 2=restricted type B
+        restrictedSetConfig                                         = 0,
+      # pusch-ConfigCommon (up to 16 elements)
+        initialULBWPk2_0                      = 2;
+        initialULBWPmappingType_0             = 1
+        # this is SS=0 L=11
+        initialULBWPstartSymbolAndLength_0    = 55;
+ 	
+	initialULBWPk2_1                      = 2;
+        initialULBWPmappingType_1             = 1;
+        # this is SS=0 L=12
+        initialULBWPstartSymbolAndLength_1    = 69;
+
+
+        msg3_DeltaPreamble                                          = 1;
+        p0_NominalWithGrant                                         =-90;
+
+# pucch-ConfigCommon setup :
+# pucchGroupHopping
+# 0 = neither, 1= group hopping, 2=sequence hopping
+        pucchGroupHopping                                           = 0;
+        hoppingId                                                   = 40;
+        p0_nominal                                                  = -90;
+# ssb_PositionsInBurs_BitmapPR
+# 1=short, 2=medium, 3=long
+      ssb_PositionsInBurst_PR                                       = 3;
+      ssb_PositionsInBurst_Bitmap                                   = 0x100000001L;
+
+# ssb_periodicityServingCell
+# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 
+      ssb_periodicityServingCell                                    = 2;
+
+# dmrs_TypeA_position
+# 0 = pos2, 1 = pos3
+      dmrs_TypeA_Position                                           = 0;
+
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+      subcarrierSpacing                                             = 3;
+
+
+  #tdd-UL-DL-ConfigurationCommon
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+      referenceSubcarrierSpacing                                    = 3;
+      # pattern1 
+      # dl_UL_TransmissionPeriodicity
+      # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10
+      dl_UL_TransmissionPeriodicity                                 = 5;
+      nrofDownlinkSlots                                             = 10;
+      nrofDownlinkSymbols                                           = 0;
+      nrofUplinkSlots                                               = 10;
+      nrofUplinkSymbols                                             = 0;
+
+  ssPBCH_BlockPower                                             = 10;
+  }
+
+  );
+
+
+    # ------- SCTP definitions
+    SCTP :
+    {
+        # Number of streams to use in input/output
+        SCTP_INSTREAMS  = 2;
+        SCTP_OUTSTREAMS = 2;
+    };
+
+
+    ////////// MME parameters:
+    mme_ip_address      = ( { ipv4       = "192.168.12.26";
+                              ipv6       = "192:168:30::17";
+                              active     = "yes";
+                              preference = "ipv4";
+                            }
+                          );
+
+    NETWORK_INTERFACES :
+    {
+
+        GNB_INTERFACE_NAME_FOR_S1_MME            = "eth0";
+        GNB_IPV4_ADDRESS_FOR_S1_MME              = "192.168.12.111/24";
+        GNB_INTERFACE_NAME_FOR_S1U               = "eth0";
+        GNB_IPV4_ADDRESS_FOR_S1U                 = "192.168.12.111/24";
+        GNB_PORT_FOR_S1U                         = 2152; # Spec 2152
+    };
+  }
+);
+
+MACRLCs = (
+	{
+	num_cc = 1;
+	tr_s_preference = "local_L1";
+	tr_n_preference = "local_RRC";
+        }  
+);
+
+L1s = (
+    	{
+	num_cc = 1;
+	tr_n_preference = "local_mac";
+        }  
+);
+
+RUs = (
+    {		  
+       local_rf       = "yes"
+         nb_tx          = 1;
+         nb_rx          = 1;
+         att_tx         = 0;
+         att_rx         = 0;
+         bands          = [7];
+         max_pdschReferenceSignalPower = -27;
+         max_rxgain                    = 114;
+         eNB_instances  = [0];
+	 sdr_addrs = "addr=192.168.10.2,second_addr=192.168.20.2";
+         if_freq = 5300000000;
+    }
+);  
+
+THREAD_STRUCT = (
+  {
+    #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
+    parallel_config    = "PARALLEL_RU_L1_TRX_SPLIT";
+    #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
+    worker_config      = "WORKER_ENABLE";
+  }
+);
+
+     log_config :
+     {
+       global_log_level                      ="info";
+       global_log_verbosity                  ="medium";
+       hw_log_level                          ="info";
+       hw_log_verbosity                      ="medium";
+       phy_log_level                         ="info";
+       phy_log_verbosity                     ="medium";
+       mac_log_level                         ="info";
+       mac_log_verbosity                     ="high";
+       rlc_log_level                         ="info";
+       rlc_log_verbosity                     ="medium";
+       pdcp_log_level                        ="info";
+       pdcp_log_verbosity                    ="medium";
+       rrc_log_level                         ="info";
+       rrc_log_verbosity                     ="medium";
+    };
+
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.66PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.66PRB.usrpn300.conf
new file mode 100644
index 00000000000..1fbc8e30ef2
--- /dev/null
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band257.tm1.66PRB.usrpn300.conf
@@ -0,0 +1,270 @@
+Active_gNBs = ( "gNB-Eurecom-5GNRBox");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+gNBs =
+(
+ {
+    ////////// Identification parameters:
+    gNB_ID    =  0xe00;
+
+    cell_type =  "CELL_MACRO_GNB";
+
+    gNB_name  =  "gNB-Eurecom-5GNRBox";
+
+    // Tracking area code, 0x0000 and 0xfffe are reserved values
+    tracking_area_code  =  1;
+
+    plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;});	 
+
+    tr_s_preference     = "local_mac"
+
+    ////////// Physical parameters:
+
+    ssb_SubcarrierOffset                                      = 0;
+    pdsch_AntennaPorts                                        = 1;
+	
+    servingCellConfigCommon = (
+    {
+ #spCellConfigCommon
+
+      physCellId                                                    = 0;
+
+#  downlinkConfigCommon
+    #frequencyInfoDL
+      # this is pointA + 23 PRBs@120kHz SCS (same as initial BWP)
+      absoluteFrequencySSB                                          = 2078315;
+      dl_frequencyBand                                                 = 257;
+      # this is 27.900 GHz
+      dl_absoluteFrequencyPointA                                       = 2077499;
+      #scs-SpecificCarrierList
+        dl_offstToCarrier                                              = 0;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+        dl_subcarrierSpacing                                           = 3;
+        dl_carrierBandwidth                                            = 66;
+     #initialDownlinkBWP
+      #genericParameters
+        # this is RBstart=0,L=50 (275*(L-1))+RBstart
+        initialDLBWPlocationAndBandwidth                                        = 13475;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+        initialDLBWPsubcarrierSpacing                                           = 3;
+      #pdcch-ConfigCommon
+        initialDLBWPcontrolResourceSetZero                                      = 12;
+        initialDLBWPsearchSpaceZero                                             = 0;
+      #pdsch-ConfigCommon
+        #pdschTimeDomainAllocationList (up to 16 entries)
+             initialDLBWPk0_0                    = 0;
+             #initialULBWPmappingType
+	     #0=typeA,1=typeB
+             initialDLBWPmappingType_0           = 0;
+             #this is SS=2,L=3
+             initialDLBWPstartSymbolAndLength_0  = 40;
+
+             initialDLBWPk0_1                    = 0;
+             initialDLBWPmappingType_1           = 0;
+             #this is SS=2,L=12 
+             initialDLBWPstartSymbolAndLength_1  = 53;
+
+             initialDLBWPk0_2                    = 0;
+             initialDLBWPmappingType_2           = 0;
+             #this is SS=1,L=12 
+             initialDLBWPstartSymbolAndLength_2  = 54;
+  #uplinkConfigCommon 
+     #frequencyInfoUL
+      ul_frequencyBand                                                 = 257;
+      #scs-SpecificCarrierList
+      ul_offstToCarrier                                              = 0;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+      ul_subcarrierSpacing                                           = 3;
+      ul_carrierBandwidth                                            = 66;
+      pMax                                                          = 20;
+     #initialUplinkBWP
+      #genericParameters
+        initialULBWPlocationAndBandwidth                                        = 13475;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+        initialULBWPsubcarrierSpacing                                           = 3;
+      #rach-ConfigCommon
+        #rach-ConfigGeneric
+          prach_ConfigurationIndex                                  = 98;
+#prach_msg1_FDM
+#0 = one, 1=two, 2=four, 3=eight
+          prach_msg1_FDM                                            = 0;
+          prach_msg1_FrequencyStart                                 = 0;
+          zeroCorrelationZoneConfig                                 = 13;
+          preambleReceivedTargetPower                               = -118;
+#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200)
+          preambleTransMax                                          = 6;
+#powerRampingStep
+# 0=dB0,1=dB2,2=dB4,3=dB6
+        powerRampingStep                                            = 1;
+#ra_ReponseWindow
+#1,2,4,8,10,20,40,80
+        ra_ResponseWindow                                           = 4;
+#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR
+#0=oneeighth,1=onefourth,2=half,3=one,4=two,5=four,6=eight,7=sixteen
+        ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR                = 3;
+#oneHalf (0..15) 4,8,12,16,...60,64
+        ssb_perRACH_OccasionAndCB_PreamblesPerSSB                   = 15;
+#ra_ContentionResolutionTimer
+#(0..7) 8,16,24,32,40,48,56,64
+        ra_ContentionResolutionTimer                                = 7;
+        rsrp_ThresholdSSB                                           = 19;
+#prach-RootSequenceIndex_PR
+#0 = 839, 1 = 139
+        prach_RootSequenceIndex_PR                                  = 1;
+        prach_RootSequenceIndex                                     = 1;
+        # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex
+        #  
+        msg1_SubcarrierSpacing                                      = 1,
+
+# restrictedSetConfig
+# 0=unrestricted, 1=restricted type A, 2=restricted type B
+        restrictedSetConfig                                         = 0,
+      # pusch-ConfigCommon (up to 16 elements)
+        initialULBWPk2_0                      = 2;
+        initialULBWPmappingType_0             = 1
+        # this is SS=0 L=11
+        initialULBWPstartSymbolAndLength_0    = 55;
+ 	
+	initialULBWPk2_1                      = 2;
+        initialULBWPmappingType_1             = 1;
+        # this is SS=0 L=12
+        initialULBWPstartSymbolAndLength_1    = 69;
+
+
+        msg3_DeltaPreamble                                          = 1;
+        p0_NominalWithGrant                                         =-90;
+
+# pucch-ConfigCommon setup :
+# pucchGroupHopping
+# 0 = neither, 1= group hopping, 2=sequence hopping
+        pucchGroupHopping                                           = 0;
+        hoppingId                                                   = 40;
+        p0_nominal                                                  = -90;
+# ssb_PositionsInBurs_BitmapPR
+# 1=short, 2=medium, 3=long
+      ssb_PositionsInBurst_PR                                       = 3;
+      ssb_PositionsInBurst_Bitmap                                   = 1;
+
+# ssb_periodicityServingCell
+# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 
+      ssb_periodicityServingCell                                    = 2;
+
+# dmrs_TypeA_position
+# 0 = pos2, 1 = pos3
+      dmrs_TypeA_Position                                           = 0;
+
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+      subcarrierSpacing                                             = 3;
+
+
+  #tdd-UL-DL-ConfigurationCommon
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+      referenceSubcarrierSpacing                                    = 1;
+      # pattern1 
+      # dl_UL_TransmissionPeriodicity
+      # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10
+      dl_UL_TransmissionPeriodicity                                 = 6;
+      nrofDownlinkSlots                                             = 30;
+      nrofDownlinkSymbols                                           = 0;
+      nrofUplinkSlots                                               = 10;
+      nrofUplinkSymbols                                             = 0;
+
+  ssPBCH_BlockPower                                             = 10;
+  }
+
+  );
+
+
+    # ------- SCTP definitions
+    SCTP :
+    {
+        # Number of streams to use in input/output
+        SCTP_INSTREAMS  = 2;
+        SCTP_OUTSTREAMS = 2;
+    };
+
+
+    ////////// MME parameters:
+    mme_ip_address      = ( { ipv4       = "192.168.12.26";
+                              ipv6       = "192:168:30::17";
+                              active     = "yes";
+                              preference = "ipv4";
+                            }
+                          );
+
+    NETWORK_INTERFACES :
+    {
+
+        GNB_INTERFACE_NAME_FOR_S1_MME            = "eth0";
+        GNB_IPV4_ADDRESS_FOR_S1_MME              = "192.168.12.111/24";
+        GNB_INTERFACE_NAME_FOR_S1U               = "eth0";
+        GNB_IPV4_ADDRESS_FOR_S1U                 = "192.168.12.111/24";
+        GNB_PORT_FOR_S1U                         = 2152; # Spec 2152
+    };
+  }
+);
+
+MACRLCs = (
+	{
+	num_cc = 1;
+	tr_s_preference = "local_L1";
+	tr_n_preference = "local_RRC";
+        }  
+);
+
+L1s = (
+    	{
+	num_cc = 1;
+	tr_n_preference = "local_mac";
+        }  
+);
+
+RUs = (
+    {		  
+       local_rf       = "yes"
+         nb_tx          = 1
+         nb_rx          = 1
+         att_tx         = 0
+         att_rx         = 0;
+         bands          = [7];
+         max_pdschReferenceSignalPower = -27;
+         max_rxgain                    = 114;
+         eNB_instances  = [0];
+	 sdr_addrs = "type=n300";
+    }
+);  
+
+THREAD_STRUCT = (
+  {
+    #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
+    parallel_config    = "PARALLEL_RU_L1_TRX_SPLIT";
+    #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
+    worker_config      = "WORKER_ENABLE";
+  }
+);
+
+     log_config :
+     {
+       global_log_level                      ="info";
+       global_log_verbosity                  ="medium";
+       hw_log_level                          ="info";
+       hw_log_verbosity                      ="medium";
+       phy_log_level                         ="info";
+       phy_log_verbosity                     ="medium";
+       mac_log_level                         ="info";
+       mac_log_verbosity                     ="high";
+       rlc_log_level                         ="info";
+       rlc_log_verbosity                     ="medium";
+       pdcp_log_level                        ="info";
+       pdcp_log_verbosity                    ="medium";
+       rrc_log_level                         ="info";
+       rrc_log_verbosity                     ="medium";
+    };
+
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf
new file mode 100644
index 00000000000..72a27cc1e73
--- /dev/null
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band261.tm1.32PRB.usrpn300.conf
@@ -0,0 +1,271 @@
+Active_gNBs = ( "gNB-Eurecom-5GNRBox");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+gNBs =
+(
+ {
+    ////////// Identification parameters:
+    gNB_ID    =  0xe00;
+
+    cell_type =  "CELL_MACRO_GNB";
+
+    gNB_name  =  "gNB-Eurecom-5GNRBox";
+
+    // Tracking area code, 0x0000 and 0xfffe are reserved values
+    tracking_area_code  =  600;
+
+    plmn_list = ({mcc = 311; mnc = 480; mnc_length = 3;});	 
+
+    tr_s_preference     = "local_mac"
+
+    ////////// Physical parameters:
+
+    ssb_SubcarrierOffset                                      = 0;
+    pdsch_AntennaPorts                                        = 1;
+	
+    servingCellConfigCommon = (
+    {
+ #spCellConfigCommon
+
+      physCellId                                                    = 0;
+
+#  downlinkConfigCommon
+    #frequencyInfoDL
+      # this is pointA + 23 PRBs@120kHz SCS (same as initial BWP)
+      absoluteFrequencySSB                                          = 2071241;
+      dl_frequencyBand                                                 = 261;
+      # this is 27.900 GHz
+      dl_absoluteFrequencyPointA                                       = 2070833;
+      #scs-SpecificCarrierList
+        dl_offstToCarrier                                              = 0;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+        dl_subcarrierSpacing                                           = 3;
+        dl_carrierBandwidth                                            = 32;
+     #initialDownlinkBWP
+      #genericParameters
+        # this is RBstart=0,L=50 (275*(L-1))+RBstart
+        initialDLBWPlocationAndBandwidth                                        = 8525;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+        initialDLBWPsubcarrierSpacing                                           = 3;
+      #pdcch-ConfigCommon
+        initialDLBWPcontrolResourceSetZero                                      = 12;
+        initialDLBWPsearchSpaceZero                                             = 0;
+      #pdsch-ConfigCommon
+        #pdschTimeDomainAllocationList (up to 16 entries)
+             initialDLBWPk0_0                    = 0;
+             #initialULBWPmappingType
+	     #0=typeA,1=typeB
+             initialDLBWPmappingType_0           = 0;
+             #this is SS=2,L=3
+             initialDLBWPstartSymbolAndLength_0  = 40;
+
+             initialDLBWPk0_1                    = 0;
+             initialDLBWPmappingType_1           = 0;
+             #this is SS=2,L=12 
+             initialDLBWPstartSymbolAndLength_1  = 53;
+
+             initialDLBWPk0_2                    = 0;
+             initialDLBWPmappingType_2           = 0;
+             #this is SS=1,L=12 
+             initialDLBWPstartSymbolAndLength_2  = 54;
+  #uplinkConfigCommon 
+     #frequencyInfoUL
+      ul_frequencyBand                                                 = 261;
+      #scs-SpecificCarrierList
+      ul_offstToCarrier                                              = 0;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+      ul_subcarrierSpacing                                           = 3;
+      ul_carrierBandwidth                                            = 32;
+      pMax                                                          = 20;
+     #initialUplinkBWP
+      #genericParameters
+        initialULBWPlocationAndBandwidth                                        = 8525;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+        initialULBWPsubcarrierSpacing                                           = 3;
+      #rach-ConfigCommon
+        #rach-ConfigGeneric
+          prach_ConfigurationIndex                                  = 98;
+#prach_msg1_FDM
+#0 = one, 1=two, 2=four, 3=eight
+          prach_msg1_FDM                                            = 0;
+          prach_msg1_FrequencyStart                                 = 0;
+          zeroCorrelationZoneConfig                                 = 13;
+          preambleReceivedTargetPower                               = -118;
+#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200)
+          preambleTransMax                                          = 6;
+#powerRampingStep
+# 0=dB0,1=dB2,2=dB4,3=dB6
+        powerRampingStep                                            = 1;
+#ra_ReponseWindow
+#1,2,4,8,10,20,40,80
+        ra_ResponseWindow                                           = 4;
+#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR
+#0=oneeighth,1=onefourth,2=half,3=one,4=two,5=four,6=eight,7=sixteen
+        ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR                = 3;
+#oneHalf (0..15) 4,8,12,16,...60,64
+        ssb_perRACH_OccasionAndCB_PreamblesPerSSB                   = 15;
+#ra_ContentionResolutionTimer
+#(0..7) 8,16,24,32,40,48,56,64
+        ra_ContentionResolutionTimer                                = 7;
+        rsrp_ThresholdSSB                                           = 19;
+#prach-RootSequenceIndex_PR
+#0 = 839, 1 = 139
+        prach_RootSequenceIndex_PR                                  = 1;
+        prach_RootSequenceIndex                                     = 1;
+        # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex
+        #  
+        msg1_SubcarrierSpacing                                      = 1,
+
+# restrictedSetConfig
+# 0=unrestricted, 1=restricted type A, 2=restricted type B
+        restrictedSetConfig                                         = 0,
+      # pusch-ConfigCommon (up to 16 elements)
+        initialULBWPk2_0                      = 2;
+        initialULBWPmappingType_0             = 1
+        # this is SS=0 L=11
+        initialULBWPstartSymbolAndLength_0    = 55;
+ 	
+	initialULBWPk2_1                      = 2;
+        initialULBWPmappingType_1             = 1;
+        # this is SS=0 L=12
+        initialULBWPstartSymbolAndLength_1    = 69;
+
+
+        msg3_DeltaPreamble                                          = 1;
+        p0_NominalWithGrant                                         =-90;
+
+# pucch-ConfigCommon setup :
+# pucchGroupHopping
+# 0 = neither, 1= group hopping, 2=sequence hopping
+        pucchGroupHopping                                           = 0;
+        hoppingId                                                   = 40;
+        p0_nominal                                                  = -90;
+# ssb_PositionsInBurs_BitmapPR
+# 1=short, 2=medium, 3=long
+      ssb_PositionsInBurst_PR                                       = 3;
+      ssb_PositionsInBurst_Bitmap                                   = 0x100000001L;
+
+# ssb_periodicityServingCell
+# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 
+      ssb_periodicityServingCell                                    = 2;
+
+# dmrs_TypeA_position
+# 0 = pos2, 1 = pos3
+      dmrs_TypeA_Position                                           = 0;
+
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+      subcarrierSpacing                                             = 3;
+
+
+  #tdd-UL-DL-ConfigurationCommon
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+      referenceSubcarrierSpacing                                    = 3;
+      # pattern1 
+      # dl_UL_TransmissionPeriodicity
+      # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10
+      dl_UL_TransmissionPeriodicity                                 = 5;
+      nrofDownlinkSlots                                             = 10;
+      nrofDownlinkSymbols                                           = 0;
+      nrofUplinkSlots                                               = 10;
+      nrofUplinkSymbols                                             = 0;
+
+  ssPBCH_BlockPower                                             = 10;
+  }
+
+  );
+
+
+    # ------- SCTP definitions
+    SCTP :
+    {
+        # Number of streams to use in input/output
+        SCTP_INSTREAMS  = 2;
+        SCTP_OUTSTREAMS = 2;
+    };
+
+
+    ////////// MME parameters:
+    mme_ip_address      = ( { ipv4       = "192.168.12.26";
+                              ipv6       = "192:168:30::17";
+                              active     = "yes";
+                              preference = "ipv4";
+                            }
+                          );
+
+    NETWORK_INTERFACES :
+    {
+
+        GNB_INTERFACE_NAME_FOR_S1_MME            = "eth0";
+        GNB_IPV4_ADDRESS_FOR_S1_MME              = "192.168.12.111/24";
+        GNB_INTERFACE_NAME_FOR_S1U               = "eth0";
+        GNB_IPV4_ADDRESS_FOR_S1U                 = "192.168.12.111/24";
+        GNB_PORT_FOR_S1U                         = 2152; # Spec 2152
+    };
+  }
+);
+
+MACRLCs = (
+	{
+	num_cc = 1;
+	tr_s_preference = "local_L1";
+	tr_n_preference = "local_RRC";
+        }  
+);
+
+L1s = (
+    	{
+	num_cc = 1;
+	tr_n_preference = "local_mac";
+        }  
+);
+
+RUs = (
+    {		  
+       local_rf       = "yes"
+         nb_tx          = 1;
+         nb_rx          = 1;
+         att_tx         = 0;
+         att_rx         = 0;
+         bands          = [7];
+         max_pdschReferenceSignalPower = -27;
+         max_rxgain                    = 114;
+         eNB_instances  = [0];
+	 sdr_addrs = "addr=192.168.10.2,second_addr=192.168.20.2";
+         if_freq = 5124520000L;
+    }
+);  
+
+THREAD_STRUCT = (
+  {
+    #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
+    parallel_config    = "PARALLEL_RU_L1_TRX_SPLIT";
+    #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
+    worker_config      = "WORKER_ENABLE";
+  }
+);
+
+     log_config :
+     {
+       global_log_level                      ="info";
+       global_log_verbosity                  ="medium";
+       hw_log_level                          ="info";
+       hw_log_verbosity                      ="medium";
+       phy_log_level                         ="info";
+       phy_log_verbosity                     ="medium";
+       mac_log_level                         ="info";
+       mac_log_verbosity                     ="high";
+       rlc_log_level                         ="info";
+       rlc_log_verbosity                     ="medium";
+       pdcp_log_level                        ="info";
+       pdcp_log_verbosity                    ="medium";
+       rrc_log_level                         ="info";
+       rrc_log_verbosity                     ="medium";
+    };
+
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.30kHz,usrpb2x0.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.30kHz,usrpb2x0.conf
new file mode 100644
index 00000000000..ff8e2617832
--- /dev/null
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.106PRB.30kHz,usrpb2x0.conf
@@ -0,0 +1,283 @@
+Active_gNBs = ( "gNB-Eurecom-5GNRBox");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+gNBs =
+(
+ {
+    ////////// Identification parameters:
+    gNB_ID    =  0xe00;
+
+    cell_type =  "CELL_MACRO_GNB";
+
+    gNB_name  =  "gNB-Eurecom-5GNRBox";
+
+    // Tracking area code, 0x0000 and 0xfffe are reserved values
+    tracking_area_code  =  1;
+
+    plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;});	 
+
+    tr_s_preference     = "local_mac"
+
+    ////////// Physical parameters:
+
+    ssb_SubcarrierOffset                                      = 31;
+    pdsch_AntennaPorts                                        = 1;
+	
+    servingCellConfigCommon = (
+    {
+ #spCellConfigCommon
+
+      physCellId                                                    = 10;
+
+#  downlinkConfigCommon
+    #frequencyInfoDL
+      # this is 3600 MHz + 84 PRBs@30kHz SCS (same as initial BWP)
+      absoluteFrequencySSB                                          = 641272;
+      dl_frequencyBand                                                 = 78;
+      # this is 3600 MHz
+      dl_absoluteFrequencyPointA                                       = 640000;
+      #scs-SpecificCarrierList
+        dl_offstToCarrier                                              = 0;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+        dl_subcarrierSpacing                                           = 1;
+        dl_carrierBandwidth                                            = 106;
+     #initialDownlinkBWP
+      #genericParameters
+        # this is RBstart=84,L=13 (275*(L-1))+RBstart
+        initialDLBWPlocationAndBandwidth                                        = 6366;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+        initialDLBWPsubcarrierSpacing                                           = 1;
+      #pdcch-ConfigCommon
+        initialDLBWPcontrolResourceSetZero                                      = 0;
+        initialDLBWPsearchSpaceZero                                             = 0;
+      #pdsch-ConfigCommon
+        #pdschTimeDomainAllocationList (up to 16 entries)
+             initialDLBWPk0_0                    = 0;
+             #initialULBWPmappingType
+	     #0=typeA,1=typeB
+             initialDLBWPmappingType_0           = 0;
+             #this is SS=2,L=3
+             initialDLBWPstartSymbolAndLength_0  = 40;
+
+             initialDLBWPk0_1                    = 0;
+             initialDLBWPmappingType_1           = 0;
+             #this is SS=2,L=12 
+             initialDLBWPstartSymbolAndLength_1  = 53;
+
+             initialDLBWPk0_2                    = 0;
+             initialDLBWPmappingType_2           = 0;
+             #this is SS=1,L=12 
+             initialDLBWPstartSymbolAndLength_2  = 54;
+  #uplinkConfigCommon 
+     #frequencyInfoUL
+      ul_frequencyBand                                                 = 78;
+      #scs-SpecificCarrierList
+      ul_offstToCarrier                                              = 0;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+      ul_subcarrierSpacing                                           = 1;
+      ul_carrierBandwidth                                            = 106;
+      pMax                                                          = 20;
+     #initialUplinkBWP
+      #genericParameters
+        initialULBWPlocationAndBandwidth                                        = 6366;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+        initialULBWPsubcarrierSpacing                                           = 1;
+      #rach-ConfigCommon
+        #rach-ConfigGeneric
+          prach_ConfigurationIndex                                  = 98;
+#prach_msg1_FDM
+#0 = one, 1=two, 2=four, 3=eight
+          prach_msg1_FDM                                            = 0;
+          prach_msg1_FrequencyStart                                 = 0;
+          zeroCorrelationZoneConfig                                 = 13;
+          preambleReceivedTargetPower                               = -118;
+#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200)
+          preambleTransMax                                          = 6;
+#powerRampingStep
+# 0=dB0,1=dB2,2=dB4,3=dB6
+        powerRampingStep                                            = 1;
+#ra_ReponseWindow
+#1,2,4,8,10,20,40,80
+        ra_ResponseWindow                                           = 5;
+#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR
+#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen
+        ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR                = 4;
+#oneHalf (0..15) 4,8,12,16,...60,64
+        ssb_perRACH_OccasionAndCB_PreamblesPerSSB                   = 15;
+#ra_ContentionResolutionTimer
+#(0..7) 8,16,24,32,40,48,56,64
+        ra_ContentionResolutionTimer                                = 7;
+        rsrp_ThresholdSSB                                           = 19;
+#prach-RootSequenceIndex_PR
+#1 = 839, 2 = 139
+        prach_RootSequenceIndex_PR                                  = 2;
+        prach_RootSequenceIndex                                     = 0;
+        # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex
+        #  
+        msg1_SubcarrierSpacing                                      = 1,
+
+# restrictedSetConfig
+# 0=unrestricted, 1=restricted type A, 2=restricted type B
+        restrictedSetConfig                                         = 0,
+      # pusch-ConfigCommon (up to 16 elements)
+        initialULBWPk2_0                      = 2;
+        initialULBWPmappingType_0             = 1
+        # this is SS=0 L=11
+        initialULBWPstartSymbolAndLength_0    = 55;
+ 	
+	initialULBWPk2_1                      = 2;
+        initialULBWPmappingType_1             = 1;
+        # this is SS=0 L=12
+        initialULBWPstartSymbolAndLength_1    = 69;
+
+
+        msg3_DeltaPreamble                                          = 1;
+        p0_NominalWithGrant                                         =-90;
+
+# pucch-ConfigCommon setup :
+# pucchGroupHopping
+# 0 = neither, 1= group hopping, 2=sequence hopping
+        pucchGroupHopping                                           = 0;
+        hoppingId                                                   = 40;
+        p0_nominal                                                  = -90;
+# ssb_PositionsInBurs_BitmapPR
+# 1=short, 2=medium, 3=long
+      ssb_PositionsInBurst_PR                                       = 2;
+      ssb_PositionsInBurst_Bitmap                                   = 1;
+
+# ssb_periodicityServingCell
+# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 
+      ssb_periodicityServingCell                                    = 2;
+
+# dmrs_TypeA_position
+# 0 = pos2, 1 = pos3
+      dmrs_TypeA_Position                                           = 0;
+
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+      subcarrierSpacing                                             = 1;
+
+
+  #tdd-UL-DL-ConfigurationCommon
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+      referenceSubcarrierSpacing                                    = 1;
+      # pattern1 
+      # dl_UL_TransmissionPeriodicity
+      # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10
+      dl_UL_TransmissionPeriodicity                                 = 6;
+      nrofDownlinkSlots                                             = 7;
+      nrofDownlinkSymbols                                           = 6;
+      nrofUplinkSlots                                               = 2;
+      nrofUplinkSymbols                                             = 4;
+
+  ssPBCH_BlockPower                                             = 10;
+  }
+
+  );
+
+
+    # ------- SCTP definitions
+    SCTP :
+    {
+        # Number of streams to use in input/output
+        SCTP_INSTREAMS  = 2;
+        SCTP_OUTSTREAMS = 2;
+    };
+
+
+    ////////// MME parameters:
+    mme_ip_address      = ( { ipv4       = "192.168.12.26";
+                              ipv6       = "192:168:30::17";
+                              active     = "yes";
+                              preference = "ipv4";
+                            }
+                          );
+
+    ///X2
+    enable_x2 = "yes";
+    t_reloc_prep      = 1000;      /* unit: millisecond */
+    tx2_reloc_overall = 2000;      /* unit: millisecond */
+    target_enb_x2_ip_address      = (
+                                     { ipv4       = "192.168.12.196";
+                                       ipv6       = "192:168:30::17";
+                                       preference = "ipv4";
+                                     }
+                                    );
+
+    NETWORK_INTERFACES :
+    {
+
+        GNB_INTERFACE_NAME_FOR_S1_MME            = "eth0";
+        GNB_IPV4_ADDRESS_FOR_S1_MME              = "192.168.12.111/24";
+        GNB_INTERFACE_NAME_FOR_S1U               = "eth0";
+        GNB_IPV4_ADDRESS_FOR_S1U                 = "192.168.12.111/24";
+        GNB_PORT_FOR_S1U                         = 2152; # Spec 2152
+        GNB_IPV4_ADDRESS_FOR_X2C                 = "192.168.12.111/24";
+        GNB_PORT_FOR_X2C                         = 36422; # Spec 36422
+    };
+  }
+);
+
+MACRLCs = (
+	{
+	num_cc = 1;
+	tr_s_preference = "local_L1";
+	tr_n_preference = "local_RRC";
+        }  
+);
+
+L1s = (
+    	{
+	num_cc = 1;
+	tr_n_preference = "local_mac";
+        }  
+);
+
+RUs = (
+    {		  
+       local_rf       = "yes"
+         nb_tx          = 1
+         nb_rx          = 1
+         att_tx         = 0
+         att_rx         = 0;
+         bands          = [7];
+         max_pdschReferenceSignalPower = -27;
+         max_rxgain                    = 114;
+         eNB_instances  = [0];
+         clock_src = "internal";
+    }
+);  
+
+THREAD_STRUCT = (
+  {
+    #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
+    parallel_config    = "PARALLEL_RU_L1_TRX_SPLIT";
+    #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
+    worker_config      = "WORKER_ENABLE";
+  }
+);
+
+     log_config :
+     {
+       global_log_level                      ="info";
+       global_log_verbosity                  ="medium";
+       hw_log_level                          ="info";
+       hw_log_verbosity                      ="medium";
+       phy_log_level                         ="info";
+       phy_log_verbosity                     ="medium";
+       mac_log_level                         ="info";
+       mac_log_verbosity                     ="high";
+       rlc_log_level                         ="info";
+       rlc_log_verbosity                     ="medium";
+       pdcp_log_level                        ="info";
+       pdcp_log_verbosity                    ="medium";
+       rrc_log_level                         ="info";
+       rrc_log_verbosity                     ="medium";
+    };
+
diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.slave.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.slave.conf
new file mode 100644
index 00000000000..771f5d18397
--- /dev/null
+++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.slave.conf
@@ -0,0 +1,284 @@
+Active_gNBs = ( "gNB-Eurecom-5GNRBox");
+# Asn1_verbosity, choice in: none, info, annoying
+Asn1_verbosity = "none";
+
+gNBs =
+(
+ {
+    ////////// Identification parameters:
+    gNB_ID    =  0xe00;
+
+    cell_type =  "CELL_MACRO_GNB";
+
+    gNB_name  =  "gNB-Eurecom-5GNRBox";
+
+    // Tracking area code, 0x0000 and 0xfffe are reserved values
+    tracking_area_code  =  1;
+
+    plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;});	 
+
+    tr_s_preference     = "local_mac"
+
+    ////////// Physical parameters:
+
+    ssb_SubcarrierOffset                                      = 0;
+    pdsch_AntennaPorts                                        = 1;
+	
+    servingCellConfigCommon = (
+    {
+ #spCellConfigCommon
+
+      physCellId                                                    = 0;
+
+#  downlinkConfigCommon
+    #frequencyInfoDL
+      # this is 3600 MHz + 84 PRBs@30kHz SCS (same as initial BWP)
+      absoluteFrequencySSB                                          = 642016;
+      dl_frequencyBand                                                 = 78;
+      # this is 3600 MHz
+      dl_absoluteFrequencyPointA                                       = 640000;
+      #scs-SpecificCarrierList
+        dl_offstToCarrier                                              = 0;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+        dl_subcarrierSpacing                                           = 1;
+        dl_carrierBandwidth                                            = 217;
+     #initialDownlinkBWP
+      #genericParameters
+        # this is RBstart=84,L=50 (275*(L-1))+RBstart
+        initialDLBWPlocationAndBandwidth                                        = 13559;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+        initialDLBWPsubcarrierSpacing                                           = 1;
+      #pdcch-ConfigCommon
+        initialDLBWPcontrolResourceSetZero                                      = 12;
+        initialDLBWPsearchSpaceZero                                             = 0;
+      #pdsch-ConfigCommon
+        #pdschTimeDomainAllocationList (up to 16 entries)
+             initialDLBWPk0_0                    = 0;
+             #initialULBWPmappingType
+	     #0=typeA,1=typeB
+             initialDLBWPmappingType_0           = 0;
+             #this is SS=2,L=3
+             initialDLBWPstartSymbolAndLength_0  = 40;
+
+             initialDLBWPk0_1                    = 0;
+             initialDLBWPmappingType_1           = 0;
+             #this is SS=2,L=12 
+             initialDLBWPstartSymbolAndLength_1  = 53;
+
+             initialDLBWPk0_2                    = 0;
+             initialDLBWPmappingType_2           = 0;
+             #this is SS=1,L=12 
+             initialDLBWPstartSymbolAndLength_2  = 54;
+  #uplinkConfigCommon 
+     #frequencyInfoUL
+      ul_frequencyBand                                                 = 78;
+      #scs-SpecificCarrierList
+      ul_offstToCarrier                                              = 0;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+      ul_subcarrierSpacing                                           = 1;
+      ul_carrierBandwidth                                            = 217;
+      pMax                                                          = 20;
+     #initialUplinkBWP
+      #genericParameters
+        initialULBWPlocationAndBandwidth                                        = 13559;
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+        initialULBWPsubcarrierSpacing                                           = 1;
+      #rach-ConfigCommon
+        #rach-ConfigGeneric
+          prach_ConfigurationIndex                                  = 98;
+#prach_msg1_FDM
+#0 = one, 1=two, 2=four, 3=eight
+          prach_msg1_FDM                                            = 0;
+          prach_msg1_FrequencyStart                                 = 0;
+          zeroCorrelationZoneConfig                                 = 13;
+          preambleReceivedTargetPower                               = -118;
+#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200)
+          preambleTransMax                                          = 6;
+#powerRampingStep
+# 0=dB0,1=dB2,2=dB4,3=dB6
+        powerRampingStep                                            = 1;
+#ra_ReponseWindow
+#1,2,4,8,10,20,40,80
+        ra_ResponseWindow                                           = 4;
+#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR
+#0=oneeighth,1=onefourth,2=half,3=one,4=two,5=four,6=eight,7=sixteen
+        ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR                = 3;
+#oneHalf (0..15) 4,8,12,16,...60,64
+        ssb_perRACH_OccasionAndCB_PreamblesPerSSB                   = 15;
+#ra_ContentionResolutionTimer
+#(0..7) 8,16,24,32,40,48,56,64
+        ra_ContentionResolutionTimer                                = 7;
+        rsrp_ThresholdSSB                                           = 19;
+#prach-RootSequenceIndex_PR
+#0 = 839, 1 = 139
+        prach_RootSequenceIndex_PR                                  = 1;
+        prach_RootSequenceIndex                                     = 1;
+        # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex
+        #  
+        msg1_SubcarrierSpacing                                      = 1,
+
+# restrictedSetConfig
+# 0=unrestricted, 1=restricted type A, 2=restricted type B
+        restrictedSetConfig                                         = 0,
+      # pusch-ConfigCommon (up to 16 elements)
+        initialULBWPk2_0                      = 2;
+        initialULBWPmappingType_0             = 1
+        # this is SS=0 L=11
+        initialULBWPstartSymbolAndLength_0    = 55;
+ 	
+	initialULBWPk2_1                      = 2;
+        initialULBWPmappingType_1             = 1;
+        # this is SS=0 L=12
+        initialULBWPstartSymbolAndLength_1    = 69;
+
+
+        msg3_DeltaPreamble                                          = 1;
+        p0_NominalWithGrant                                         =-90;
+
+# pucch-ConfigCommon setup :
+# pucchGroupHopping
+# 0 = neither, 1= group hopping, 2=sequence hopping
+        pucchGroupHopping                                           = 0;
+        hoppingId                                                   = 40;
+        p0_nominal                                                  = -90;
+# ssb_PositionsInBurs_BitmapPR
+# 1=short, 2=medium, 3=long
+      ssb_PositionsInBurst_PR                                       = 2;
+      ssb_PositionsInBurst_Bitmap                                   = 15;
+
+# ssb_periodicityServingCell
+# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 
+      ssb_periodicityServingCell                                    = 2;
+
+# dmrs_TypeA_position
+# 0 = pos2, 1 = pos3
+      dmrs_TypeA_Position                                           = 0;
+
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+      subcarrierSpacing                                             = 1;
+
+
+  #tdd-UL-DL-ConfigurationCommon
+# subcarrierSpacing
+# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120  
+      referenceSubcarrierSpacing                                    = 1;
+      # pattern1 
+      # dl_UL_TransmissionPeriodicity
+      # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10
+      dl_UL_TransmissionPeriodicity                                 = 6;
+      nrofDownlinkSlots                                             = 2;
+      nrofDownlinkSymbols                                           = 1;
+      nrofUplinkSlots                                               = 7;
+      nrofUplinkSymbols                                             = 7;
+
+  ssPBCH_BlockPower                                             = 10;
+  }
+
+  );
+
+
+    # ------- SCTP definitions
+    SCTP :
+    {
+        # Number of streams to use in input/output
+        SCTP_INSTREAMS  = 2;
+        SCTP_OUTSTREAMS = 2;
+    };
+
+
+    ////////// MME parameters:
+    mme_ip_address      = ( { ipv4       = "192.168.12.26";
+                              ipv6       = "192:168:30::17";
+                              active     = "yes";
+                              preference = "ipv4";
+                            }
+                          );
+                          
+    ///X2
+    enable_x2 = "yes";
+    t_reloc_prep      = 1000;      /* unit: millisecond */
+    tx2_reloc_overall = 2000;      /* unit: millisecond */
+    target_enb_x2_ip_address      = (
+                                     { ipv4       = "192.168.12.188";
+                                       ipv6       = "192:168:30::17";
+                                       preference = "ipv4";
+                                     }
+                                    );                       
+
+    NETWORK_INTERFACES :
+    {
+
+        GNB_INTERFACE_NAME_FOR_S1_MME            = "enp0s31f6";
+        GNB_IPV4_ADDRESS_FOR_S1_MME              = "192.168.12.75/24";
+        GNB_INTERFACE_NAME_FOR_S1U               = "eth0";
+        GNB_IPV4_ADDRESS_FOR_S1U                 = "192.168.12.75/24";
+        GNB_PORT_FOR_S1U                         = 2152; # Spec 2152
+        
+        GNB_IPV4_ADDRESS_FOR_X2C                 = "192.168.12.75/23";
+        GNB_PORT_FOR_X2C                         = 36422; # Spec 36422
+    };
+  }
+);
+
+MACRLCs = (
+	{
+	num_cc = 1;
+	tr_s_preference = "local_L1";
+	tr_n_preference = "local_RRC";
+        }  
+);
+
+L1s = (
+    	{
+	num_cc = 1;
+	tr_n_preference = "local_mac";
+        }  
+);
+
+RUs = (
+    {		  
+       local_rf       = "yes"
+         nb_tx          = 1
+         nb_rx          = 1
+         att_tx         = 0
+         att_rx         = 0;
+         bands          = [7];
+         max_pdschReferenceSignalPower = -27;
+         max_rxgain                    = 114;
+         eNB_instances  = [0];
+	 sdr_addrs = "addr=192.168.20.2,mgmt_addr=192.168.20.2";
+         clock_src = "internal";
+    }
+);  
+
+THREAD_STRUCT = (
+  {
+    #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT"
+    parallel_config    = "PARALLEL_RU_L1_TRX_SPLIT";
+    #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE"
+    worker_config      = "WORKER_ENABLE";
+  }
+);
+
+     log_config :
+     {
+       global_log_level                      ="info";
+       global_log_verbosity                  ="medium";
+       hw_log_level                          ="info";
+       hw_log_verbosity                      ="medium";
+       phy_log_level                         ="info";
+       phy_log_verbosity                     ="medium";
+       mac_log_level                         ="info";
+       mac_log_verbosity                     ="high";
+       rlc_log_level                         ="info";
+       rlc_log_verbosity                     ="medium";
+       pdcp_log_level                        ="info";
+       pdcp_log_verbosity                    ="medium";
+       rrc_log_level                         ="info";
+       rrc_log_verbosity                     ="medium";
+    };
-- 
GitLab