Commit 741a5b98 authored by Parminder Singh's avatar Parminder Singh

Added sin cos table implementation for dlsim

- Sin and Cos values are obtained from a table with a resolution of
  100.
- dlsim is updated to use this table for phase noise.
parent 65fb8a84
develop 256_QAM_demod NR-PHY-MAC-IF-multi-UE NRUE_usedlschparallel NR_10MHz NR_DLUL_PF NR_DLUL_PF_4UL NR_DLUL_PF_rebased NR_DL_MIMO NR_FAPI_beamindex_SSB_RO NR_FDD_FIX NR_FR2_RA NR_FR2_RRC_SSB NR_MAC_Multi_Rach_GlobalEdge NR_MAC_TCI_UCI_GlobalEdge NR_PUCCH_MultiUE NR_RA_cleanup NR_SA_F1AP_RFSIMULATOR NR_SA_F1AP_RFSIMULATOR2 NR_SA_F1AP_dev NR_SA_itti_sim_wk48 NR_SA_itti_sim_wk48_hs1 NR_SCHED_HARQ NR_SCHED_PDCCH_PUCCH_HARQ NR_SCHED_PDCCH_PUCCH_HARQ_rebased NR_SCHED_fixes NR_UE_dlsch_bugfix NR_UL_scheduler NR_Wireshark NR_beam_simulation NR_scheduling_request NR_scheduling_request2 NR_scheduling_request3 benetel_driver_uldl_pf_merge benetel_driver_update bugfix-nr-pdcp-sn-size bugfix-x2-SgNBAdditionRequest bupt-sa-merge ci-deploy-asterix ci-deploy-docker-compose ci-test cleanup_softmodem_main constant_power develop-SA-RA develop-SnT develop-oriecpriupdates develop-sib1 develop-sib1-local develop-sib1-lts develop-sib1-update develop-sib1-update-test1 develop-sib1-update-ue develop_stable fix_NR_DLUL_PF fix_do_ra_data fixes-CE-RLC-PDU-size flexran-repair-mme-mgmt gnb-only-test integration_2020_wk48_2 integration_2020_wk49 integration_2020_wk50 integration_2020_wk50_1 integration_2020_wk51 integration_2020_wk51_2 integration_2021_wk02 integration_2021_wk02_wMR988 integration_2021_wk04 integration_2021_wk05 inter-RRU-final itti-enhancement ldpc_short_codeword_fixes lte-ulsch-bugfix lte_uplink_improvement minor-fix-doc-basic-sim mosaic5g-oai-ran nasmesh_kernel_5.8 new-gtpu nfapi_nr_develop nr_dl_pf nr_dl_ul_ptrs nr_ul_pf nr_ul_scfdma oairu oairu-dockerfile-support openxg/develop ptrs_rrc_config pusch-retrans-fix-ue remove_nos1_hack_pdcp rh-ci-add-ue-parallelization rh_ci_ra_fr2 rh_ci_ue_parallel rh_fr1_newjenkins rh_gnb_compile_fix rh_wk50_debug rlc-v2-bugfix-status-reporting s1-subnormal_rewrite s1_subnormal s1_subnormal-robert sa-merge-rrc-srb sa-msg4 sa-msg4-rrc sa-msg4-rrc-yihz sa-msg4-rrc-yihz-hs sa_rrc_yihz small-config-change ue-fixes ue_beam_selection wireshark-T-hack-ueid wireshark-log-scheduling-requests xiangwab xiangwan 2021.w04 2021.w02 2020.w51_2 2020.w51 2020.w50 2020.w49 2020.w48_2
No related merge requests found
......@@ -1094,7 +1094,8 @@ void nr_pdsch_ptrs_processing(PHY_VARS_NR_UE *ue,
for(uint8_t i = *startSymbIndex; i< symbInSlot ;i++)
{
/* DMRS Symbol has 0 phase so no need to rotate the respective symbol */
if(!is_dmrs_symbol(i,*dmrsSymbPos))
/* Skip rotation if the slot processing is wrong */
if((!is_dmrs_symbol(i,*dmrsSymbPos)) && (ret == 0))
{
#ifdef DEBUG_DL_PTRS
printf("[PHY][DL][PTRS]: Rotate Symbol %2d with %d + j* %d\n", i, phase_per_symbol[2* i],phase_per_symbol[(2* i) +1]);
......
......@@ -481,6 +481,8 @@ int main(int argc, char **argv)
logInit();
set_glog(loglvl);
T_stdout = 1;
/* initialize the sin table */
InitSinLUT();
get_softmodem_params()->phy_test = 1;
......@@ -488,6 +490,7 @@ int main(int argc, char **argv)
snr1 = snr0+10;
RC.gNB = (PHY_VARS_gNB**) malloc(sizeof(PHY_VARS_gNB *));
RC.gNB[0] = (PHY_VARS_gNB*) malloc(sizeof(PHY_VARS_gNB ));
memset(RC.gNB[0],0,sizeof(PHY_VARS_gNB));
......
......@@ -29,14 +29,42 @@
/* linear phase noise model */
void phase_noise(double ts, int16_t * InRe, int16_t * InIm)
{
double fd = 300;//0.01*30000
static double i=0;
double real, imag,x ,y;
int32_t x=0 ,y=0;
double fd = 300;//0.01*30000
int16_t SinValue = 0, CosValue= 0;
double IdxDouble = (double)(i*fd * ts * ResolSinCos * 4);
int16_t IdxModulo = ((int32_t)(IdxDouble>0 ? IdxDouble+0.5 : IdxDouble-0.5)) % (ResolSinCos*4);
IdxModulo = IdxModulo<0 ? IdxModulo+ResolSinCos*4 : IdxModulo;
if ( IdxModulo>=0 && IdxModulo<ResolSinCos ) {
SinValue = LUTSin[IdxModulo];
CosValue = LUTSin[ResolSinCos-IdxModulo];
}
else if ( IdxModulo>=ResolSinCos && IdxModulo<2*ResolSinCos ) {
SinValue = LUTSin[2*ResolSinCos-IdxModulo];
CosValue = -LUTSin[IdxModulo-ResolSinCos];
}
else if ( IdxModulo>=2*ResolSinCos && IdxModulo<3*ResolSinCos ) {
SinValue = -LUTSin[IdxModulo-2*ResolSinCos];
CosValue = -LUTSin[3*ResolSinCos-IdxModulo];
}
else if ( IdxModulo>=3*ResolSinCos && IdxModulo<4*ResolSinCos ) {
SinValue = -LUTSin[4*ResolSinCos-IdxModulo];
CosValue = LUTSin[IdxModulo-3*ResolSinCos];
}
else {
AssertFatal(0==1,"Error in look-up table of sine function!\n");
}
x = ( ((int32_t)InRe[0] * CosValue) - ((int32_t)InIm[0] * SinValue ));
y = ( ((int32_t)InIm[0] * CosValue) + ((int32_t)InRe[0] * SinValue ));
InRe[0]= (int16_t)(x>>14);
InIm[0]= (int16_t)(y>>14);
i++;
real = cos(fd * 2 * M_PI * i * ts);
imag = sin (fd * 2 * M_PI * i * ts);
x = ((real * (double)InRe[0]) - (imag * (double)InIm[0])) ;
y= ((real * (double)InIm[0]) + (imag * (double)InRe[0])) ;
InRe[0]= (int16_t)(x);
InIm[0]= (int16_t)(y);
}
/* Initialisation function for SIN table values */
void InitSinLUT( void ) {
for ( int i=0; i<(ResolSinCos+1); i++ ) {
LUTSin[i] = sin((double)(M_PI*i)/(2*ResolSinCos)) * (1<<14); //Format: Q14
}
}
......@@ -466,6 +466,10 @@ double N_RB2channel_bandwidth(uint16_t N_RB);
\param ts Sampling time
\param *Re *Im Real and Imag part of the signal
*/
//look-up table for the sine (cosine) function
#define ResolSinCos 100
uint16_t LUTSin[ResolSinCos+1];
void InitSinLUT( void );
void phase_noise(double ts, int16_t * InRe, int16_t * InIm);
#include "targets/RT/USER/rfsim.h"
......
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