From e3bbfe7712f50ad9259bde7303ce3832ed54435b Mon Sep 17 00:00:00 2001 From: Guy De Souza Date: Tue, 18 Dec 2018 17:36:26 +0100 Subject: [PATCH] Scrambling issue/ cell ID above 255 --- openair1/PHY/NR_REFSIG/nr_gold.c | 2 +- openair1/PHY/NR_TRANSPORT/nr_pbch.c | 3 +-- openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c | 30 +++++++++++++++----------- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/openair1/PHY/NR_REFSIG/nr_gold.c b/openair1/PHY/NR_REFSIG/nr_gold.c index b8197744ec..c4e59f907a 100644 --- a/openair1/PHY/NR_REFSIG/nr_gold.c +++ b/openair1/PHY/NR_REFSIG/nr_gold.c @@ -24,7 +24,7 @@ void nr_init_pbch_dmrs(PHY_VARS_gNB* gNB) { unsigned int x1, x2; - unsigned char Nid, i_ssb, i_ssb2; + uint16_t Nid, i_ssb, i_ssb2; unsigned char Lmax, l, n_hf, N_hf; nfapi_nr_config_request_t *cfg = &gNB->gNB_config; NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; diff --git a/openair1/PHY/NR_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_TRANSPORT/nr_pbch.c index d2b917f809..4f671bb264 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_pbch.c @@ -22,7 +22,7 @@ /*! \file PHY/NR_TRANSPORT/nr_pbch.c * \brief Top-level routines for generating the PBCH/BCH physical/transport channel V15.1 03/2018 * \author Guy De Souza -* \thanks Special Thanks to Son Dang for helpfull contributions and testing +* \thanks Special Thanks to Son Dang for helpful contributions and testing * \date 2018 * \version 0.1 * \company Eurecom @@ -190,7 +190,6 @@ void nr_pbch_scrambling(NR_gNB_PBCH *pbch, s = lte_gold_generic(&x1, &x2, reset); reset = 0; } - pbch->pbch_a_prime ^= (((pbch->pbch_a_interleaved>>i)&1) ^ ((s>>((k+offset)&0x1f))&1))<>i)&1))) { + s = lte_gold_generic(&x1, &x2, reset); + reset = 0; + } + (pbch->pbch_a_interleaved) ^= ((unscrambling_mask>>i)&1)? ((pbch->pbch_a_prime>>i)&1)<pbch_a_prime>>i)&1) ^ ((s>>((k+offset)&0x1f))&1))<>i)&1)); +#ifdef DEBUG_PBCH_ENCODING + printf("i %d k %d offset %d (unscrambling_mask>>i)&1) %d s: %08x\t pbch_a_interleaved 0x%08x (!((unscrambling_mask>>i)&1)) %d\n", i, k, offset, (unscrambling_mask>>i)&1, s, pbch->pbch_a_interleaved, (!((unscrambling_mask>>i)&1))); +#endif + } + + else { if (((i+offset)&0x1f)==0) { s = lte_gold_generic(&x1, &x2, reset); reset = 0; } -#ifdef DEBUG_PBCH_ENCODING - if (i<8) - printf("s: %04x\t", s); - printf("pbch_a_interleaved 0x%08x\n", pbch->pbch_a_interleaved); -#endif - if (bitwise) { - - (pbch->pbch_a_interleaved) ^= ((unscrambling_mask>>i)&1)? ((pbch->pbch_a_prime>>i)&1)<pbch_a_prime>>i)&1) ^ ((s>>((k+offset)&0x1f))&1))<>i)&1); - } - - else { if (((s>>((i+offset)&0x1f))&1)==1) demod_pbch_e[i] = -demod_pbch_e[i]; #ifdef DEBUG_PBCH_ENCODING