From e96bb10289b9eed85eb8631ca0cc501ad097751d Mon Sep 17 00:00:00 2001 From: francescomani Date: Fri, 25 Feb 2022 10:05:14 +0100 Subject: [PATCH] improving also pusch dmrs init --- openair1/PHY/INIT/nr_init.c | 7 +++--- .../NR_ESTIMATION/nr_ul_channel_estimation.c | 7 +++++- openair1/PHY/NR_REFSIG/nr_gold.c | 24 ++++++++----------- openair1/PHY/NR_REFSIG/nr_refsig.h | 2 +- openair1/PHY/defs_gNB.h | 1 + 5 files changed, 22 insertions(+), 19 deletions(-) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 95e7c011fb..e823267ce9 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -179,9 +179,10 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, } } - uint32_t Nid_pusch[2] = {cfg->cell_config.phy_cell_id.value,cfg->cell_config.phy_cell_id.value}; - LOG_D(PHY,"Initializing PUSCH DMRS Gold sequence with (%x,%x)\n",Nid_pusch[0],Nid_pusch[1]); - nr_gold_pusch(gNB, &Nid_pusch[0]); + for (int nscid=0; nscid<2; nscid++) { + gNB->pusch_gold_init[nscid] = cfg->cell_config.phy_cell_id.value; + nr_gold_pusch(gNB, nscid, gNB->pusch_gold_init[nscid]); + } //CSI RS init gNB->nr_gold_csi_rs = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t **)); diff --git a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c index 9aaba7fb66..4a6f8ef9af 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c +++ b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c @@ -165,6 +165,11 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, //------------------generate DMRS------------------// + if(pusch_pdu->ul_dmrs_scrambling_id != gNB->pusch_gold_init[pusch_pdu->scid]) { + gNB->pusch_gold_init[pusch_pdu->scid] = pusch_pdu->ul_dmrs_scrambling_id; + nr_gold_pusch(gNB, pusch_pdu->scid, pusch_pdu->ul_dmrs_scrambling_id); + } + // transform precoding = 1 means disabled if (pusch_pdu->transform_precoding == 1) { nr_pusch_dmrs_rx(gNB, Ns, gNB->nr_gold_pusch_dmrs[pusch_pdu->scid][Ns][symbol], &pilot[0], 1000, 0, nb_rb_pusch, @@ -1247,4 +1252,4 @@ int nr_srs_channel_estimation(PHY_VARS_gNB *gNB, #endif return 0; -} \ No newline at end of file +} diff --git a/openair1/PHY/NR_REFSIG/nr_gold.c b/openair1/PHY/NR_REFSIG/nr_gold.c index a844993689..dc1ceda5e5 100644 --- a/openair1/PHY/NR_REFSIG/nr_gold.c +++ b/openair1/PHY/NR_REFSIG/nr_gold.c @@ -100,27 +100,23 @@ void nr_init_pdsch_dmrs(PHY_VARS_gNB* gNB, uint8_t nscid, uint32_t Nid) } -void nr_gold_pusch(PHY_VARS_gNB* gNB, uint32_t *Nid) { +void nr_gold_pusch(PHY_VARS_gNB* gNB, int nscid, uint32_t nid) { unsigned char ns; unsigned int n,x1,x2; - int nscid, reset; - unsigned int nid; + int reset; NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; unsigned short l; - for (nscid=0; nscid<2; nscid++) { - nid = Nid[nscid]; - 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 (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; nnr_gold_pusch_dmrs[nscid][ns][l][n] = lte_gold_generic(&x1, &x2, reset); - reset = 0; - } + for (n=0; nnr_gold_pusch_dmrs[nscid][ns][l][n] = lte_gold_generic(&x1, &x2, reset); + reset = 0; } } } diff --git a/openair1/PHY/NR_REFSIG/nr_refsig.h b/openair1/PHY/NR_REFSIG/nr_refsig.h index a9efdb8ad0..df3dad1e59 100644 --- a/openair1/PHY/NR_REFSIG/nr_refsig.h +++ b/openair1/PHY/NR_REFSIG/nr_refsig.h @@ -40,7 +40,7 @@ void nr_init_pdcch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid); void nr_init_pdsch_dmrs(PHY_VARS_gNB* gNB, uint8_t nscid, uint32_t Nid); void nr_init_csi_rs(PHY_VARS_gNB* gNB, uint32_t Nid); -void nr_gold_pusch(PHY_VARS_gNB* gNB, uint32_t *Nid); +void nr_gold_pusch(PHY_VARS_gNB* gNB, int nscid, uint32_t nid); int nr_pusch_dmrs_rx(PHY_VARS_gNB *gNB, unsigned int Ns, diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index f549e9591b..d0f06174cf 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -850,6 +850,7 @@ typedef struct PHY_VARS_gNB_s { int csi_gold_init; int pdcch_gold_init; int pdsch_gold_init[2]; + int pusch_gold_init[2]; int pucch0_thres; int pusch_thres;