From 3c22d7e2d072f67ad33fac08f947847770d76ac4 Mon Sep 17 00:00:00 2001
From: Raymond Knopp <raymond.knopp@eurecom.fr>
Date: Wed, 2 Jan 2019 20:32:40 +0100
Subject: [PATCH] error statistics for nr_pbchsim

---
 openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c | 2 +-
 openair1/PHY/INIT/nr_init_ue.c                       | 2 --
 openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c               | 1 -
 openair1/SIMULATION/NR_PHY/pbchsim.c                 | 2 +-
 4 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
index 5052c9bca5..afc0f7c015 100644
--- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
+++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_decoder.c
@@ -1138,7 +1138,7 @@ uint32_t polar_decoder_int16(int16_t *input,
   }
   else if (len<=64) {
     Ar = (B[0]>>crclen) | (B[1]<<(64-crclen));;
-    uint8_t A64_flip[4];
+    uint8_t A64_flip[8];
     uint64_t Aprime= (uint32_t)(Ar<<(64-len));
     A64_flip[0]=((uint8_t*)&Aprime)[7];
     A64_flip[1]=((uint8_t*)&Aprime)[6];
diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c
index ae1011095f..a5f0558e8e 100644
--- a/openair1/PHY/INIT/nr_init_ue.c
+++ b/openair1/PHY/INIT/nr_init_ue.c
@@ -985,8 +985,6 @@ void set_default_frame_parms_single(nfapi_nr_config_request_t *config, NR_DL_FRA
         config->subframe_config.dl_cyclic_prefix_type.value = 0; //NORMAL
         config->rf_config.dl_carrier_bandwidth.value = 106;
         config->rf_config.ul_carrier_bandwidth.value = 106;
-        config->rf_config.tx_antenna_ports.value = 1;
-        config->rf_config.rx_antenna_ports.value = 1;
         config->sch_config.physical_cell_id.value = 0;
 
         frame_parms->frame_type          = FDD;
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
index 9cef5287a6..3e255ab03a 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
@@ -672,7 +672,6 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
 
   decoderState = polar_decoder_int16(pbch_e_rx,(uint8_t*)&nr_ue_pbch_vars->pbch_a_prime,currentPtr);
 
-
   if(decoderState > 0)	return(decoderState);
   	
   //  printf("polar decoder output 0x%08x\n",nr_ue_pbch_vars->pbch_a_prime);
diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c
index 754345e19f..1869c8b3b3 100644
--- a/openair1/SIMULATION/NR_PHY/pbchsim.c
+++ b/openair1/SIMULATION/NR_PHY/pbchsim.c
@@ -584,7 +584,7 @@ int main(int argc, char **argv)
 	    n_errors_payload++;
 	}
 
-	if (ret<0) n_errors++;
+	if (ret!=0) n_errors++;
       }
     } //noise trials
 
-- 
2.26.2