Commit 910912a4 authored by ahadi's avatar ahadi

adding prs structure

parent 464509e3
......@@ -28,36 +28,31 @@ int nr_generate_prs(uint32_t **nr_gold_prs,
int k_prime = 0;
int k=0;
int16_t mod_prs[NR_MAX_PRS_LENGTH<<1];
uint8_t idx=0;
uint8_t combSize = 6;
uint8_t REOffset = 0;
uint8_t symbolStart = 5;
uint8_t NumPRSSymbols = 6;
uint16_t NumPRBs = 106;
uint8_t idx=prs_data->NPRSID;
// QPSK modulation
// 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
for (int l = symbolStart; l < symbolStart + NumPRSSymbols; l++) {
for (int l = prs_data->SymbolStart; l < prs_data->SymbolStart + prs_data->NumPRSSymbols; l++) {
int symInd = l-5;
if (combSize==2) {
if (prs_data->CombSize == 2) {
k_prime = k_prime_table[0][symInd];
}
else if (combSize==4){
else if (prs_data->CombSize == 4){
k_prime = k_prime_table[1][symInd];
}
else if (combSize==6){
else if (prs_data->CombSize == 6){
k_prime = k_prime_table[2][symInd];
}
else if (combSize==12){
else if (prs_data->CombSize == 12){
k_prime = k_prime_table[3][symInd];
}
k = (REOffset+k_prime)%combSize + frame_parms->ssb_start_subcarrier;
for (int m = 0; m < 12/combSize*NumPRBs; m++) {
k = (prs_data->REOffset+k_prime) % prs_data->CombSize + frame_parms->ssb_start_subcarrier;
for (int m = 0; m < 12/prs_data->CombSize * prs_data->NumRB; m++) {
#ifdef DEBUG_PRS_MAP
printf("m %d at k %d of l %d\n", m, k, l);
......@@ -81,7 +76,7 @@ int nr_generate_prs(uint32_t **nr_gold_prs,
((int16_t *)txdataF)[((l*frame_parms->ofdm_symbol_size + k)<<1)+1]);
#endif
k = k + combSize;
k = k + prs_data->CombSize;
if (k >= frame_parms->ofdm_symbol_size)
k-=frame_parms->ofdm_symbol_size;
......
......@@ -148,22 +148,6 @@ 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;
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);
uint16_t ssb_start_symbol;
int ssb_start_symbol_abs = nr_get_ssb_start_symbol(fp,ssb_index); // computing the starting symbol for current ssb
ssb_start_symbol = ssb_start_symbol_abs % fp->symbols_per_slot; // start symbol wrt slot
uint16_t slots_per_hf = (fp->slots_per_frame)>>1;
if (slot<slots_per_hf)
n_hf=0;
else
n_hf=1;
if ((cfg->cell_config.frame_duplex_type.value == TDD) &&
......@@ -242,8 +226,19 @@ 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;
prs_data.PRSResourceSetPeriod[0]=40; // PRS resource slot period
prs_data.PRSResourceSetPeriod[1]=0; // resource slot offset
prs_data.SymbolStart=5;
prs_data.NumPRSSymbols=6;
prs_data.NumRB=106;
prs_data.RBOffset=0;
prs_data.CombSize=6;
prs_data.REOffset=0;
prs_data.PRSResourceOffset=0;
prs_data.PRSResourceRepetition=1;
prs_data.PRSResourceTimeGap=1;
prs_data.NPRSID=0;
// tbc
nr_generate_prs(gNB->nr_gold_prs[slot],&txdataF[0][txdataF_offset], AMP, &prs_data, cfg, fp);
......
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