From b12d6b73409598abf8da26ae6ab79f10788a6506 Mon Sep 17 00:00:00 2001 From: Florian Kaltenberger Date: Mon, 17 Dec 2018 10:26:40 +0100 Subject: [PATCH] adding payload check to nr_pbchsim --- maketags | 2 +- openair1/PHY/NR_TRANSPORT/nr_pbch.c | 2 +- openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c | 4 ++-- openair1/PHY/defs_gNB.h | 9 +++++++++ openair1/SIMULATION/NR_PHY/pbchsim.c | 8 ++++++++ 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/maketags b/maketags index 361adc5d67..ac8d4151d4 100755 --- a/maketags +++ b/maketags @@ -1,4 +1,4 @@ #!/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 diff --git a/openair1/PHY/NR_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_TRANSPORT/nr_pbch.c index d2b917f809..e526ab0dc7 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_pbch.c @@ -37,7 +37,7 @@ #include "PHY/sse_intrin.h" //#define DEBUG_PBCH -//#define DEBUG_PBCH_ENCODING +#define DEBUG_PBCH_ENCODING //#define DEBUG_PBCH_DMRS #include "PHY/NR_REFSIG/nr_mod_table.h" diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c index c613a22ab3..58761bb618 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c @@ -36,7 +36,7 @@ #include "PHY/LTE_REFSIG/lte_refsig.h" //#define DEBUG_PBCH 1 -//#define DEBUG_PBCH_ENCODING +#define DEBUG_PBCH_ENCODING #ifdef OPENAIR2 //#include "PHY_INTERFACE/defs.h" @@ -673,7 +673,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, 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) ); + 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 //uint32_t in=0; diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index c275bc9c2a..08945a4695 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -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; diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index 4fbb3429ef..a9d1d989f8 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -567,6 +567,14 @@ 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 + for (i=0;i<3;i++) + 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]); + 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); + } + if (ret<0) n_errors++; } } //noise trials