Commit fe00c559 authored by Florian Kaltenberger's avatar Florian Kaltenberger

Merge branch 'nr_pbchsim_payload_check' into 'develop-nr'

Nr pbchsim payload check

See merge request !469
parents ce264164 4faf96d6
Pipeline #11267 failed with stage
in 0 seconds
#!/bin/sh
echo "building ctags for openair1 and openair2 ..."
ctags -e -R --exclude=openair1/DOCS/ --exclude=openair2/DOCS/ --exclude=openair2/RRC/CELLULAR/ --exclude=openair2/NAS/DRIVER/CELLULAR/ --exclude=openair2/SIMULATION/ --exclude=targets/DOCS/ --exclude=targets/PROJECTS/ openair1 openair2 openair3 targets cmake_targets common
ctags -e -R --exclude=openair1/DOCS/ --exclude=openair2/DOCS/ --exclude=openair2/RRC/CELLULAR/ --exclude=openair2/NAS/DRIVER/CELLULAR/ --exclude=openair2/SIMULATION/ --exclude=targets/DOCS/ --exclude=targets/PROJECTS/ openair1 openair2 openair3 targets cmake_targets common nfapi
......@@ -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,
UE_nr_rxtx_proc_t *proc,
......@@ -666,14 +666,13 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
if(decoderState == -1)
return(decoderState);
printf("polar decoder output 0x%08x\n",nr_ue_pbch_vars->pbch_a_prime);
//printf("polar decoder output 0x%08x\n",nr_ue_pbch_vars->pbch_a_prime);
//payload un-scrambling
memset(&nr_ue_pbch_vars->pbch_a_interleaved, 0, sizeof(uint32_t) );
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);
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", nushift,((nr_ue_pbch_vars->pbch_a_prime>>6)&1), ((nr_ue_pbch_vars->pbch_a_prime>>24)&1) );
//payload deinterleaving
//uint32_t in=0;
......
......@@ -47,6 +47,15 @@ typedef struct {
uint32_t pbch_e[NR_POLAR_PBCH_E_DWORD];
} NR_gNB_PBCH;
typedef struct {
uint8_t ssb_start_symbol;
uint8_t n_hf;
uint8_t Lmax;
uint8_t ssb_index;
int32_t sfn;
} NR_PBCH_parms_t;
typedef struct {
/// Length of DCI payload in bits
uint16_t size;
......
......@@ -99,7 +99,7 @@ int main(int argc, char **argv)
int freq_offset;
// int subframe_offset;
// char fname[40], vname[40];
int trial,n_trials=1,n_errors,n_errors2,n_alamouti;
int trial,n_trials=1,n_errors,n_errors_payload;
uint8_t transmission_mode = 1,n_tx=1,n_rx=1;
uint16_t Nid_cell=0;
......@@ -128,7 +128,7 @@ int main(int argc, char **argv)
NR_DL_FRAME_PARMS *frame_parms;
nfapi_nr_config_request_t *gNB_config;
int ret;
int ret, payload_ret=0;
int run_initial_sync=0;
int loglvl=OAILOG_WARNING;
......@@ -499,8 +499,7 @@ int main(int argc, char **argv)
for (SNR=snr0; SNR<snr1; SNR+=.2) {
n_errors = 0;
n_errors2 = 0;
n_alamouti = 0;
n_errors_payload = 0;
for (trial=0; trial<n_trials; trial++) {
......@@ -567,13 +566,31 @@ int main(int argc, char **argv)
SISO,
UE->high_speed_flag);
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_length; //Lmax, not yet detected automatically
uint8_t gNB_xtra_byte=0;
for (int i=0; i<8; i++)
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 (payload_ret!=4)
n_errors_payload++;
}
if (ret<0) n_errors++;
}
} //noise trials
printf("SNR %f : n_errors (negative CRC) = %d/%d\n", SNR,n_errors,n_trials);
printf("SNR %f: trials %d, n_errors_crc = %d, n_errors_payload %d\n", SNR,n_trials,n_errors,n_errors_payload);
if ((float)n_errors/(float)n_trials <= target_error_rate) {
if (((float)n_errors/(float)n_trials <= target_error_rate) && (n_errors_payload==0)) {
printf("PBCH test OK\n");
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