Commit 515ebe11 authored by Laurent THOMAS's avatar Laurent THOMAS

2754 make common functions UE/NB for gold sequences

parent d017fe11
......@@ -108,9 +108,15 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
if (pusch_pdu->transform_precoding == transformPrecoder_disabled) {
// Note: pilot returned by the following function is already the complex conjugate of the transmitted DMRS
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
nr_pusch_dmrs_rx(gNB,
Ns,
nr_gold_pusch(gNB, pusch_pdu->scid, Ns, symbol),
nr_gold_pusch(fp->N_RB_UL,
fp->symbols_per_slot,
gNB->gNB_config.cell_config.phy_cell_id.value,
pusch_pdu->scid,
Ns,
symbol),
pilot,
(1000 + p),
0,
......@@ -558,7 +564,12 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
symbol,
frame_parms->ofdm_symbol_size,
(int16_t *)&pusch_vars->rxdataF_comp[aarx][(symbol * nb_re_pusch)],
nr_gold_pusch(gNB, rel15_ul->scid, nr_tti_rx, symbol),
nr_gold_pusch(frame_parms->N_RB_UL,
frame_parms->symbols_per_slot,
gNB->gNB_config.cell_config.phy_cell_id.value,
rel15_ul->scid,
nr_tti_rx,
symbol),
(int16_t *)&phase_per_symbol[symbol],
ptrs_re_symbol);
}
......
......@@ -21,61 +21,3 @@
#include "nr_refsig.h"
#include "nr_refsig_common.h"
uint32_t* nr_init_pbch_dmrs(PHY_VARS_gNB* gNB, int n_hf, int ssb)
{
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
int Nid = gNB->gNB_config.cell_config.phy_cell_id.value;
int Lmax = fp->Lmax;
int i_ssb = ssb & (Lmax - 1);
int i_ssb2 = i_ssb + (n_hf << 2);
uint32_t x2 = (1 << 11) * (i_ssb2 + 1) * ((Nid >> 2) + 1) + (1 << 6) * (i_ssb2 + 1) + (Nid & 3);
return gold_cache(x2, NR_PBCH_DMRS_LENGTH_DWORD);
}
uint32_t* nr_init_pdcch_dmrs(PHY_VARS_gNB* gNB, int Nid, int slot, int symb)
{
NR_DL_FRAME_PARMS* fp = &gNB->frame_parms;
int pdcch_dmrs_init_length = (((fp->N_RB_DL << 1) * 3) >> 5) + 1;
uint64_t temp_x2 = ((1UL << 17) * (fp->symbols_per_slot * slot + symb + 1) * ((Nid << 1) + 1) + (Nid << 1));
uint32_t x2 = temp_x2 % (1U << 31);
LOG_D(PHY, "PDCCH DMRS slot %d, symb %d, Nid %d, x2 %x\n", slot, symb, Nid, x2);
return gold_cache(x2, pdcch_dmrs_init_length);
}
uint32_t* nr_gold_pdsch_dmrs(PHY_VARS_gNB* gNB, uint nscid, int Nid, int slot, int symb)
{
NR_DL_FRAME_PARMS* fp = &gNB->frame_parms;
int pdsch_dmrs_init_length = ((fp->N_RB_DL * 24) >> 5) + 1;
uint64_t temp_x2 = ((1UL << 17) * (fp->symbols_per_slot * slot + symb + 1) * ((Nid << 1) + 1) + ((Nid << 1) + nscid));
uint32_t x2 = temp_x2 % (1U << 31);
LOG_D(PHY, "PDSCH DMRS slot %d, symb %d, Nid %d, nscid %d, x2 %x\n", slot, symb, Nid, nscid, x2);
return gold_cache(x2, pdsch_dmrs_init_length);
}
uint32_t* nr_gold_pusch(PHY_VARS_gNB* gNB, int nscid, int ns, int l)
{
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
int Nid = gNB->gNB_config.cell_config.phy_cell_id.value;
int pusch_dmrs_init_length = ((fp->N_RB_UL * 12) >> 5) + 1;
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);
return gold_cache(x2, pusch_dmrs_init_length);
}
uint32_t* nr_init_prs(PHY_VARS_gNB* gNB, int rsc_id, int slotNum, int symNum)
{
int Nid = gNB->prs_vars.prs_cfg[rsc_id].NPRSID; // seed value
LOG_I(PHY, "Initiaized NR-PRS sequence with PRS_ID %3d for resource %d\n", Nid, rsc_id);
uint32_t pow22 = 1 << 22;
uint32_t pow10 = 1 << 10;
uint32_t c_init1 = pow22 * ceil(Nid / 1024);
uint32_t c_init2 = pow10 * (slotNum + symNum + 1) * (2 * (Nid % 1024) + 1);
uint32_t c_init3 = Nid % 1024;
uint32_t x2 = c_init1 + c_init2 + c_init3;
return gold_cache(x2, NR_MAX_PRS_INIT_LENGTH_DWORD);
}
......@@ -23,47 +23,6 @@
#include "nr_refsig.h"
#include "nr_refsig_common.h"
uint32_t* nr_gold_pbch(PHY_VARS_NR_UE* ue, int n_hf, int l)
{
int Nid = ue->frame_parms.Nid_cell;
int Lmax = ue->frame_parms.Lmax;
int i_ssb = l & (Lmax - 1);
int i_ssb2 = i_ssb + (n_hf << 2);
uint32_t x2 = (1 << 11) * (i_ssb2 + 1) * ((Nid >> 2) + 1) + (1 << 6) * (i_ssb2 + 1) + (Nid & 3);
return gold_cache(x2, NR_PBCH_DMRS_LENGTH_DWORD);
}
uint32_t* nr_gold_pdcch(PHY_VARS_NR_UE* ue, unsigned short nid, int ns, int l)
{
int pdcch_dmrs_init_length = (((ue->frame_parms.N_RB_DL << 1) * 3) >> 5) + 1;
uint64_t x2tmp0 = ((ue->frame_parms.symbols_per_slot * ns + l + 1) * ((nid << 1) + 1));
x2tmp0 <<= 17;
x2tmp0 += (nid << 1);
uint32_t x2 = x2tmp0 % (1U << 31); // cinit
LOG_D(PHY, "PDCCH DMRS slot %d, symb %d, Nid %d, x2 %x\n", ns, l, nid, x2);
return gold_cache(x2, pdcch_dmrs_init_length);
}
uint32_t* nr_gold_pdsch(PHY_VARS_NR_UE* ue, int nscid, int slot, int symbol)
{
int pdsch_dmrs_init_length = ((ue->frame_parms.N_RB_DL * 12) >> 5) + 1;
int nid = ue->frame_parms.Nid_cell;
uint64_t x2tmp0 = ((ue->frame_parms.symbols_per_slot * slot + symbol + 1) * ((nid << 1) + 1)) << 17;
uint32_t x2 = (x2tmp0 + (nid << 1) + nscid) % (1U << 31); // cinit
LOG_D(PHY, "UE DMRS slot %d, symb %d, nscid %d, x2 %x\n", slot, symbol, nscid, x2);
return gold_cache(x2, pdsch_dmrs_init_length);
}
uint32_t* nr_init_pusch_dmrs(PHY_VARS_NR_UE* ue, uint n_scid, uint N_n_scid, int slot, int symb)
{
NR_DL_FRAME_PARMS* fp = &ue->frame_parms;
int pusch_dmrs_init_length = ((fp->N_RB_UL * 12) >> 5) + 1;
uint64_t t_x2 = ((1UL << 17) * (fp->symbols_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);
return gold_cache(x2, pusch_dmrs_init_length);
}
void sl_init_psbch_dmrs_gold_sequences(PHY_VARS_NR_UE *UE)
{
unsigned int x1, x2;
......
......@@ -25,29 +25,12 @@
#define __NR_REFSIG__H__
#include "PHY/defs_gNB.h"
#include "PHY/LTE_REFSIG/lte_refsig.h"
#include "PHY/sse_intrin.h"
#include "nr_refsig_common.h"
/*!\brief This function generates the NR Gold sequence (38-211, Sec 5.2.1) for the PBCH DMRS.
@param PHY_VARS_gNB* gNB structure provides configuration, frame parameters and the pointers to the 32 bits sequence storage tables
*/
uint32_t *nr_init_pbch_dmrs(PHY_VARS_gNB *gNB, int n_hf, int ssb);
/*
This function generates NR Gold Sequence(ts 138.211) for the PRS.
@param PHY_VARS_gNB* gNB structure provides configuration, frame parameters and the pointers to the 32 bits sequence storage tables
*/
uint32_t *nr_init_prs(PHY_VARS_gNB *gNB, int rsc_id, int slotNum, int symNum);
#include "openair1/PHY/NR_REFSIG/nr_refsig_common.h"
/*!\brief This function generates the NR Gold sequence (38-211, Sec 5.2.1) for the PDCCH DMRS.
@param PHY_VARS_gNB* gNB structure provides configuration, frame parameters and the pointers to the 32 bits sequence storage tables
@param Nid is used for the initialization of x2, Physical cell Id by default or upper layer configured pdcch_scrambling_ID
*/
uint32_t *nr_init_pdcch_dmrs(PHY_VARS_gNB *gNB, int Nid, int slot, int symbol);
uint32_t *nr_gold_pdsch_dmrs(PHY_VARS_gNB *gNB, uint nscid, int Nid, int slot, int symbol);
uint32_t *nr_init_csi_rs(const NR_DL_FRAME_PARMS *fp, int slot, int symbol, uint32_t Nid);
uint32_t *nr_gold_pusch(PHY_VARS_gNB *gNB, int nscid, int slot, int symbol);
int nr_pusch_dmrs_delta(uint8_t dmrs_config_type, unsigned short p);
int nr_pusch_dmrs_rx(PHY_VARS_gNB *gNB,
......
......@@ -24,8 +24,13 @@
#ifndef __NR_REFSIG_COMMON_H__
#define __NR_REFSIG_COMMON_H__
#include "openair1/PHY/LTE_TRANSPORT/transport_proto.h"
uint32_t* gold_cache(uint32_t key, int length);
uint32_t *nr_init_csi_rs(const NR_DL_FRAME_PARMS *fp, int slot, int symb, uint32_t Nid);
uint32_t *init_nr_gold_prs(int nid, int slot, int symbol);
uint32_t *nr_gold_pbch(int Lmax, int Nid, int n_hf, int ssb);
uint32_t *nr_gold_pdcch(int N_RB_DL, int symbols_per_slot, unsigned short n_idDMRS, int ns, int l);
uint32_t *nr_gold_pdsch(int N_RB_DL, int symbols_per_slot, int nid, int nscid, int slot, int symbol);
uint32_t *nr_gold_pusch(int N_RB_UL, int symbols_per_slot, int Nid, int nscid, int ns, int l);
uint32_t *nr_gold_csi_rs(const NR_DL_FRAME_PARMS *fp, int slot, int symb, uint32_t Nid);
uint32_t *nr_gold_prs(int nid, int slot, int symbol);
#endif
......@@ -74,14 +74,51 @@ uint32_t* gold_cache(uint32_t key, int length)
AssertFatal(PHY, "gold sequence table full\n");
}
uint32_t *nr_init_csi_rs(const NR_DL_FRAME_PARMS *fp, int slot, int symb, uint32_t Nid)
uint32_t* nr_gold_pbch(int Lmax, int Nid, int n_hf, int l)
{
int i_ssb = l & (Lmax - 1);
int i_ssb2 = i_ssb + (n_hf << 2);
uint32_t x2 = (1 << 11) * (i_ssb2 + 1) * ((Nid >> 2) + 1) + (1 << 6) * (i_ssb2 + 1) + (Nid & 3);
return gold_cache(x2, NR_PBCH_DMRS_LENGTH_DWORD);
}
uint32_t* nr_gold_pdcch(int N_RB_DL, int symbols_per_slot, unsigned short nid, int ns, int l)
{
int pdcch_dmrs_init_length = (((N_RB_DL << 1) * 3) >> 5) + 1;
uint64_t x2tmp0 = ((symbols_per_slot * ns + l + 1) * ((nid << 1) + 1));
x2tmp0 <<= 17;
x2tmp0 += (nid << 1);
uint32_t x2 = x2tmp0 % (1U << 31); // cinit
LOG_D(PHY, "PDCCH DMRS slot %d, symb %d, Nid %d, x2 %x\n", ns, l, nid, x2);
return gold_cache(x2, pdcch_dmrs_init_length);
}
uint32_t* nr_gold_pdsch(int N_RB_DL, int symbols_per_slot, int nid, int nscid, int slot, int symbol)
{
int pdsch_dmrs_init_length = ((N_RB_DL * 24) >> 5) + 1;
uint64_t x2tmp0 = ((symbols_per_slot * slot + symbol + 1) * ((nid << 1) + 1)) << 17;
uint32_t x2 = (x2tmp0 + (nid << 1) + nscid) % (1U << 31); // cinit
LOG_D(PHY, "UE DMRS slot %d, symb %d, nscid %d, x2 %x\n", slot, symbol, nscid, x2);
return gold_cache(x2, pdsch_dmrs_init_length);
}
uint32_t* nr_gold_pusch(int N_RB_UL, int symbols_per_slot, int Nid, int nscid, int ns, int l)
{
int pusch_dmrs_init_length = ((N_RB_UL * 12) >> 5) + 1;
uint64_t temp_x2 = ((1UL << 17) * (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);
return gold_cache(x2, pusch_dmrs_init_length);
}
uint32_t* nr_gold_csi_rs(const NR_DL_FRAME_PARMS* fp, int slot, int symb, uint32_t Nid)
{
int csi_dmrs_init_length = ((fp->N_RB_DL<<4)>>5)+1;
uint32_t x2 = ((1<<10) * (fp->symbols_per_slot*slot+symb+1) * ((Nid<<1)+1) + (Nid));
return gold_cache(x2, csi_dmrs_init_length);
}
uint32_t* init_nr_gold_prs(int Nid, int slotNum, int symNum)
uint32_t* nr_gold_prs(int Nid, int slotNum, int symNum)
{
LOG_I(PHY, "Initialised NR-PRS sequence for PCI %d\n", Nid);
// initial x2 for prs as ts138.211
......
......@@ -25,7 +25,6 @@
#define __NR_REFSIG_DEFS__H__
#include "PHY/defs_nr_UE.h"
#include "PHY/LTE_REFSIG/lte_refsig.h"
#include "nr_refsig_common.h"
/*!\brief This function generates the NR Gold sequence (38-211, Sec 5.2.1) for the PBCH DMRS.
......@@ -52,12 +51,6 @@ int nr_pdsch_dmrs_rx(PHY_VARS_NR_UE *ue,
unsigned short nb_pdsch_rb,
uint8_t config_type);
uint32_t *nr_gold_pbch(PHY_VARS_NR_UE *ue, int, int);
uint32_t *nr_gold_pdcch(PHY_VARS_NR_UE *ue, unsigned short n_idDMRS, int ns, int l);
uint32_t *nr_gold_pdsch(PHY_VARS_NR_UE *ue, int nscid, int slot, int symbol);
uint32_t *nr_init_pusch_dmrs(PHY_VARS_NR_UE *ue, uint, uint, int slot, int symbol);
void sl_generate_pss(SL_NR_UE_INIT_PARAMS_t *sl_init_params, uint8_t n_sl_id2, uint16_t scaling);
void sl_generate_pss_ifft_samples(sl_nr_ue_phy_params_t *sl_ue_params, SL_NR_UE_INIT_PARAMS_t *sl_init_params);
void sl_generate_sss(SL_NR_UE_INIT_PARAMS_t *sl_init_params, uint16_t slss_id, uint16_t scaling);
......
......@@ -561,14 +561,26 @@ void nr_generate_csi_rs(const NR_DL_FRAME_PARMS *frame_parms,
for (lp=0; lp<=lprime; lp++){
symb = csi_params->symb_l0;
nr_modulation(nr_init_csi_rs(frame_parms, slot, symb + lp, csi_params->scramb_id), csi_length, DMRS_MOD_ORDER, mod_csi[symb + lp]);
nr_modulation(nr_gold_csi_rs(frame_parms, slot, symb + lp, csi_params->scramb_id),
csi_length,
DMRS_MOD_ORDER,
mod_csi[symb + lp]);
if ((csi_params->row == 5) || (csi_params->row == 7) || (csi_params->row == 11) || (csi_params->row == 13) || (csi_params->row == 16))
nr_modulation(nr_init_csi_rs(frame_parms, slot, symb + 1, csi_params->scramb_id), csi_length, DMRS_MOD_ORDER, mod_csi[symb + 1]);
nr_modulation(nr_gold_csi_rs(frame_parms, slot, symb + 1, csi_params->scramb_id),
csi_length,
DMRS_MOD_ORDER,
mod_csi[symb + 1]);
if ((csi_params->row == 14) || (csi_params->row == 13) || (csi_params->row == 16) || (csi_params->row == 17)) {
symb = csi_params->symb_l1;
nr_modulation(nr_init_csi_rs(frame_parms, slot, symb + lp, csi_params->scramb_id), csi_length, DMRS_MOD_ORDER, mod_csi[symb + lp]);
nr_modulation(nr_gold_csi_rs(frame_parms, slot, symb + lp, csi_params->scramb_id),
csi_length,
DMRS_MOD_ORDER,
mod_csi[symb + lp]);
if ((csi_params->row == 13) || (csi_params->row == 16))
nr_modulation(nr_init_csi_rs(frame_parms, slot, symb + 1, csi_params->scramb_id), csi_length, DMRS_MOD_ORDER, mod_csi[symb + 1]);
nr_modulation(nr_gold_csi_rs(frame_parms, slot, symb + 1, csi_params->scramb_id),
csi_length,
DMRS_MOD_ORDER,
mod_csi[symb + 1]);
}
}
}
......
......@@ -128,7 +128,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB,
/// DMRS QPSK modulation
for (int symb=cset_start_symb; symb<cset_start_symb + pdcch_pdu_rel15->DurationSymbols; symb++) {
nr_modulation(nr_init_pdcch_dmrs(gNB, dci_pdu->ScramblingId, slot, symb),
nr_modulation(nr_gold_pdcch(frame_parms->N_RB_DL, frame_parms->symbols_per_slot, dci_pdu->ScramblingId, slot, symb),
dmrs_length,
DMRS_MOD_ORDER,
mod_dmrs[symb]); // Qm = 2 as DMRS is QPSK modulated
......
......@@ -249,7 +249,8 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot)
l_prime = 0;
}
/// DMRS QPSK modulation
nr_modulation(nr_gold_pdsch_dmrs(gNB, rel15->SCID, rel15->dlDmrsScramblingId, slot, l_symbol),
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
nr_modulation(nr_gold_pdsch(fp->N_RB_DL, fp->symbols_per_slot, rel15->SCID, rel15->dlDmrsScramblingId, slot, l_symbol),
n_dmrs * DMRS_MOD_ORDER,
DMRS_MOD_ORDER,
(int16_t *)mod_dmrs); // Qm = 2 as DMRS is QPSK modulated
......@@ -274,7 +275,8 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot)
if(ptrs_symbol) {
/* PTRS QPSK Modulation for each OFDM symbol in a slot */
LOG_D(PHY, "Doing ptrs modulation for symbol %d, n_ptrs %d\n", l_symbol, n_ptrs);
nr_modulation(nr_gold_pdsch_dmrs(gNB, rel15->SCID, rel15->dlDmrsScramblingId, slot, l_symbol),
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
nr_modulation(nr_gold_pdsch(fp->N_RB_DL, fp->symbols_per_slot, rel15->SCID, rel15->dlDmrsScramblingId, slot, l_symbol),
n_ptrs * DMRS_MOD_ORDER,
DMRS_MOD_ORDER,
(int16_t *)mod_ptrs);
......
......@@ -42,7 +42,7 @@ int nr_generate_prs(int slot,
k = (prs_cfg->REOffset+k_prime) % prs_cfg->CombSize + prs_cfg->RBOffset*12 + frame_parms->first_carrier_offset;
// QPSK modulation
uint32_t *gold = init_nr_gold_prs(prs_cfg->NPRSID, slot, l);
uint32_t *gold = nr_gold_prs(prs_cfg->NPRSID, slot, l);
for (int m = 0; m < (12/prs_cfg->CombSize) * prs_cfg->NumRB; m++) {
idx = (((gold[(m << 1) >> 5]) >> ((m << 1) & 0x1f)) & 3);
mod_prs[m<<1] = nr_qpsk_mod_table[idx<<1];
......
......@@ -113,7 +113,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
int16_t k_prime_table[K_PRIME_TABLE_ROW_SIZE][K_PRIME_TABLE_COL_SIZE] = PRS_K_PRIME_TABLE;
for(int l = prs_cfg->SymbolStart; l < prs_cfg->SymbolStart+prs_cfg->NumPRSSymbols; l++)
{
uint32_t *nr_gold_prs = init_nr_gold_prs(ue->prs_vars[gNB_id]->prs_resource[rsc_id].prs_cfg.NPRSID, slot_prs, l);
uint32_t *gold_prs = nr_gold_prs(ue->prs_vars[gNB_id]->prs_resource[rsc_id].prs_cfg.NPRSID, slot_prs, l);
int symInd = l-prs_cfg->SymbolStart;
if (prs_cfg->CombSize == 2) {
k_prime = k_prime_table[0][symInd];
......@@ -136,7 +136,7 @@ int nr_prs_channel_estimation(uint8_t gNB_id,
AssertFatal(num_pilots > 0, "num_pilots needs to be gt 0 or mod_prs[0] UB");
for (int m = 0; m < num_pilots; m++)
{
idx = (((nr_gold_prs[(m << 1) >> 5]) >> ((m << 1) & 0x1f)) & 3);
idx = (((gold_prs[(m << 1) >> 5]) >> ((m << 1) & 0x1f)) & 3);
mod_prs[m<<1] = nr_qpsk_mod_table[idx<<1];
mod_prs[(m<<1)+1] = nr_qpsk_mod_table[(idx<<1) + 1];
}
......@@ -678,7 +678,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
AssertFatal(dmrss >= 0 && dmrss < 3, "symbol %d is illegal for PBCH DM-RS \n", dmrss);
gold_seq = nr_gold_pbch(ue, n_hf, ssb_index);
gold_seq = nr_gold_pbch(fp->Lmax, fp->Nid_cell, n_hf, ssb_index);
lastsymbol = 2;
num_rbs = 20;
}
......@@ -900,7 +900,7 @@ void nr_pdcch_channel_estimation(PHY_VARS_NR_UE *ue,
// Note: pilot returned by the following function is already the complex conjugate of the transmitted DMRS
nr_pdcch_dmrs_rx(ue,
slot,
nr_gold_pdcch(ue, ue->scramblingID_pdcch, slot, symbol),
nr_gold_pdcch(ue->frame_parms.N_RB_DL, ue->frame_parms.symbols_per_slot, ue->scramblingID_pdcch, slot, symbol),
(c16_t *)pilot,
2000,
(nb_rb_coreset + dmrs_ref));
......@@ -1435,8 +1435,9 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
{
// int gNB_id = proc->gNB_id;
int slot = proc->nr_slot_rx;
const int ch_offset = ue->frame_parms.ofdm_symbol_size * symbol;
const int symbol_offset = ue->frame_parms.ofdm_symbol_size * symbol;
NR_DL_FRAME_PARMS *fp = &ue->frame_parms;
const int ch_offset = fp->ofdm_symbol_size * symbol;
const int symbol_offset = fp->ofdm_symbol_size * symbol;
#ifdef DEBUG_PDSCH
printf(
......@@ -1445,8 +1446,8 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
gNB_id,
ch_offset,
symbol_offset,
ue->frame_parms.ofdm_symbol_size,
ue->frame_parms.Ncp,
fp->ofdm_symbol_size,
fp->Ncp,
slot,
bwp_start_subcarrier,
symbol);
......@@ -1462,12 +1463,18 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
c16_t pilot[3280] __attribute__((aligned(16)));
// Note: pilot returned by the following function is already the complex conjugate of the transmitted DMRS
nr_pdsch_dmrs_rx(ue, slot, nr_gold_pdsch(ue, nscid, slot, symbol), pilot, 1000 + p, 0, nb_rb_pdsch + rb_offset, config_type);
nr_pdsch_dmrs_rx(ue,
slot,
nr_gold_pdsch(fp->N_RB_DL, fp->symbols_per_slot, fp->Nid_cell, nscid, slot, symbol),
pilot,
1000 + p,
0,
nb_rb_pdsch + rb_offset,
config_type);
delay_t delay = {0};
for (int aarx = 0; aarx < ue->frame_parms.nb_antennas_rx; aarx++) {
for (int aarx = 0; aarx < fp->nb_antennas_rx; aarx++) {
#ifdef DEBUG_PDSCH
printf("\n============================================\n");
printf("==== Tx port %i, Rx antenna %i, Symbol %i ====\n", p, aarx, symbol);
......@@ -1475,8 +1482,8 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
#endif
c16_t *rxF = &rxdataF[aarx][symbol_offset + delta];
c16_t *dl_ch = (c16_t *)&dl_ch_estimates[nl * ue->frame_parms.nb_antennas_rx + aarx][ch_offset];
memset(dl_ch, 0, sizeof(*dl_ch) * ue->frame_parms.ofdm_symbol_size);
c16_t *dl_ch = (c16_t *)&dl_ch_estimates[nl * fp->nb_antennas_rx + aarx][ch_offset];
memset(dl_ch, 0, sizeof(*dl_ch) * fp->ofdm_symbol_size);
if (config_type == NFAPI_NR_DMRS_TYPE1 && ue->chest_freq == 0) {
NFAPI_NR_DMRS_TYPE1_linear_interp(&ue->frame_parms,
......@@ -1490,7 +1497,7 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
nvar);
} else if (config_type == NFAPI_NR_DMRS_TYPE2 && ue->chest_freq == 0) {
NFAPI_NR_DMRS_TYPE2_linear_interp(&ue->frame_parms,
NFAPI_NR_DMRS_TYPE2_linear_interp(fp,
rxF,
&pilot[4 * rb_offset],
dl_ch,
......@@ -1502,24 +1509,14 @@ int nr_pdsch_channel_estimation(PHY_VARS_NR_UE *ue,
nvar);
} else if (config_type == NFAPI_NR_DMRS_TYPE1) {
NFAPI_NR_DMRS_TYPE1_average_prb(&ue->frame_parms,
rxF,
&pilot[6 * rb_offset],
dl_ch,
bwp_start_subcarrier,
nb_rb_pdsch);
NFAPI_NR_DMRS_TYPE1_average_prb(fp, rxF, &pilot[6 * rb_offset], dl_ch, bwp_start_subcarrier, nb_rb_pdsch);
} else {
NFAPI_NR_DMRS_TYPE2_average_prb(&ue->frame_parms,
rxF,
&pilot[4 * rb_offset],
dl_ch,
bwp_start_subcarrier,
nb_rb_pdsch);
NFAPI_NR_DMRS_TYPE2_average_prb(fp, rxF, &pilot[4 * rb_offset], dl_ch, bwp_start_subcarrier, nb_rb_pdsch);
}
#ifdef DEBUG_PDSCH
dl_ch = (c16_t *)&dl_ch_estimates[nl * ue->frame_parms.nb_antennas_rx + aarx][ch_offset];
dl_ch = (c16_t *)&dl_ch_estimates[nl * fp->nb_antennas_rx + aarx][ch_offset];
for (uint16_t idxP = 0; idxP < ceil((float)nb_rb_pdsch * 12 / 8); idxP++) {
for (uint8_t idxI = 0; idxI < 8; idxI++) {
printf("%4d\t%4d\t", dl_ch[idxP * 8 + idxI].r, dl_ch[idxP * 8 + idxI].i);
......@@ -1650,17 +1647,18 @@ void nr_pdsch_ptrs_processing(PHY_VARS_NR_UE *ue,
/*------------------------------------------------------------------------------------------------------- */
/* 1) Estimate common phase error per PTRS symbol */
/*------------------------------------------------------------------------------------------------------- */
nr_ptrs_cpe_estimation(*K_ptrs,
*ptrsReOffset,
*nb_rb,
rnti,
nr_slot_rx,
symbol,
frame_parms->ofdm_symbol_size,
(int16_t *)(rxdataF_comp[0][aarx] + symbol * nb_re_pdsch),
nr_gold_pdsch(ue, nscid, nr_slot_rx, symbol),
(int16_t *)&phase_per_symbol[symbol],
&ptrs_re_symbol[symbol]);
nr_ptrs_cpe_estimation(
*K_ptrs,
*ptrsReOffset,
*nb_rb,
rnti,
nr_slot_rx,
symbol,
frame_parms->ofdm_symbol_size,
(int16_t *)(rxdataF_comp[0][aarx] + symbol * nb_re_pdsch),
nr_gold_pdsch(frame_parms->N_RB_DL, frame_parms->symbols_per_slot, frame_parms->Nid_cell, nscid, nr_slot_rx, symbol),
(int16_t *)&phase_per_symbol[symbol],
&ptrs_re_symbol[symbol]);
}
}// HARQ 0
......
......@@ -81,7 +81,12 @@ static bool nr_pbch_detection(const UE_nr_rxtx_proc_t *proc,
// computing correlation between received DMRS symbols and transmitted sequence for current i_ssb and n_hf
cd_t cumul = {0};
for (int i = pbch_initial_symbol; i < pbch_initial_symbol + 3; i++) {
c32_t meas = nr_pbch_dmrs_correlation(ue, proc, i, i - pbch_initial_symbol, nr_gold_pbch(ue, hf, l), rxdataF);
c32_t meas = nr_pbch_dmrs_correlation(ue,
proc,
i,
i - pbch_initial_symbol,
nr_gold_pbch(frame_parms->Lmax, frame_parms->Nid_cell, hf, l),
rxdataF);
csum(cumul, cumul, meas);
}
*current_ssb = (NR_UE_SSB){.i_ssb = l, .n_hf = hf, .metric = squaredMod(cumul)};
......
......@@ -380,7 +380,12 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
// TODO: performance improvement, we can skip the modulation of DMRS symbols outside the bandwidth part
// Perform this on gold sequence, not required when SC FDMA operation is done,
LOG_D(PHY,"DMRS in symbol %d\n",l);
nr_modulation(nr_init_pusch_dmrs(UE, pusch_pdu->scid, pusch_pdu->ul_dmrs_scrambling_id, slot, l),
nr_modulation(nr_gold_pusch(frame_parms->N_RB_UL,
frame_parms->symbols_per_slot,
pusch_pdu->scid,
pusch_pdu->ul_dmrs_scrambling_id,
slot,
l),
n_dmrs * 2,
DMRS_MOD_ORDER,
(int16_t *)mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated
......@@ -393,7 +398,12 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
if(is_ptrs_symbol(l, ulsch_ue->ptrs_symbols)) {
is_ptrs_sym = 1;
nr_modulation(nr_init_pusch_dmrs(UE, pusch_pdu->scid, pusch_pdu->ul_dmrs_scrambling_id, slot, l),
nr_modulation(nr_gold_pusch(frame_parms->N_RB_UL,
frame_parms->symbols_per_slot,
pusch_pdu->scid,
pusch_pdu->ul_dmrs_scrambling_id,
slot,
l),
nb_rb,
DMRS_MOD_ORDER,
(int16_t *)mod_ptrs);
......
......@@ -108,20 +108,13 @@ void nr_common_signal_procedures(PHY_VARS_gNB *gNB,int frame,int slot, nfapi_nr_
nr_generate_pss(&txdataF[0][txdataF_offset], gNB->TX_AMP, ssb_start_symbol, cfg, fp);
nr_generate_sss(&txdataF[0][txdataF_offset], gNB->TX_AMP, ssb_start_symbol, cfg, fp);
if (fp->Lmax == 4)
nr_generate_pbch_dmrs(nr_init_pbch_dmrs(gNB, n_hf, ssb_index & 7),
&txdataF[0][txdataF_offset],
gNB->TX_AMP,
ssb_start_symbol,
cfg,
fp);
else
nr_generate_pbch_dmrs(nr_init_pbch_dmrs(gNB, 0, ssb_index & 7),
&txdataF[0][txdataF_offset],
gNB->TX_AMP,
ssb_start_symbol,
cfg,
fp);
int hf = fp->Lmax == 4 ? n_hf : 0;
nr_generate_pbch_dmrs(nr_gold_pbch(fp->Lmax, gNB->gNB_config.cell_config.phy_cell_id.value, hf, ssb_index & 7),
&txdataF[0][txdataF_offset],
gNB->TX_AMP,
ssb_start_symbol,
cfg,
fp);
#if T_TRACER
if (T_ACTIVE(T_GNB_PHY_MIB)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment