Commit 91a47eb9 authored by Guy De Souza's avatar Guy De Souza

Payload check in pbchsim

parent b12d6b73
...@@ -277,7 +277,8 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch, ...@@ -277,7 +277,8 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
else else
pbch->pbch_a |= ((config->sch_config.ssb_subcarrier_offset.value>>4)&1)<<29; //MSB of k_SSB (bit index 4) pbch->pbch_a |= ((config->sch_config.ssb_subcarrier_offset.value>>4)&1)<<29; //MSB of k_SSB (bit index 4)
LOG_I(PHY,"After extra byte: pbch_a = 0x%08x\n",pbch->pbch_a); //LOG_I(PHY,"After extra byte: pbch_a = 0x%08x\n",pbch->pbch_a);
printf("After extra byte: pbch_a = 0x%08x\n",pbch->pbch_a);
// Payload interleaving // Payload interleaving
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#include "PHY/LTE_REFSIG/lte_refsig.h" #include "PHY/LTE_REFSIG/lte_refsig.h"
//#define DEBUG_PBCH 1 //#define DEBUG_PBCH 1
#define DEBUG_PBCH_ENCODING //#define DEBUG_PBCH_ENCODING
#ifdef OPENAIR2 #ifdef OPENAIR2
//#include "PHY_INTERFACE/defs.h" //#include "PHY_INTERFACE/defs.h"
...@@ -508,7 +508,7 @@ unsigned char sign(int8_t x) { ...@@ -508,7 +508,7 @@ unsigned char sign(int8_t x) {
} }
*/ */
uint8_t pbch_deinterleaving_pattern[32] = {28,0,31,30,7,29,25,27,5,8,24,9,10,11,12,13,1,4,3,14,15,16,17,2,26,18,19,20,21,22,30,23}; uint8_t pbch_deinterleaving_pattern[32] = {28,0,31,30,7,29,25,27,5,8,24,9,10,11,12,13,1,4,3,14,15,16,17,2,26,18,19,20,21,22,6,23};
int nr_rx_pbch( PHY_VARS_NR_UE *ue, int nr_rx_pbch( PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc, UE_nr_rxtx_proc_t *proc,
...@@ -673,16 +673,15 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, ...@@ -673,16 +673,15 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
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 = ((nr_ue_pbch_vars->pbch_a_prime>>24)&1) ^ (((nr_ue_pbch_vars->pbch_a_prime>>6)&1)<<1); nushift = ((nr_ue_pbch_vars->pbch_a_prime>>24)&1) ^ (((nr_ue_pbch_vars->pbch_a_prime>>6)&1)<<1);
nr_pbch_unscrambling(nr_ue_pbch_vars,frame_parms->Nid_cell,nushift,M,NR_POLAR_PBCH_PAYLOAD_BITS,1,unscrambling_mask); nr_pbch_unscrambling(nr_ue_pbch_vars,frame_parms->Nid_cell,nushift,M,NR_POLAR_PBCH_PAYLOAD_BITS,1,unscrambling_mask);
printf("nushift %d sfn 3rd %d 2nd %d\n", nushift,((nr_ue_pbch_vars->pbch_a_prime>>6)&1), ((nr_ue_pbch_vars->pbch_a_prime>>24)&1) );
//payload deinterleaving //payload deinterleaving
//uint32_t in=0; //uint32_t in=0;
uint32_t out=0; uint32_t out=0;
for (int i=0; i<32; i++) { for (int i=0; i<32; i++) {
out |= ((nr_ue_pbch_vars->pbch_a_interleaved>>i)&1)<<(pbch_deinterleaving_pattern[i]); out |= ((nr_ue_pbch_vars->pbch_a_interleaved>>i)&1)<<(pbch_deinterleaving_pattern[i]);
#ifdef DEBUG_PBCH //#ifdef DEBUG_PBCH
printf("i %d in 0x%08x out 0x%08x ilv %d (in>>i)&1) 0x%08x\n", i, nr_ue_pbch_vars->pbch_a_interleaved, out, pbch_deinterleaving_pattern[i], (nr_ue_pbch_vars->pbch_a_interleaved>>i)&1); printf("i %d in 0x%08x out 0x%08x ilv %d (in>>i)&1) 0x%08x\n", i, nr_ue_pbch_vars->pbch_a_interleaved, out, pbch_deinterleaving_pattern[i], (nr_ue_pbch_vars->pbch_a_interleaved>>i)&1);
#endif //#endif
} }
uint32_t payload = 0; uint32_t payload = 0;
......
...@@ -122,13 +122,13 @@ int main(int argc, char **argv) ...@@ -122,13 +122,13 @@ int main(int argc, char **argv)
unsigned char frame_type = 0; unsigned char frame_type = 0;
unsigned char pbch_phase = 0; unsigned char pbch_phase = 0;
int frame=0,subframe=0; int frame=8,subframe=0;
int frame_length_complex_samples; int frame_length_complex_samples;
int frame_length_complex_samples_no_prefix; int frame_length_complex_samples_no_prefix;
NR_DL_FRAME_PARMS *frame_parms; NR_DL_FRAME_PARMS *frame_parms;
nfapi_nr_config_request_t *gNB_config; nfapi_nr_config_request_t *gNB_config;
int ret; int ret, payload_ret=0;
int run_initial_sync=0; int run_initial_sync=0;
int loglvl=OAILOG_WARNING; int loglvl=OAILOG_WARNING;
...@@ -570,9 +570,17 @@ int main(int argc, char **argv) ...@@ -570,9 +570,17 @@ int main(int argc, char **argv)
if (ret==0) { if (ret==0) {
//UE->rx_ind.rx_indication_body->mib_pdu.ssb_index; //not yet detected automatically //UE->rx_ind.rx_indication_body->mib_pdu.ssb_index; //not yet detected automatically
//UE->rx_ind.rx_indication_body->mib_pdu.ssb_length; //Lmax, not yet detected automatically //UE->rx_ind.rx_indication_body->mib_pdu.ssb_length; //Lmax, not yet detected automatically
for (i=0;i<3;i++) uint8_t gNB_xtra_byte=0;
printf("pdu byte %d gNB: 0x%02x UE: 0x%02x\n",i,((uint8_t*)&gNB->pbch.pbch_a)[i], UE->rx_ind.rx_indication_body->mib_pdu.pdu[i]); for (int i=0; i<8; i++)
printf("xtra byte gNB: 0x%02x UE: 0x%02x\n",((uint8_t*)&gNB->pbch.pbch_a)[3], UE->rx_ind.rx_indication_body->mib_pdu.additional_bits); gNB_xtra_byte |= ((gNB->pbch.pbch_a>>(31-i))&1)<<(7-i);
payload_ret += (UE->rx_ind.rx_indication_body->mib_pdu.additional_bits == gNB_xtra_byte);
for (i=0;i<3;i++){
payload_ret += (UE->rx_ind.rx_indication_body->mib_pdu.pdu[i] == gNB->pbch_pdu[2-i]);
//printf("pdu byte %d gNB: 0x%02x UE: 0x%02x\n",i,gNB->pbch_pdu[i], UE->rx_ind.rx_indication_body->mib_pdu.pdu[i]);
}
//printf("xtra byte gNB: 0x%02x UE: 0x%02x\n",gNB_xtra_byte, UE->rx_ind.rx_indication_body->mib_pdu.additional_bits);
//printf("ret %d\n", payload_ret);
} }
if (ret<0) n_errors++; if (ret<0) n_errors++;
...@@ -582,7 +590,12 @@ int main(int argc, char **argv) ...@@ -582,7 +590,12 @@ int main(int argc, char **argv)
printf("SNR %f : n_errors (negative CRC) = %d/%d\n", SNR,n_errors,n_trials); printf("SNR %f : n_errors (negative CRC) = %d/%d\n", SNR,n_errors,n_trials);
if ((float)n_errors/(float)n_trials <= target_error_rate) { if ((float)n_errors/(float)n_trials <= target_error_rate) {
if (payload_ret==4) {
printf("Payload OK\n");
printf("PBCH test OK\n"); printf("PBCH test OK\n");
}
else
printf("Payload NOK\n");
break; break;
} }
......
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