Commit debd35a8 authored by luis_pereira87's avatar luis_pereira87

Apply function with better performance to reverse bits for polar encoder/decoder in PBCH

parent 2360925e
...@@ -236,7 +236,6 @@ int nr_generate_pbch(nfapi_nr_dl_tti_ssb_pdu *ssb_pdu, ...@@ -236,7 +236,6 @@ int nr_generate_pbch(nfapi_nr_dl_tti_ssb_pdu *ssb_pdu,
uint16_t M; uint16_t M;
uint8_t nushift; uint8_t nushift;
uint32_t unscrambling_mask; uint32_t unscrambling_mask;
uint64_t a_reversed=0;
LOG_D(PHY, "PBCH generation started\n"); LOG_D(PHY, "PBCH generation started\n");
///Payload generation ///Payload generation
NR_gNB_PBCH m_pbch; NR_gNB_PBCH m_pbch;
...@@ -298,8 +297,7 @@ int nr_generate_pbch(nfapi_nr_dl_tti_ssb_pdu *ssb_pdu, ...@@ -298,8 +297,7 @@ int nr_generate_pbch(nfapi_nr_dl_tti_ssb_pdu *ssb_pdu,
#endif #endif
// Encoder reversal // Encoder reversal
for (int i=0; i<NR_POLAR_PBCH_PAYLOAD_BITS; i++) uint64_t a_reversed = reverse_bits((uint64_t)pbch->pbch_a_prime, NR_POLAR_PBCH_PAYLOAD_BITS);
a_reversed |= (((uint64_t)pbch->pbch_a_prime>>i)&1)<<(31-i);
/// CRC, coding and rate matching /// CRC, coding and rate matching
polar_encoder_fast (&a_reversed, (void*)pbch->pbch_e, 0, 0, polar_encoder_fast (&a_reversed, (void*)pbch->pbch_e, 0, 0,
......
...@@ -493,12 +493,8 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue, ...@@ -493,12 +493,8 @@ int nr_rx_pbch(PHY_VARS_NR_UE *ue,
} }
// printf("polar decoder output 0x%08x\n",pbch_a_prime); // printf("polar decoder output 0x%08x\n",pbch_a_prime);
// Decoder reversal // Decoder reversal
uint32_t a_reversed=0; pbch_a_prime = (uint32_t)reverse_bits(pbch_a_prime, NR_POLAR_PBCH_PAYLOAD_BITS);
for (int i=0; i<NR_POLAR_PBCH_PAYLOAD_BITS; i++)
a_reversed |= (((uint64_t)pbch_a_prime>>i)&1)<<(31-i);
pbch_a_prime = a_reversed;
//payload un-scrambling //payload un-scrambling
M = (Lmax == 64)? (NR_POLAR_PBCH_PAYLOAD_BITS - 6) : (NR_POLAR_PBCH_PAYLOAD_BITS - 3); M = (Lmax == 64)? (NR_POLAR_PBCH_PAYLOAD_BITS - 6) : (NR_POLAR_PBCH_PAYLOAD_BITS - 3);
nushift = ((pbch_a_prime>>24)&1) ^ (((pbch_a_prime>>6)&1)<<1); nushift = ((pbch_a_prime>>24)&1) ^ (((pbch_a_prime>>6)&1)<<1);
......
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