Commit e3bbfe77 authored by Guy De Souza's avatar Guy De Souza

Scrambling issue/ cell ID above 255

parent 70d241fb
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
void nr_init_pbch_dmrs(PHY_VARS_gNB* gNB) void nr_init_pbch_dmrs(PHY_VARS_gNB* gNB)
{ {
unsigned int x1, x2; 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; unsigned char Lmax, l, n_hf, N_hf;
nfapi_nr_config_request_t *cfg = &gNB->gNB_config; nfapi_nr_config_request_t *cfg = &gNB->gNB_config;
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
/*! \file PHY/NR_TRANSPORT/nr_pbch.c /*! \file PHY/NR_TRANSPORT/nr_pbch.c
* \brief Top-level routines for generating the PBCH/BCH physical/transport channel V15.1 03/2018 * \brief Top-level routines for generating the PBCH/BCH physical/transport channel V15.1 03/2018
* \author Guy De Souza * \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 * \date 2018
* \version 0.1 * \version 0.1
* \company Eurecom * \company Eurecom
...@@ -190,7 +190,6 @@ void nr_pbch_scrambling(NR_gNB_PBCH *pbch, ...@@ -190,7 +190,6 @@ void nr_pbch_scrambling(NR_gNB_PBCH *pbch,
s = lte_gold_generic(&x1, &x2, reset); s = lte_gold_generic(&x1, &x2, reset);
reset = 0; reset = 0;
} }
pbch->pbch_a_prime ^= (((pbch->pbch_a_interleaved>>i)&1) ^ ((s>>((k+offset)&0x1f))&1))<<i; pbch->pbch_a_prime ^= (((pbch->pbch_a_interleaved>>i)&1) ^ ((s>>((k+offset)&0x1f))&1))<<i;
k++; /// k increase only when payload bit is not special bit k++; /// k increase only when payload bit is not special bit
} }
......
...@@ -458,22 +458,28 @@ void nr_pbch_unscrambling(NR_UE_PBCH *pbch, ...@@ -458,22 +458,28 @@ void nr_pbch_unscrambling(NR_UE_PBCH *pbch,
offset = (nushift*M)&0x1f; offset = (nushift*M)&0x1f;
for (int i=0; i<length; i++) { for (int i=0; i<length; i++) {
if (((i+offset)&0x1f)==0) { /*if (((i+offset)&0x1f)==0) {
s = lte_gold_generic(&x1, &x2, reset);
reset = 0;
}*/
if (bitwise) {
if (((k+offset)&0x1f)==0 && (!((unscrambling_mask>>i)&1))) {
s = lte_gold_generic(&x1, &x2, reset); s = lte_gold_generic(&x1, &x2, reset);
reset = 0; reset = 0;
} }
(pbch->pbch_a_interleaved) ^= ((unscrambling_mask>>i)&1)? ((pbch->pbch_a_prime>>i)&1)<<i : (((pbch->pbch_a_prime>>i)&1) ^ ((s>>((k+offset)&0x1f))&1))<<i;
k += (!((unscrambling_mask>>i)&1));
#ifdef DEBUG_PBCH_ENCODING #ifdef DEBUG_PBCH_ENCODING
if (i<8) 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)));
printf("s: %04x\t", s);
printf("pbch_a_interleaved 0x%08x\n", pbch->pbch_a_interleaved);
#endif #endif
if (bitwise) {
(pbch->pbch_a_interleaved) ^= ((unscrambling_mask>>i)&1)? ((pbch->pbch_a_prime>>i)&1)<<i : (((pbch->pbch_a_prime>>i)&1) ^ ((s>>((k+offset)&0x1f))&1))<<i;
k+=!((unscrambling_mask>>i)&1);
} }
else { else {
if (((i+offset)&0x1f)==0) {
s = lte_gold_generic(&x1, &x2, reset);
reset = 0;
}
if (((s>>((i+offset)&0x1f))&1)==1) if (((s>>((i+offset)&0x1f))&1)==1)
demod_pbch_e[i] = -demod_pbch_e[i]; demod_pbch_e[i] = -demod_pbch_e[i];
#ifdef DEBUG_PBCH_ENCODING #ifdef DEBUG_PBCH_ENCODING
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment