Commit ab586bcf authored by ahadi's avatar ahadi

debug modulation

parent 910912a4
#include "PHY/defs_gNB.h"
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
#include "PHY/LTE_REFSIG/lte_refsig.h"
#include "PHY/NR_REFSIG/nr_refsig.h"
#include "PHY/sse_intrin.h"
//#define DEBUG_PRS
#define DEBUG_PRS_MAP
#define DEBUG_PRS_MOD
//#define DEBUG_PRS_MAP
extern short nr_qpsk_mod_table[8];
......@@ -30,7 +29,6 @@ int nr_generate_prs(uint32_t **nr_gold_prs,
int16_t mod_prs[NR_MAX_PRS_LENGTH<<1];
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
......@@ -52,41 +50,37 @@ int nr_generate_prs(uint32_t **nr_gold_prs,
}
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);
#endif
// QPSK modulation
for (int m = 0; m < (12/prs_data->CombSize) * prs_data->NumRB; m++) {
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_MOD
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
#ifdef DEBUG_PRS_MAP
printf("m %d at k %d of l %d\n", m, k, l);
#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;
#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;
#ifdef DEBUG_PRS_MAP
printf("(%d,%d)\n",
#ifdef DEBUG_PRS_MAP
printf("(%d,%d)\n",
((int16_t *)txdataF)[(l*frame_parms->ofdm_symbol_size + k)<<1],
((int16_t *)txdataF)[((l*frame_parms->ofdm_symbol_size + k)<<1)+1]);
#endif
#endif
k = k + prs_data->CombSize;
k = k + prs_data->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;
}
}
return 0;
}
......@@ -104,8 +104,19 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_
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;
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;
printf(" before Combsize %d \n", prs_data.CombSize);
// tbc
nr_generate_prs(gNB->nr_gold_prs[slot],&txdataF[0][txdataF_offset], AMP, &prs_data, cfg, fp);
......@@ -238,10 +249,12 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
prs_data.PRSResourceRepetition=1;
prs_data.PRSResourceTimeGap=1;
prs_data.NPRSID=0;
printf(" before %p \n",&prs_data);
// tbc
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