MIB interleaving correction
This commit is contained in:
@@ -143,6 +143,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
|
||||
}
|
||||
|
||||
nr_init_pdcch_dmrs(gNB, cfg->sch_config.physical_cell_id.value);
|
||||
nr_init_pbch_interleaver(gNB->nr_pbch_interleaver);
|
||||
|
||||
/*
|
||||
lte_gold(fp,gNB->lte_gold_table,fp->Nid_cell);
|
||||
|
||||
@@ -39,9 +39,11 @@
|
||||
//#define DEBUG_PBCH_ENCODING
|
||||
//#define DEBUG_PBCH_DMRS
|
||||
|
||||
//extern short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT];
|
||||
#include "PHY/NR_REFSIG/nr_mod_table.h"
|
||||
|
||||
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};
|
||||
|
||||
int nr_generate_pbch_dmrs(uint32_t *gold_pbch_dmrs,
|
||||
int32_t **txdataF,
|
||||
int16_t amp,
|
||||
@@ -163,7 +165,7 @@ void nr_pbch_scrambling(NR_gNB_PBCH *pbch,
|
||||
x2 = Nid;
|
||||
// The Gold sequence is shifted by nushift* M, so we skip (nushift*M /32) double words
|
||||
for (int i=0; i<(uint16_t)ceil(((float)nushift*M)/32); i++) {
|
||||
s = lte_gold_generic(&x1, &x2, reset);
|
||||
s = lte_gold_generic(&x1, &x2, reset);
|
||||
reset = 0;
|
||||
}
|
||||
// Scrambling is now done with offset (nushift*M)%32
|
||||
@@ -188,21 +190,19 @@ s = lte_gold_generic(&x1, &x2, reset);
|
||||
}
|
||||
}
|
||||
|
||||
// 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};
|
||||
uint8_t nr_pbch_init_interleaver(uint8_t *interleaver) {
|
||||
uint8_t j_sfn=0, j_hrf=10, j_ssb=11, j_other=14;
|
||||
memset((void*)interleaver,0, NR_POLAR_PBCH_PAYLOAD_BITS);
|
||||
|
||||
uint8_t nr_pbch_payload_interleaver(uint8_t i) {
|
||||
uint8_t j_sfn=6, j_hrf=10, j_ssb=11, j_other=14;
|
||||
|
||||
if (24<=i && i<=27) //Sfn bits
|
||||
return nr_pbch_payload_interleaving_pattern[j_sfn + i -24];
|
||||
else if (i==28) // Hrf bit
|
||||
return nr_pbch_payload_interleaving_pattern[j_hrf];
|
||||
else if (29<=i) // Ssb bits
|
||||
return nr_pbch_payload_interleaving_pattern[j_ssb + (i-29)];
|
||||
else
|
||||
return nr_pbch_payload_interleaving_pattern[(j_other + i)&0x1f];
|
||||
for (int i=0; i<NR_POLAR_PBCH_PAYLOAD_BITS; i++)
|
||||
if ((i<6)||(23<i && i<28)) //Sfn bits
|
||||
*(interleaver+j_sfn++) = *(nr_pbch_payload_interleaving_pattern+i);
|
||||
else if (i==28) // Hrf bit
|
||||
*(interleaver+j_hrf) = *(nr_pbch_payload_interleaving_pattern+i);
|
||||
else if (i>28) // Ssb bits
|
||||
*(interleaver+j_ssb) = *(nr_pbch_payload_interleaving_pattern+i);
|
||||
else
|
||||
*(interleaver+j_other) = *(nr_pbch_payload_interleaving_pattern+i);
|
||||
}
|
||||
|
||||
/*This pattern takes into account the adjustments for the field specific counters j_sfn, j_hrf, j_ssb and j_other*/
|
||||
@@ -212,6 +212,7 @@ uint8_t nr_pbch_payload_interleaver(uint8_t i) {
|
||||
int nr_generate_pbch(NR_gNB_PBCH *pbch,
|
||||
t_nrPolar_paramsPtr polar_params,
|
||||
uint8_t *pbch_pdu,
|
||||
uint8_t *interleaver,
|
||||
int32_t **txdataF,
|
||||
int16_t amp,
|
||||
uint8_t ssb_start_symbol,
|
||||
@@ -269,10 +270,10 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
|
||||
for (int i=0; i<NR_POLAR_PBCH_PAYLOAD_BITS>>3; i++)
|
||||
in |= (uint32_t)(pbch->pbch_a[i]<<((3-i)<<3));
|
||||
|
||||
for (int i=0; i<32; i++) {
|
||||
pbch->pbch_a_interleaved |= ((in>>i)&1)<<(nr_pbch_payload_interleaver(i));//nr_pbch_payload_interleaving_pattern[i]
|
||||
for (int i=0; i<NR_POLAR_PBCH_PAYLOAD_BITS; i++) {
|
||||
pbch->pbch_a_interleaved |= ((in>>i)&1)<<(*(interleaver+i));
|
||||
#ifdef DEBUG_PBCH_ENCODING
|
||||
printf("i %d in 0x%08x out 0x%08x ilv %d (in>>i)&1) %d\n", i, in, pbch->pbch_a_interleaved, nr_pbch_payload_interleaver(i), (in>>i)&1);
|
||||
printf("i %d in 0x%08x out 0x%08x ilv %d (in>>i)&1) %d\n", i, in, pbch->pbch_a_interleaved, *(interleaver+i), (in>>i)&1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -86,6 +86,7 @@ void nr_pbch_scrambling(NR_gNB_PBCH *pbch,
|
||||
int nr_generate_pbch(NR_gNB_PBCH *pbch,
|
||||
t_nrPolar_paramsPtr polar_params,
|
||||
uint8_t *pbch_pdu,
|
||||
uint8_t *interleaver,
|
||||
int32_t **txdataF,
|
||||
int16_t amp,
|
||||
uint8_t ssb_start_symbol,
|
||||
|
||||
@@ -315,6 +315,9 @@ typedef struct PHY_VARS_gNB_s {
|
||||
/// PBCH DMRS sequence
|
||||
uint32_t nr_gold_pbch_dmrs[2][64][NR_PBCH_DMRS_LENGTH_DWORD];
|
||||
|
||||
/// PBCH interleaver
|
||||
uint8_t nr_pbch_interleaver[NR_POLAR_PBCH_PAYLOAD_BITS];
|
||||
|
||||
/// PDCCH DMRS sequence
|
||||
uint32_t ***nr_gold_pdcch_dmrs;
|
||||
|
||||
|
||||
@@ -146,7 +146,15 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int subframe) {
|
||||
gNB->pbch_configured = 0;
|
||||
}
|
||||
nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[n_hf][ssb_index],txdataF, AMP_OVER_2, ssb_start_symbol, cfg, fp);
|
||||
nr_generate_pbch(&gNB->pbch, gNB->nrPolar_params, pbch_pdu, txdataF, AMP_OVER_2, ssb_start_symbol, n_hf, Lmax, ssb_index, frame, cfg, fp);
|
||||
nr_generate_pbch(&gNB->pbch,
|
||||
gNB->nrPolar_params,
|
||||
pbch_pdu,
|
||||
gNB->nr_pbch_interleaver,
|
||||
txdataF,
|
||||
AMP_OVER_2,
|
||||
ssb_start_symbol,
|
||||
n_hf,Lmax,ssb_index,
|
||||
frame, cfg, fp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user