From de82f516feedee6ec132421aa03c4e8dd3c67e26 Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 20 Mar 2024 17:08:22 +0100 Subject: [PATCH] fix gold pusch --- openair1/PHY/NR_REFSIG/nr_gold.c | 26 +++++++++++--------------- openair1/PHY/NR_REFSIG/nr_gold_ue.c | 14 ++++++-------- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/openair1/PHY/NR_REFSIG/nr_gold.c b/openair1/PHY/NR_REFSIG/nr_gold.c index 8bee50eea7..1e7a4b8b8f 100644 --- a/openair1/PHY/NR_REFSIG/nr_gold.c +++ b/openair1/PHY/NR_REFSIG/nr_gold.c @@ -96,22 +96,18 @@ void nr_init_pdsch_dmrs(PHY_VARS_gNB* gNB, uint8_t nscid, uint32_t Nid) } -void nr_gold_pusch(PHY_VARS_gNB* gNB, int nscid, uint32_t nid) { - - unsigned char ns; - unsigned int n = 0, x1 = 0, x2 = 0; - int reset; +void nr_gold_pusch(PHY_VARS_gNB* gNB, int nscid, uint32_t nid) +{ NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; - unsigned short l; - int pusch_dmrs_init_length = ((fp->N_RB_UL*12)>>5)+1; - - for (ns=0; nsslots_per_frame; ns++) { - for (l=0; lsymbols_per_slot; l++) { - reset = 1; - x2 = ((1<<17) * (fp->symbols_per_slot*ns+l+1) * ((nid<<1)+1) +((nid<<1)+nscid)); - LOG_D(PHY,"DMRS slot %d, symb %d x2 %x\n",ns,l,x2); - - for (n=0; nN_RB_UL * 12) >> 5) + 1; + for (int ns = 0; ns < fp->slots_per_frame; ns++) { + for (int l = 0; l < fp->symbols_per_slot; l++) { + int reset = 1; + uint32_t x1 = 0; + uint64_t temp_x2 = ((1UL << 17) * (fp->symbols_per_slot * ns + l + 1) * ((nid << 1) + 1) + ((nid << 1) + nscid)); + uint32_t x2 = temp_x2 % (1U << 31); + LOG_D(PHY,"DMRS slot %d, symb %d, nscid %d, nid %d, x2 %x\n", ns, l, nscid, nid, x2); + for (int n = 0; n < pusch_dmrs_init_length; n++) { gNB->nr_gold_pusch_dmrs[nscid][ns][l][n] = lte_gold_generic(&x1, &x2, reset); reset = 0; } diff --git a/openair1/PHY/NR_REFSIG/nr_gold_ue.c b/openair1/PHY/NR_REFSIG/nr_gold_ue.c index b8ab04b5ee..122cc11dd3 100644 --- a/openair1/PHY/NR_REFSIG/nr_gold_ue.c +++ b/openair1/PHY/NR_REFSIG/nr_gold_ue.c @@ -92,21 +92,19 @@ void nr_gold_pdsch(PHY_VARS_NR_UE* ue, } } -void nr_init_pusch_dmrs(PHY_VARS_NR_UE* ue, - uint16_t N_n_scid, - uint8_t n_scid) +void nr_init_pusch_dmrs(PHY_VARS_NR_UE* ue, uint16_t N_n_scid, uint8_t n_scid) { - uint32_t x1 = 0, x2 = 0, n = 0; NR_DL_FRAME_PARMS *fp = &ue->frame_parms; uint32_t ****pusch_dmrs = ue->nr_gold_pusch_dmrs; int pusch_dmrs_init_length = ((fp->N_RB_UL * 12) >> 5) + 1; - for (int slot = 0; slot < fp->slots_per_frame; slot++) { for (int symb = 0; symb < fp->symbols_per_slot; symb++) { int reset = 1; - x2 = ((1U << 17) * (fp->symbols_per_slot*slot + symb + 1) * ((N_n_scid << 1) + 1) + ((N_n_scid << 1) + n_scid)); - LOG_D(PHY,"DMRS slot %d, symb %d x2 %x\n", slot, symb, x2); - for (n=0; nsymbols_per_slot*slot + symb + 1) * ((N_n_scid << 1) + 1) + ((N_n_scid << 1) + n_scid)); + uint32_t x2 = t_x2 % (1U << 31); + LOG_D(PHY,"DMRS slot %d, symb %d, N_n_scid %d, n_scid %d, x2 %x\n", slot, symb, N_n_scid, n_scid, x2); + for (int n = 0; n < pusch_dmrs_init_length; n++) { pusch_dmrs[slot][symb][n_scid][n] = lte_gold_generic(&x1, &x2, reset); reset = 0; }