Commit 54c5bb1d authored by Florian Kaltenberger's avatar Florian Kaltenberger

some bugfixing

parent a6fd4707
......@@ -10,10 +10,10 @@
extern short nr_qpsk_mod_table[8];
int nr_generate_prs(uint32_t *nr_gold_prs,
int nr_generate_prs(uint32_t **nr_gold_prs,
int32_t *txdataF,
int16_t amp,
uint8_t ssb_start_symbol,
prs_data_t *prs_data,
nfapi_nr_config_request_scf_t *config,
NR_DL_FRAME_PARMS *frame_parms) {
......@@ -33,18 +33,9 @@ int nr_generate_prs(uint32_t *nr_gold_prs,
uint8_t REOffset = 0;
uint8_t symbolStart = 5;
uint8_t NumPRSSymbols = 6;
uint16_t NumPRBs = 106;
// QPSK modulation
for (int m=0; m<NR_MAX_PRS_LENGTH; m++) {
idx = (((nr_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];
#ifdef DEBUG_PRS
printf("m %d idx %d gold seq %d b0-b1 %d-%d mod_prs %d %d\n", m, idx, nr_gold_prs[(m<<1)>>5], (((nr_gold_prs[(m<<1)>>5])>>((m<<1)&0x1f))&1),
(((nr_gold_prs[((m<<1)+1)>>5])>>(((m<<1)+1)&0x1f))&1), mod_prs[(m<<1)], mod_prs[(m<<1)+1]);
#endif
}
// PRS resource mapping with combsize=k which means PRS symbols exist in every k-th subcarrier in frequency domain
// According to ts138.211 sec.7.4.1.7.2
......@@ -65,11 +56,21 @@ int nr_generate_prs(uint32_t *nr_gold_prs,
k_prime = k_prime_table[3][symInd];
}
for (int m = 0; m < NR_MAX_PRS_LENGTH; m++) {
k = (REOffset+k_prime)%combSize + frame_parms->ssb_start_subcarrier;
for (int m = 0; m < 12/combSize*NumPRBs; m++) {
#ifdef DEBUG_PRS_MAP
printf("m %d at k %d of l %d\n", m, k, l);
#endif
idx = nr_gold_prs[l][m];
mod_prs[m<<1] = nr_qpsk_mod_table[idx<<1];
mod_prs[(m<<1)+1] = nr_qpsk_mod_table[(idx<<1) + 1];
#ifdef DEBUG_PRS
printf("m %d idx %d gold seq %d mod_prs %d %d\n", m, idx, nr_gold_prs[l][m], mod_prs[(idx<<1)], mod_prs[(idx<<1)+1]);
#endif
((int16_t *)txdataF)[(l*frame_parms->ofdm_symbol_size + k)<<1] = (amp * mod_prs[m<<1]) >> 15;
((int16_t *)txdataF)[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (amp * mod_prs[(m<<1) + 1]) >> 15;
......@@ -80,10 +81,10 @@ int nr_generate_prs(uint32_t *nr_gold_prs,
((int16_t *)txdataF)[((l*frame_parms->ofdm_symbol_size + k)<<1)+1]);
#endif
k=m*combSize+(REOffset+k_prime)%combSize;
k = k + combSize;
//if (k >= frame_parms->ofdm_symbol_size)
//k-=frame_parms->ofdm_symbol_size;
if (k >= frame_parms->ofdm_symbol_size)
k-=frame_parms->ofdm_symbol_size;
}
}
......
......@@ -40,10 +40,10 @@
#define NR_PBCH_PDU_BITS 24
int nr_generate_prs(uint32_t *nr_gold_prs,
int nr_generate_prs(uint32_t **nr_gold_prs,
int32_t *txdataF,
int16_t amp,
uint8_t ssb_start_symbol,
prs_data_t *prs_data,
nfapi_nr_config_request_scf_t *config,
NR_DL_FRAME_PARMS *frame_parms);
......
......@@ -949,4 +949,23 @@ typedef struct processingData_L1 {
PHY_VARS_gNB *gNB;
} processingData_L1_t;
// structures prototype
typedef struct prs {
int PRSResourceSetPeriod[2]; //[slot period, slot offset]
int PRSResourceOffset; // array if more than one resource sets.slot offset (0...511) (default 0)
int PRSResourceRepetition;// slot offset (1 (default), 2, 4, 6, 8, 16, 32)
int PRSResourceTimeGap; // slot offset (1 (default), 2, 4, 6, 8, 16, 32)
int NumRB; //number of RBs in freq domain a scalar =< 275 RB
int NumPRSSymbols; //number of PRS symbols in time domain
int SymbolStart; //starting OFDM symbol of PRS resource in time domain
int RBOffset; //Starting PRB index of all PRS resources in a PRS resource set.
int CombSize; //RE density of all PRS resources in a PRS resource set. i∈{2,4,6,12}
int REOffset; //Starting RE offset in the first OFDM symbol of each PRS resource in a PRS resource set.
int MutingPattern1[2]; //Muting bit pattern option-1, specified as [] or a binary-valued vector of length 2, 4, 6, 8, 16, or 32.
int MutingPattern2[2];
int MutingBitRepetition;
int NPRSID;
} prs_data_t;
#endif
......@@ -103,11 +103,12 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_
else
nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[0][ssb_index&7],&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp);
prs_data_t prs_data;
prs_data.PRSResourceSetPeriod[0]=0;
prs_data.PRSResourceSetPeriod[1]=0;
// tbc
if (cfg->carrier_config.num_tx_ant.value <= 4)
nr_generate_prs(gNB->nr_gold_prs[n_hf][ssb_index&7],&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp);
else
nr_generate_prs(gNB->nr_gold_prs[0][ssb_index&7],&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp);
nr_generate_prs(gNB->nr_gold_prs[slot],&txdataF[0][txdataF_offset], AMP, &prs_data, cfg, fp);
if (T_ACTIVE(T_GNB_PHY_MIB)) {
......@@ -147,7 +148,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
// defining inputs and initials for nr_generate_prs()
int **txdataF = gNB->common_vars.txdataF;
uint8_t ssb_index, n_hf;
uint8_t ssb_index,n_hf;
ssb_index = ssb_pdu.ssb_pdu_rel15.SsbBlockIndex;
LOG_D(PHY,"common_signal_procedures: frame %d, slot %d ssb index %d\n",frame,slot,ssb_index);
......@@ -240,11 +241,12 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
//TODO: nr_generate_prs
// check if we have prs to transmit in this frame and slot
prs_data_t prs_data;
prs_data.PRSResourceSetPeriod[0]=0;
prs_data.PRSResourceSetPeriod[1]=0;
// tbc
if (cfg->carrier_config.num_tx_ant.value <= 4)
nr_generate_prs(gNB->nr_gold_prs[n_hf][ssb_index&7],&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp);
else
nr_generate_prs(gNB->nr_gold_prs[0][ssb_index&7],&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp);
nr_generate_prs(gNB->nr_gold_prs[slot],&txdataF[0][txdataF_offset], AMP, &prs_data, cfg, fp);
if (do_meas==1) stop_meas(&gNB->phy_proc_tx);
......
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