diff --git a/openair1/PHY/NR_REFSIG/nr_dmrs_rx.c b/openair1/PHY/NR_REFSIG/nr_dmrs_rx.c index f9b4afeb34..26d883eb17 100644 --- a/openair1/PHY/NR_REFSIG/nr_dmrs_rx.c +++ b/openair1/PHY/NR_REFSIG/nr_dmrs_rx.c @@ -41,6 +41,7 @@ #include "refsig_defs_ue.h" #include "PHY/defs_nr_UE.h" +#include "nr_mod_table.h" #include "log.h" /*Table 7.4.1.1.2-1/2 from 38.211 */ @@ -50,7 +51,7 @@ int wf2[12][2] = {{1,1},{1,-1},{1,1},{1,-1},{1,1},{1,-1},{1,1},{1,1},{1,1},{1,-1 int wt2[12][2] = {{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,-1},{1,-1},{1,-1},{1,-1},{1,-1},{1,-1}}; //short nr_mod_table[14] = {0,0,-23170,-23170,23170,23170,-23170,-23170,-23170,23170,23170,-23170,23170,23170}; - short nr_mod_table[14] = {0,0,23170,-23170,-23170,23170,23170,-23170,23170,23170,-23170,-23170,-23170,23170}; + short nr_rx_mod_table[NR_MOD_TABLE_SIZE_SHORT] = {0,0,23170,-23170,-23170,23170,23170,-23170,23170,23170,-23170,-23170,-23170,23170}; //short nr_mod_table[14] = {0,0,23170,23170,-23170,-23170,23170,23170,23170,-23170,-23170,23170,-23170,-23170}; //extern short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT]; @@ -143,16 +144,20 @@ int nr_pdsch_dmrs_rx(PHY_VARS_NR_UE *ue, int nr_pbch_dmrs_rx(unsigned int *nr_gold_pbch, int32_t *output ) { - int m; + int m; + uint8_t idx=0; + + /// QPSK modulation + for (m=0; m>1; m++) { + idx = ((((nr_gold_pbch[(m<<1)>>5])>>((m<<1)&0x1f))&1)<<1) ^ (((nr_gold_pbch[((m<<1)+1)>>5])>>(((m<<1)+1)&0x1f))&1); + ((int16_t*)output)[m<<1] = nr_rx_mod_table[(NR_MOD_TABLE_QPSK_OFFSET + idx)<<1]; + ((int16_t*)output)[(m<<1)+1] = nr_rx_mod_table[((NR_MOD_TABLE_QPSK_OFFSET + idx)<<1) + 1]; - /// BPSK modulation - for (m=0; m>5]&(1<<(m&0x1f)))>>(m&0x1f)))<<1)]; - ((int16_t*)output)[(m<<1)+1] = nr_mod_table[((1 + ((nr_gold_pbch[m>>5]&(1<<(m&0x1f)))>>(m&0x1f)))<<1) + 1]; #ifdef DEBUG_PBCH - //printf("nr_gold_pbch[m>>5] %x\n",nr_gold_pbch[m>>5]); if (m<16) + {printf("nr_gold_pbch[(m<<1)>>5] %x\n",nr_gold_pbch[(m<<1)>>5]); printf("m %d output %d %d addr %p\n", m, ((int16_t*)output)[m<<1], ((int16_t*)output)[(m<<1)+1],&output[0]); + } #endif } diff --git a/openair1/PHY/NR_REFSIG/nr_mod_table.h b/openair1/PHY/NR_REFSIG/nr_mod_table.h index 75d8262147..3c0c808d1d 100644 --- a/openair1/PHY/NR_REFSIG/nr_mod_table.h +++ b/openair1/PHY/NR_REFSIG/nr_mod_table.h @@ -1,4 +1,4 @@ #define NR_MOD_TABLE_SIZE_SHORT 14 #define NR_MOD_TABLE_BPSK_OFFSET 1 #define NR_MOD_TABLE_QPSK_OFFSET 3 -short nr_mod_table[MOD_TABLE_SIZE_SHORT] = {0,0,23170,23170,-23170,-23170,23170,23170,23170,-23170,-23170,23170,-23170,-23170}; +short nr_mod_table[NR_MOD_TABLE_SIZE_SHORT] = {0,0,23170,23170,-23170,-23170,23170,23170,23170,-23170,-23170,23170,-23170,-23170}; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c index 3c062dbfa7..a3180beee8 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c @@ -496,7 +496,7 @@ uint16_t nr_rx_pbch( PHY_VARS_NR_UE *ue, uint8_t *decoded_output = nr_ue_pbch_vars->decoded_output; //uint16_t crc; //short nr_demod_table[8] = {0,0,0,1,1,0,1,1}; - double nr_demod_table[8] = {0.707,0.707,0.707,-0.707,-0.707,0.707,-0.707,-0.707}; + double nr_demod_table[8] = {0.707,0.707,-0.707,0.707,0.707,-0.707,-0.707,-0.707}; double *demod_pbch_e = malloc (sizeof(double) * 864); unsigned short idx_demod =0; int8_t decoderState=0; @@ -607,8 +607,8 @@ uint16_t nr_rx_pbch( PHY_VARS_NR_UE *ue, //polar decoding de-rate matching decoderState = polar_decoder(demod_pbch_e, pbch_a, &frame_parms->pbch_polar_params, decoderListSize, aPrioriArray, pathMetricAppr); - //for (i=0; i