Commit 496eae67 authored by Raymond Knopp's avatar Raymond Knopp

minor changes in initial synchronization

parent a780c31d
......@@ -1297,7 +1297,7 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gold.c
${OPENAIR1_DIR}/PHY/TOOLS/file_output.c
${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c
${OPENAIR1_DIR}/PHY/TOOLS/lte_dfts.c
#${OPENAIR1_DIR}/PHY/TOOLS/lte_dfts.c
${OPENAIR1_DIR}/PHY/TOOLS/log2_approx.c
${OPENAIR1_DIR}/PHY/TOOLS/cmult_sv.c
${OPENAIR1_DIR}/PHY/TOOLS/cmult_vv.c
......@@ -1334,7 +1334,7 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
${OPENAIR1_DIR}/PHY/TOOLS/file_output.c
${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c
${OPENAIR1_DIR}/PHY/TOOLS/lte_dfts.c
# ${OPENAIR1_DIR}/PHY/TOOLS/lte_dfts.c
${OPENAIR1_DIR}/PHY/TOOLS/log2_approx.c
${OPENAIR1_DIR}/PHY/TOOLS/cmult_sv.c
${OPENAIR1_DIR}/PHY/TOOLS/cmult_vv.c
......
......@@ -100,6 +100,8 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
gNB->check_for_MUMIMO_transmissions=0;
while(gNB->configured == 0) usleep(10000);
init_dfts();
/*
LOG_I(PHY,"[gNB %"PRIu8"] Initializing DL_FRAME_PARMS : N_RB_DL %"PRIu8", PHICH Resource %d, PHICH Duration %d nb_antennas_tx:%u nb_antennas_rx:%u PRACH[rootSequenceIndex:%u prach_Config_enabled:%u configIndex:%u highSpeed:%u zeroCorrelationZoneConfig:%u freqOffset:%u]\n",
gNB->Mod_id,
......
......@@ -655,6 +655,8 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
fp->nb_antennas_tx = 1;
fp->nb_antennas_rx=1;
init_dfts();
printf("Initializing UE vars (abstraction %"PRIu8") for eNB TXant %"PRIu8", UE RXant %"PRIu8"\n",abstraction_flag,fp->nb_antennas_tx,fp->nb_antennas_rx);
//LOG_D(PHY,"[MSC_NEW][FRAME 00000][PHY_UE][MOD %02u][]\n", ue->Mod_id+NB_eNB_INST);
......
......@@ -25,17 +25,17 @@
#include "PHY/LTE_ESTIMATION/lte_estimation.h"
#include "PHY/NR_UE_ESTIMATION/nr_estimation.h"
//#define DEBUG_FEP
#define DEBUG_FEP
#define SOFFSET 0
int nr_slot_fep(PHY_VARS_NR_UE *ue,
unsigned char l,
unsigned char Ns,
int sample_offset,
int no_prefix,
int reset_freq_est,
NR_CHANNEL_EST_t channel)
unsigned char l,
unsigned char Ns,
int sample_offset,
int no_prefix,
int reset_freq_est,
NR_CHANNEL_EST_t channel)
{
NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
NR_UE_COMMON *common_vars = &ue->common_vars;
......@@ -143,7 +143,6 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
#if UE_TIMING_TRACE
stop_meas(&ue->rx_dft_stats);
#endif
}
} else {
rx_offset += (frame_parms->ofdm_symbol_size+nb_prefix_samples)*l;// +
......
......@@ -51,7 +51,7 @@
#define NUMBER_SSS_SEQUENCE (336)
#define INVALID_SSS_SEQUENCE (NUMBER_SSS_SEQUENCE)
#define LENGTH_SSS_NR (127)
#define SCALING_METRIC_SSS_NR (19)
#define SCALING_METRIC_SSS_NR (15)//(19)
#define N_ID_2_NUMBER (NUMBER_PSS_SEQUENCE)
#define N_ID_1_NUMBER (NUMBER_SSS_SEQUENCE)
......
......@@ -21,7 +21,7 @@
#include "PHY/NR_TRANSPORT/nr_transport.h"
//#define NR_SSS_DEBUG
#define NR_SSS_DEBUG
int nr_generate_sss( int16_t *d_sss,
int32_t **txdataF,
......@@ -76,6 +76,7 @@ int nr_generate_sss( int16_t *d_sss,
for (int m = 0; m < NR_SSS_LENGTH; m++) {
((int16_t*)txdataF[aa])[2*(l*frame_parms->ofdm_symbol_size + k)] = (a * d_sss[m]) >> 15;
printf("sss %d: %d\n",m,((int16_t*)txdataF[aa])[2*(l*frame_parms->ofdm_symbol_size + k)]);
k++;
if (k >= frame_parms->ofdm_symbol_size)
......@@ -83,7 +84,7 @@ int nr_generate_sss( int16_t *d_sss,
}
}
#ifdef NR_SSS_DEBUG
write_output("sss_0.m", "sss_0", (void*)txdataF[0][2*l*frame_parms->ofdm_symbol_size], frame_parms->ofdm_symbol_size, 1, 1);
// write_output("sss_0.m", "sss_0", (void*)txdataF[0][l*frame_parms->ofdm_symbol_size], frame_parms->ofdm_symbol_size, 1, 1);
#endif
return 0;
......
......@@ -567,7 +567,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
#ifdef DEBUG_PBCH
//printf("address dataf %p",nr_ue_common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe_rx]].rxdataF);
write_output("rxdataF0_pbch.m","rxF0pbch",nr_ue_common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe_rx]].rxdataF,frame_parms->ofdm_symbol_size*4,2,1);
write_output("rxdataF0_pbch.m","rxF0pbch",nr_ue_common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe_rx]].rxdataF,frame_parms->ofdm_symbol_size*4,1,1);
#endif
nr_pbch_extract(nr_ue_common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe_rx]].rxdataF,
......@@ -718,6 +718,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
printf("[PBCH] decoder payload[%d] = %x\n",i,decoded_output[i]);
}
//#endif
ue->dl_indication.rx_ind = &ue->rx_ind; // hang on rx_ind instance
//ue->rx_ind.sfn_slot = 0; //should be set by higher-1-layer, i.e. clean_and_set_if_instance()
ue->rx_ind.number_pdus = ue->rx_ind.number_pdus + 1;
......@@ -729,7 +730,8 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
ue->rx_ind.rx_indication_body->mib_pdu.ssb_length = Lmax; // confirm with TCL
ue->rx_ind.rx_indication_body->mib_pdu.cell_id = frame_parms->Nid_cell; // confirm with TCL
ue->if_inst->dl_indication(&ue->dl_indication);
if (ue->if_inst && ue->if_inst->dl_indication)
ue->if_inst->dl_indication(&ue->dl_indication);
return 0;
}
......
......@@ -269,6 +269,8 @@ void generate_pss_nr(int N_ID_2, int ofdm_symbol_size)
#ifdef DBG_PSS_NR
if (N_ID_2 == 0) {
for (int i=0;i<16;i++) printf("f %d: %d,%d\n",i,synchroF_tmp[i<<1],synchroF_tmp[1+(i<<1)]);
for (int i=0;i<16;i++) printf("t %d: %d,%d\n",i,primary_synchro_time[i<<1],primary_synchro_time[1+(i<<1)]);
char output_file[255];
char sequence_name[255];
sprintf(output_file, "%s%d_%d%s","pss_seq_t_", N_ID_2, length, ".m");
......@@ -277,6 +279,9 @@ void generate_pss_nr(int N_ID_2, int ofdm_symbol_size)
printf("file %s sequence %s\n", output_file, sequence_name);
write_output(output_file, sequence_name, primary_synchro_time, length, 1, 1);
sprintf(output_file, "%s%d_%d%s","pss_seq_f_", N_ID_2, length, ".m");
sprintf(sequence_name, "%s%d_%d","pss_seq_f_", N_ID_2, length);
write_output(output_file, sequence_name, synchroF_tmp, length, 1, 1);
}
#endif
......
......@@ -96,7 +96,8 @@ void init_context_sss_nr(int amp)
/* Modulation of SSS is a BPSK TS 36.211 chapter 5.1.2 BPSK */
#if 1
d_sss[N_ID_2][N_ID_1][n] = dss_current * amp;
d_sss[N_ID_2][N_ID_1][n] = dss_current;// * amp;
(void) amp;
#else
(void) amp;
d_sss[N_ID_2][N_ID_1][n] = (dss_current * SHRT_MAX)>>SCALING_PSS_NR;
......@@ -126,6 +127,8 @@ void init_context_sss_nr(int amp)
*
*********************************************************************/
#define DEBUG_SSS_NR
#define DEBUG_PLOT_SSS
void insert_sss_nr(int16_t *sss_time,
NR_DL_FRAME_PARMS *frame_parms)
{
......@@ -425,21 +428,21 @@ int rx_sss_nr(PHY_VARS_NR_UE *ue, int32_t *tot_metric,uint8_t *phase_max)
// Do FFTs for SSS/PSS
// SSS
nr_slot_fep(ue,
SSS_SYMBOL_NB, // symbol number
0, // Ns slot number
ue->rx_offset, // sample_offset of int16_t
0, // no_prefix
1, // reset frequency estimation
NR_SSS_EST);
SSS_SYMBOL_NB, // symbol number
0, // Ns slot number
ue->rx_offset, // sample_offset of int16_t
0, // no_prefix
1, // reset frequency estimation
NR_SSS_EST);
// PSS
nr_slot_fep(ue,
PSS_SYMBOL_NB,
0,
ue->rx_offset,
0,
1,
NR_SSS_EST);
PSS_SYMBOL_NB,
0,
ue->rx_offset,
0,
1,
NR_SSS_EST);
frame_parms->nb_prefix_samples0 = nb_prefix_samples0;
......@@ -452,17 +455,11 @@ int rx_sss_nr(PHY_VARS_NR_UE *ue, int32_t *tot_metric,uint8_t *phase_max)
#ifdef DEBUG_PLOT_SSS
write_output("rxsig0.m","rxs0",&ue->common_vars.rxdata[0][0],ue->frame_parms.samples_per_tti,1,1);
write_output("rxdataF0.m","rxF0",&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[0]].rxdataF[0],frame_parms->ofdm_symbol_size,2,1);
write_output("rxdataF0.m","rxF0",&ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[0]].rxdataF[0][frame_parms->ofdm_symbol_size*SSS_SYMBOL_NB],frame_parms->ofdm_symbol_size,2,1);
write_output("pss_ext.m","pss_ext",pss_ext,LENGTH_PSS_NR,1,1);
#endif
#if 0
write_output("sss_ext.m","sss_ext",sss_ext,LENGTH_SSS_NR,1,1);
write_output("sss_ref.m","sss_ref", d_sss,LENGTH_SSS_NR,1,1);
#endif
#if 0
int16_t *p = (int16_t *)sss_ext[0];
......@@ -489,6 +486,14 @@ int rx_sss_nr(PHY_VARS_NR_UE *ue, int32_t *tot_metric,uint8_t *phase_max)
sss = (int16_t*)&sss_ext[0][0];
#ifdef DEBUG_PLOT_SSS
write_output("sss_ext.m","sss_ext",sss_ext[0],LENGTH_SSS_NR,1,1);
write_output("sss_ref.m","sss_ref", d_sss,LENGTH_SSS_NR,1,1);
#endif
#if 0
/* simulate of a phase shift on the signal */
......@@ -499,11 +504,11 @@ int rx_sss_nr(PHY_VARS_NR_UE *ue, int32_t *tot_metric,uint8_t *phase_max)
#endif
#if 0
#if 1
int16_t *ps = (int16_t *)pss_ext;
for (int i = 0; i < LENGTH_SSS_NR; i++) {
printf("sss ref [%i] : %d %d \n", i, d_sss[0][0][i], d_sss[0][0][i]);
printf("sss ref [%i] : %d \n", i, d_sss[0][0][i]);
printf("sss ext [%i] : %d %d \n", i, sss[2*i], sss[2*i+1]);
printf("pss ref [%i] : %d %d \n", i, primary_synchro_nr[0][2*i], primary_synchro_nr[0][2*i+1]);
......@@ -528,8 +533,11 @@ int rx_sss_nr(PHY_VARS_NR_UE *ue, int32_t *tot_metric,uint8_t *phase_max)
// This is the inner product using one particular value of each unknown parameter
for (i=0; i < LENGTH_SSS_NR; i++) {
metric_re += d[i]*(((phase_re_nr[phase]*sss[2*i])>>SCALING_METRIC_SSS_NR) - ((phase_im_nr[phase]*sss[2*i+1])>>SCALING_METRIC_SSS_NR))
+ d[i]*(((phase_im_nr[phase]*sss[2*i])>>SCALING_METRIC_SSS_NR) + ((phase_re_nr[phase]*sss[2*i+1])>>SCALING_METRIC_SSS_NR));
if (Nid1 ==0 && phase==3)
printf("i %d, phase %d/%d: metric %d, phase (%d,%d) sss (%d,%d) d %d\n",i,phase,PHASE_HYPOTHESIS_NUMBER,metric_re,phase_re_nr[phase],phase_im_nr[phase],sss[2*i],sss[1+(2*i)],d[i]);
}
metric = metric_re;
......@@ -550,14 +558,14 @@ int rx_sss_nr(PHY_VARS_NR_UE *ue, int32_t *tot_metric,uint8_t *phase_max)
}
//#ifdef DEBUG_SSS_NR
#define SSS_METRIC_FLOOR_NR (30000)
if (*tot_metric > SSS_METRIC_FLOOR_NR) {
if (*tot_metric > SSS_METRIC_FLOOR_NR) {
Nid2 = GET_NID2(frame_parms->Nid_cell);
Nid1 = GET_NID1(frame_parms->Nid_cell);
printf("Nid2 %d Nid1 %d tot_metric %d, phase_max %d \n", Nid2, Nid1, *tot_metric, *phase_max);
}
//#endif
}
//#endif
return(0);
}
......@@ -74,7 +74,7 @@ static inline void cmac(__m128i a,__m128i b, __m128i *re32, __m128i *im32)
cmac_tmp = _mm_sign_epi16(b,*(__m128i*)reflip);
cmac_tmp_re32 = _mm_madd_epi16(a,cmac_tmp);
// cmac_tmp = _mm_shufflelo_epi16(b,_MM_SHUFFLE(2,3,0,1));
// cmac_tmp = _mm_shufflehi_epi16(cmac_tmp,_MM_SHUFFLE(2,3,0,1));
cmac_tmp = _mm_shuffle_epi8(b,_mm_set_epi8(13,12,15,14,9,8,11,10,5,4,7,6,1,0,3,2));
......@@ -4464,6 +4464,7 @@ void dft2048(int16_t *x,int16_t *y,int scale)
_mm_empty();
_m_empty();
}
void idft2048(int16_t *x,int16_t *y,int scale)
......@@ -4567,6 +4568,8 @@ void dft2048(int16_t *x,int16_t *y,int scale)
int i;
simd256_q15_t ONE_OVER_SQRT2_Q15_128 = set1_int16_simd256(ONE_OVER_SQRT2_Q15);
write_output("dftin.m","dftin",x,2048,1,1);
xtmpp = xtmp;
for (i=0; i<4; i++) {
......@@ -4645,7 +4648,7 @@ void dft2048(int16_t *x,int16_t *y,int scale)
_mm_empty();
_m_empty();
write_output("dftout.m","dftout",y,2048,1,1);
}
void idft2048(int16_t *x,int16_t *y,int scale)
......@@ -4658,7 +4661,7 @@ void idft2048(int16_t *x,int16_t *y,int scale)
simd256_q15_t ONE_OVER_SQRT2_Q15_128 = set1_int16_simd256(ONE_OVER_SQRT2_Q15);
xtmpp = xtmp;
for (i=0; i<4; i++) {
transpose4_ooff_simd256(x256 ,xtmpp,128);
transpose4_ooff_simd256(x256+2,xtmpp+1,128);
......
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