Commit 1fd43c28 authored by Guy De Souza's avatar Guy De Souza

Interleaving optimization

parent 0234d377
...@@ -143,7 +143,7 @@ void nr_pbch_scrambling(NR_gNB_PBCH *pbch, ...@@ -143,7 +143,7 @@ void nr_pbch_scrambling(NR_gNB_PBCH *pbch,
uint8_t *pbch_e = pbch->pbch_e; uint8_t *pbch_e = pbch->pbch_e;
uint32_t *pbch_a_prime = (uint32_t*)pbch->pbch_a_prime; uint32_t *pbch_a_prime = (uint32_t*)pbch->pbch_a_prime;
uint32_t *pbch_a_interleaved = (uint32_t*)pbch->pbch_a_interleaved; uint32_t *pbch_a_interleaved = (uint32_t*)pbch->pbch_a_interleaved;
uint32_t unscrambling_mask = 0x87002D; uint32_t unscrambling_mask = 0x100006D;
reset = 1; reset = 1;
// x1 is set in lte_gold_generic // x1 is set in lte_gold_generic
...@@ -177,7 +177,8 @@ void nr_pbch_scrambling(NR_gNB_PBCH *pbch, ...@@ -177,7 +177,8 @@ void nr_pbch_scrambling(NR_gNB_PBCH *pbch,
} }
} }
uint8_t nr_pbch_payload_interleaving_pattern[32] = {16, 23, 18, 17, 8, 30, 10, 6, 24, 7, 0, 5, 3, 2, 1, 4, /* This portion of code is temporarily kept until the optimized version is validated
* uint8_t nr_pbch_payload_interleaving_pattern[32] = {16, 23, 18, 17, 8, 30, 10, 6, 24, 7, 0, 5, 3, 2, 1, 4,
9, 11, 12, 13, 14, 15, 19, 20, 21, 22, 25, 26, 27, 28, 29, 31}; 9, 11, 12, 13, 14, 15, 19, 20, 21, 22, 25, 26, 27, 28, 29, 31};
uint8_t nr_pbch_payload_interleaver(uint8_t i) { uint8_t nr_pbch_payload_interleaver(uint8_t i) {
...@@ -191,7 +192,11 @@ uint8_t nr_pbch_payload_interleaver(uint8_t i) { ...@@ -191,7 +192,11 @@ uint8_t nr_pbch_payload_interleaver(uint8_t i) {
return nr_pbch_payload_interleaving_pattern[j_ssb + (i-29)]; return nr_pbch_payload_interleaving_pattern[j_ssb + (i-29)];
else else
return nr_pbch_payload_interleaving_pattern[j_other + i]; return nr_pbch_payload_interleaving_pattern[j_other + i];
} }*/
/*This pattern takes into account the adjustments for the field specific counters j_sfn, j_hrf, j_ssb and j_other*/
uint8_t nr_pbch_payload_interleaving_pattern[32] = {1,4,9,11,12,13,14,15,19,20,21,22,25,26,27,28,
29,31,16,23,18,17,8,30,10,6,24,7,0,5,3,2};
int nr_generate_pbch(NR_gNB_PBCH *pbch, int nr_generate_pbch(NR_gNB_PBCH *pbch,
uint8_t *pbch_pdu, uint8_t *pbch_pdu,
...@@ -251,7 +256,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch, ...@@ -251,7 +256,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
in |= (uint32_t)(pbch->pbch_a[i]<<((3-i)<<3)); in |= (uint32_t)(pbch->pbch_a[i]<<((3-i)<<3));
for (int i=0; i<32; i++) { for (int i=0; i<32; i++) {
out |= ((in>>i)&1)<<(nr_pbch_payload_interleaver(i)); out |= ((in>>i)&1)<<(nr_pbch_payload_interleaving_pattern[i]);
#ifdef DEBUG_PBCH_ENCODING #ifdef DEBUG_PBCH_ENCODING
printf("i %d in 0x%08x out 0x%08x ilv %d (in>>i)&1) 0x%08x\n", i, in, out, nr_pbch_payload_interleaver(i), (in>>i)&1); printf("i %d in 0x%08x out 0x%08x ilv %d (in>>i)&1) 0x%08x\n", i, in, out, nr_pbch_payload_interleaver(i), (in>>i)&1);
#endif #endif
...@@ -289,7 +294,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch, ...@@ -289,7 +294,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
/// Scrambling /// Scrambling
M = NR_POLAR_PBCH_E; M = NR_POLAR_PBCH_E;
nushift = (Lmax==4)? ssb_index&3 : ssb_index&7; nushift = (Lmax==4)? ssb_index&3 : ssb_index&7;
nr_pbch_scrambling(pbch, (uint32_t)config->sch_config.physical_cell_id.value, (Lmax), M, NR_POLAR_PBCH_E, 0); nr_pbch_scrambling(pbch, (uint32_t)config->sch_config.physical_cell_id.value, nushift, M, NR_POLAR_PBCH_E, 0);
#ifdef DEBUG_PBCH_ENCODING #ifdef DEBUG_PBCH_ENCODING
printf("Scrambling:\n"); printf("Scrambling:\n");
for (int i=0; i<NR_POLAR_PBCH_E>>3; i++) for (int i=0; i<NR_POLAR_PBCH_E>>3; i++)
......
...@@ -238,7 +238,7 @@ void nr_feptx_ofdm(RU_t *ru) { ...@@ -238,7 +238,7 @@ void nr_feptx_ofdm(RU_t *ru) {
} }
// if S-subframe generate first slot only // if S-subframe generate first slot only
if (nr_subframe_select(fp,subframe) == SF_S) if (nr_subframe_select(cfg,subframe) == SF_S)
len = fp->samples_per_subframe / fp->slots_per_subframe; len = fp->samples_per_subframe / fp->slots_per_subframe;
else else
len = fp->samples_per_subframe; len = fp->samples_per_subframe;
......
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