From ea6524c52f55bf5c97c219c3e23dde9abe45040d Mon Sep 17 00:00:00 2001
From: Hongzhi Wang <hongzhi.wang@openairinterface.org>
Date: Wed, 24 Aug 2022 08:27:14 +0200
Subject: [PATCH] update cmakelists and ulsim

---
 cmake_targets/CMakeLists.txt       | 8 +-------
 openair1/SIMULATION/NR_PHY/ulsim.c | 8 ++++----
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt
index a603604911..e3b53d451f 100644
--- a/cmake_targets/CMakeLists.txt
+++ b/cmake_targets/CMakeLists.txt
@@ -831,14 +831,8 @@ TARGET_LINK_LIBRARIES(benetel_5g pthread dl rt m numa)
 # LDPC offload library
 ##########################################################
 
-include_directories ("/usr/local/include")
-
-set(HWLIB_LDPC_OFFLOAD_SOURCE
-   ${OPENAIR1_DIR}/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_offload.c
-  )
-
 if(EXISTS  "/usr/local/lib64/librte_pmd_hpac_sdfec_pmd.so")
-add_library(ldpc_offload MODULE ${HWLIB_LDPC_OFFLOAD_SOURCE} )
+add_library(ldpc_offload MODULE ${OPENAIR1_DIR}/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_offload.c)
 
 set_target_properties(ldpc_offload PROPERTIES COMPILE_FLAGS "-include rte_config.h  -march=native -I/usr/local/include -DALLOW_EXPERIMENTAL_API")
 
diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c
index 8c0febfa0e..5784ca0b83 100644
--- a/openair1/SIMULATION/NR_PHY/ulsim.c
+++ b/openair1/SIMULATION/NR_PHY/ulsim.c
@@ -361,7 +361,7 @@ int main(int argc, char **argv)
   /* initialize the sin-cos table */
    InitSinLUT();
 
-  while ((c = getopt(argc, argv, "a:b:c:d:ef:g:h:i:kl:m:n:o:p:q:r:s:t:u:v:w:y:z:F:G:H:I:M:N:PR:S:T:U:L:ZW:")) != -1) {
+  while ((c = getopt(argc, argv, "a:b:c:d:ef:g:h:i:kl:m:n:op:q:r:s:t:u:v:w:y:z:C:F:G:H:I:M:N:PR:S:T:U:L:ZW:")) != -1) {
     printf("handling optarg %c\n",c);
     switch (c) {
 
@@ -481,7 +481,7 @@ int main(int argc, char **argv)
       break;
 
     case 'o':
-      ldpc_offload_flag = atoi(optarg);
+      ldpc_offload_flag = 1;
       break;
       
     case 'p':
@@ -646,6 +646,7 @@ int main(int argc, char **argv)
       //printf("-x Transmission mode (1,2,6 for the moment)\n");
       printf("-y Number of TX antennas used at UE\n");
       printf("-z Number of RX antennas used at gNB\n");
+      printf("-v Set the max rounds\n");
       printf("-A Interpolation_filname Run with Abstraction to generate Scatter plot using interpolation polynomial in file\n");
       //printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n");
       printf("-F Input filename (.txt format) for RX conformance testing\n");
@@ -1070,14 +1071,13 @@ int main(int argc, char **argv)
   double blerStats[4][100];
   double berStats[4][100];
   double snrStats[100];
-  double ldpcDecStats[100];
+  double ldpcDecStats[100] = {0};
   memset(errors_scrambling, 0, sizeof(uint32_t)*4*100);
   memset(n_errors, 0, sizeof(int)*4*100);
   memset(round_trials, 0, sizeof(int)*4*100);
   memset(blerStats, 0, sizeof(double)*4*100);
   memset(berStats, 0, sizeof(double)*4*100);
   memset(snrStats, 0, sizeof(double)*100);
-  memset(ldpcDecStats, 0, sizeof(double)*100);
   for (SNR = snr0; SNR < snr1; SNR += snr_step) {
     varArray_t *table_rx=initVarArray(1000,sizeof(double));
     int error_flag = 0;
-- 
2.26.2