From a536aa298f7827503823427d411565f33520543b Mon Sep 17 00:00:00 2001 From: Khalid Ahmed Date: Tue, 26 Mar 2019 17:39:53 +0100 Subject: [PATCH] fixing bugs --- openair1/PHY/NR_REFSIG/nr_gold.c | 36 ++++++++++------------ openair1/PHY/NR_TRANSPORT/nr_dci.c | 7 +++-- openair1/PHY/NR_TRANSPORT/nr_dlsch.c | 2 +- openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.h | 1 + openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 14 +++++++-- openair1/SIMULATION/NR_PHY/ulsim.c | 3 +- 6 files changed, 35 insertions(+), 28 deletions(-) diff --git a/openair1/PHY/NR_REFSIG/nr_gold.c b/openair1/PHY/NR_REFSIG/nr_gold.c index f519a58da3..bd2df98ed6 100644 --- a/openair1/PHY/NR_REFSIG/nr_gold.c +++ b/openair1/PHY/NR_REFSIG/nr_gold.c @@ -81,7 +81,7 @@ void nr_init_pdsch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid) { uint32_t x1, x2; - uint8_t reset; + uint8_t reset, q; NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; uint32_t ****pdsch_dmrs = gNB->nr_gold_pdsch_dmrs; @@ -89,18 +89,17 @@ void nr_init_pdsch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid) uint8_t n_scid=0; // again works only for 1_0 for (uint8_t slot=0; slotslots_per_frame; slot++) { for (uint8_t symb=0; symbsymbols_per_slot; symb++) { - for (uint8_t q=0; qsymbols_per_slot*slot+symb+1) * ((N_n_scid[n_scid]<<1)+1) +((N_n_scid[n_scid]<<1)+n_scid)); for (uint32_t n=0; nsymbols_per_slot; symb++) { - for (q=0; qsymbols_per_slot*slot+symb+1) * ((N_n_scid[n_scid]<<1)+1) +((N_n_scid[n_scid]<<1)+n_scid)); - reset = 1; - x2 = ((1<<17) * (fp->symbols_per_slot*slot+symb+1) * ((N_n_scid[n_scid]<<1)+1) +((N_n_scid[n_scid]<<1)+n_scid)); - - for (n=0; n>1]; - nr_modulation(scrambled_output, encoded_length, 2, mod_dci); //Qm = 2 as DMRS is QPSK modulated + nr_modulation(scrambled_output, encoded_length, DMRS_MOD_ORDER, mod_dci); //Qm = 2 as DMRS is QPSK modulated #ifdef DEBUG_DCI for (int i=0; i>1; i++) diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 51a3ffb517..3316e507c6 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -173,7 +173,7 @@ for (int l=0; lnb_layers; l++) uint8_t mapping_type = config->pdsch_config.mapping_type.value; l0 = get_l0(mapping_type, 2, 0);//config->pdsch_config.dmrs_typeA_position.value); - nr_modulation(pdsch_dmrs[l0][0], n_dmrs, 2, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated + nr_modulation(pdsch_dmrs[l0][0], n_dmrs, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated #ifdef DEBUG_DLSCH printf("DMRS modulation (single symbol %d, %d symbols, type %d):\n", l0, n_dmrs>>1, dmrs_type); diff --git a/openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.h b/openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.h index c655753012..ab8f21395e 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.h +++ b/openair1/PHY/NR_TRANSPORT/nr_sch_dmrs.h @@ -34,6 +34,7 @@ #define NR_PDSCH_DMRS_ANTENNA_PORT0 1000 #define NR_PDSCH_DMRS_NB_ANTENNA_PORTS 12 +#define DMRS_MOD_ORDER 2 void get_l_prime(uint8_t *l_prime, uint8_t n_symbs); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 40eac485f3..49e8d9778e 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -43,7 +43,7 @@ void nr_pusch_codeword_scrambling(uint8_t *in, uint32_t* out) { uint8_t reset, b_idx; - uint32_t x1, x2, s=0; + uint32_t x1, x2, s=0, temp_out; reset = 1; x2 = (n_RNTI<<15) + Nid; @@ -58,8 +58,16 @@ void nr_pusch_codeword_scrambling(uint8_t *in, } if (in[i]==NR_PUSCH_x) *out ^= 1<>31; + + } + } else *out ^= (((in[i])&1) ^ ((s>>b_idx)&1))<pusch_config.pusch_TimeDomainResourceAllocation[0]->mappingType; l0 = get_l0(mapping_type, 2, 1); - nr_modulation(pusch_dmrs[l0][0], n_dmrs, 2, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated + nr_modulation(pusch_dmrs[l0][0], n_dmrs, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated ///////////