Encoding debug data
This commit is contained in:
@@ -156,12 +156,18 @@ void nr_pbch_scrambling(NR_gNB_PBCH *pbch,
|
|||||||
}
|
}
|
||||||
// Scrambling is now done with offset (nushift*M)%32
|
// Scrambling is now done with offset (nushift*M)%32
|
||||||
offset = (nushift*M)&0x1f;
|
offset = (nushift*M)&0x1f;
|
||||||
|
#ifdef DEBUG_PBCH_ENCODING
|
||||||
|
printf("Scrambling params: nushift %d M %d length %d bitwise %d offset %d\n", nushift, M, length, bitwise, offset);
|
||||||
|
#endif
|
||||||
|
|
||||||
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);
|
s = lte_gold_generic(&x1, &x2, reset);
|
||||||
reset = 0;
|
reset = 0;
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG_PBCH_ENCODING
|
||||||
|
printf("s: %04x\n", s);
|
||||||
|
#endif
|
||||||
if (bitwise) {
|
if (bitwise) {
|
||||||
(*pbch_a_prime) ^= ((unscrambling_mask>>i)&1)? (((*pbch_a_interleaved)>>i)&1)<<i : ((((*pbch_a_interleaved)>>i)&1) ^ ((s>>((i+offset)&0x1f))&1))<<i;
|
(*pbch_a_prime) ^= ((unscrambling_mask>>i)&1)? (((*pbch_a_interleaved)>>i)&1)<<i : ((((*pbch_a_interleaved)>>i)&1) ^ ((s>>((i+offset)&0x1f))&1))<<i;
|
||||||
}
|
}
|
||||||
@@ -256,20 +262,31 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
|
|||||||
nushift = (((sfn>>2)&1)<<1) ^ ((sfn>>1)&1);
|
nushift = (((sfn>>2)&1)<<1) ^ ((sfn>>1)&1);
|
||||||
nr_pbch_scrambling(pbch, (uint32_t)config->sch_config.physical_cell_id.value, nushift, M, NR_POLAR_PBCH_PAYLOAD_BITS, 1);
|
nr_pbch_scrambling(pbch, (uint32_t)config->sch_config.physical_cell_id.value, nushift, M, NR_POLAR_PBCH_PAYLOAD_BITS, 1);
|
||||||
#ifdef DEBUG_PBCH_ENCODING
|
#ifdef DEBUG_PBCH_ENCODING
|
||||||
|
printf("Payload scrambling:\n");
|
||||||
|
for (int i=0; i<4; i++)
|
||||||
|
printf("pbch_a_prime[%d]: 0x%04x\n", i, pbch->pbch_a_prime[i]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/// CRC, coding and rate matching
|
/// CRC, coding and rate matching
|
||||||
polar_encoder (pbch->pbch_a_prime, pbch->pbch_e, &frame_parms->pbch_polar_params);
|
polar_encoder (pbch->pbch_a_prime, pbch->pbch_e, &frame_parms->pbch_polar_params);
|
||||||
#ifdef DEBUG_PBCH_ENCODING
|
#ifdef DEBUG_PBCH_ENCODING
|
||||||
|
printf("Channel coding:\n");
|
||||||
|
for (int i=0; i<NR_POLAR_PBCH_E>>3; i++)
|
||||||
|
printf("pbch_e[%d]: 0x%04x", i, pbch->pbch_e[i]);
|
||||||
|
printf("\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Scrambling
|
/// Scrambling
|
||||||
M = NR_POLAR_PBCH_E;
|
M = NR_POLAR_PBCH_E;
|
||||||
nushift = config->sch_config.physical_cell_id.value &3;;
|
nushift = config->sch_config.physical_cell_id.value &3;;
|
||||||
nr_pbch_scrambling(pbch, (uint32_t)config->sch_config.physical_cell_id.value, nushift, 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
|
||||||
|
printf("Scrambling:\n");
|
||||||
|
for (int i=0; i<NR_POLAR_PBCH_E>>3; i++)
|
||||||
|
printf("pbch_e[%d]: 0x%04x", i, pbch->pbch_e[i]);
|
||||||
|
printf("\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
/// QPSK modulation
|
/// QPSK modulation
|
||||||
for (int i=0; i<NR_POLAR_PBCH_E>>1; i++){
|
for (int i=0; i<NR_POLAR_PBCH_E>>1; i++){
|
||||||
|
|||||||
Reference in New Issue
Block a user