Commit b297ef04 authored by Raymond Knopp's avatar Raymond Knopp

Acceptable SCI/SLSCH performance verified with slschsim.

parent 28b03a55
......@@ -1016,8 +1016,8 @@ unsigned char phy_threegpplte_turbo_decoder8(short *y,
avg=_mm_add_epi32(_mm_cvtepi16_epi32(_mm_abs_epi16(((__m128i*)y)[i])),avg);
avg=_mm_add_epi32(_mm_cvtepi16_epi32(tmp),avg);
}
int32_t round_avg=(_mm_extract_epi32(avg,0)+_mm_extract_epi32(avg,1)+_mm_extract_epi32(avg,2)+_mm_extract_epi32(avg,3))/(n*3);
// to make Valgrind freak less
int32_t round_avg = (_mm_extract_epi32(avg,0)+_mm_extract_epi32(avg,1)+_mm_extract_epi32(avg,2)+_mm_extract_epi32(avg,3))/(n*3);
//printf("avg input turbo: %d sum %d taille bloc %d\n",round_avg,round_sum,n);
......
......@@ -77,6 +77,9 @@ int lte_segmentation(unsigned char *input_buffer,
} else if (Bprime_by_C<=512) { // increase by 1 byte til here
*Kplus = (Bprime_by_C>>3)<<3;
*Kminus = Bprime_by_C-8;
#ifdef DEBUG_SEGMENTATION
printf("Bprime_by_C_by_C %d , Kplus2 %d\n",Bprime_by_C,*Kplus,*Kminus);
#endif
} else if (Bprime_by_C <=1024) { // increase by 2 bytes til here
*Kplus = (Bprime_by_C>>4)<<4;
......@@ -84,6 +87,9 @@ int lte_segmentation(unsigned char *input_buffer,
*Kplus = *Kplus + 16;
*Kminus = (*Kplus - 16);
#ifdef DEBUG_SEGMENTATION
printf("Bprime_by_C_by_C %d , Kplus2 %d\n",Bprime_by_C,*Kplus,*Kminus);
#endif
} else if (Bprime_by_C <= 2048) { // increase by 4 bytes til here
*Kplus = (Bprime_by_C>>5)<<5;
......
......@@ -388,6 +388,7 @@ void phy_viterbi_lte_sse2(int8_t *y,uint8_t *decoded_bytes,uint16_t n)
decoded_bytes[(position)>>3] += (prev_state0 & 0x1)<<(7-(position & 0x7));
// if ((position & 7) == 0) printf("decoded_bytes[%d]=%x\n",position>>3,decoded_bytes[position>>3]);
if (TB_ptr2[prev_state0] == 0)
prev_state0 = (prev_state0 >> 1);
......
......@@ -935,6 +935,45 @@ int init_lte_ue_signal(PHY_VARS_UE *ue,
init_prach_tables(839);
ue->pusch_slsch = (LTE_eNB_PUSCH*)malloc(sizeof(LTE_eNB_PUSCH));
ue->pusch_slcch = (LTE_eNB_PUSCH*)malloc(sizeof(LTE_eNB_PUSCH));
ue->pusch_slsch->rxdataF_ext = (int32_t **)malloc(2*sizeof(int32_t*));
ue->pusch_slsch->drs_ch_estimates = (int32_t **)malloc(2*sizeof(int32_t*));
ue->pusch_slsch->rxdataF_comp = (int32_t **)malloc(2*sizeof(int32_t*));
ue->pusch_slsch->ul_ch_mag = (int32_t **)malloc(2*sizeof(int32_t*));
ue->slsch_rxdata_7_5kHz = (int16_t **)malloc(2*sizeof(int32_t*));
ue->slsch_rxdataF = (int16_t **)malloc(2*sizeof(int32_t*));
for (int aa=0;aa<ue->frame_parms.nb_antennas_rx;aa++) {
ue->pusch_slsch->rxdataF_ext[aa] = (int32_t*)malloc16_clear(ue->frame_parms.N_RB_DL*12*14*sizeof(int32_t));
ue->pusch_slsch->drs_ch_estimates[aa] = (int32_t*)malloc16_clear(ue->frame_parms.N_RB_DL*12*14*sizeof(int32_t));
ue->pusch_slsch->rxdataF_comp[aa] = (int32_t*)malloc16_clear(ue->frame_parms.N_RB_DL*12*14*sizeof(int32_t));
ue->pusch_slsch->ul_ch_mag[aa] = (int32_t*)malloc16_clear(ue->frame_parms.N_RB_DL*12*14*sizeof(int32_t));
ue->slsch_rxdataF[aa] = (int16_t*)malloc16_clear(ue->frame_parms.ofdm_symbol_size*14*sizeof(int32_t));
ue->slsch_rxdata_7_5kHz[aa] = (int16_t*)malloc16_clear(ue->frame_parms.samples_per_tti*sizeof(int32_t));
}
ue->slsch_dlsch_llr = (int16_t **)malloc(2*6*12*1200*sizeof(int16_t*));
ue->slsch_ulsch_llr = (int16_t **)malloc(2*6*12*1200*sizeof(int16_t*));
ue->pusch_slcch = (LTE_eNB_PUSCH*)malloc(sizeof(LTE_eNB_PUSCH));
ue->pusch_slcch->rxdataF_ext = (int32_t **)malloc(2*sizeof(int32_t*));
ue->pusch_slcch->drs_ch_estimates = (int32_t **)malloc(2*sizeof(int32_t*));
ue->pusch_slcch->rxdataF_comp = (int32_t **)malloc(2*sizeof(int32_t*));
ue->pusch_slcch->ul_ch_mag = (int32_t **)malloc(2*sizeof(int32_t*));
ue->slcch_rxdata_7_5kHz = (int16_t **)malloc(2*sizeof(int32_t*));
ue->slcch_rxdataF = (int16_t **)malloc(2*sizeof(int32_t*));
for (int aa=0;aa<ue->frame_parms.nb_antennas_rx;aa++) {
ue->pusch_slcch->rxdataF_ext[aa] = (int32_t*)malloc16_clear(ue->frame_parms.N_RB_DL*12*14*sizeof(int32_t));
ue->pusch_slcch->drs_ch_estimates[aa] = (int32_t*)malloc16_clear(ue->frame_parms.N_RB_DL*12*14*sizeof(int32_t));
ue->pusch_slcch->rxdataF_comp[aa] = (int32_t*)malloc16_clear(ue->frame_parms.N_RB_DL*12*14*sizeof(int32_t));
ue->pusch_slcch->ul_ch_mag[aa] = (int32_t*)malloc16_clear(ue->frame_parms.N_RB_DL*12*14*sizeof(int32_t));
ue->slcch_rxdataF[aa] = (int16_t*)malloc16_clear(ue->frame_parms.ofdm_symbol_size*14*sizeof(int32_t));
ue->slcch_rxdata_7_5kHz[aa] = (int16_t*)malloc16_clear(ue->frame_parms.samples_per_tti*sizeof(int32_t));
}
return 0;
}
......@@ -946,7 +985,7 @@ void init_lte_ue_transport(PHY_VARS_UE *ue,int abstraction_flag) {
for (i=0; i<NUMBER_OF_CONNECTED_eNB_MAX; i++) {
for (j=0; j<2; j++) {
for (k=0; k<2; k++) {
AssertFatal((ue->dlsch[k][i][j] = new_ue_dlsch(1,NUMBER_OF_HARQ_PID_MAX,NSOFT,MAX_TURBO_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag))!=NULL,"Can't get ue dlsch structures\n");
AssertFatal((ue->dlsch[k][i][j] = new_ue_dlsch(1,8,NSOFT,NUMBER_OF_HARQ_PID_MAX,MAX_TURBO_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag))!=NULL,"Can't get ue dlsch structures\n");
LOG_D(PHY,"dlsch[%d][%d][%d] => %p\n",k,i,j,ue->dlsch[i][j]);
}
......@@ -954,14 +993,56 @@ void init_lte_ue_transport(PHY_VARS_UE *ue,int abstraction_flag) {
AssertFatal((ue->ulsch[i] = new_ue_ulsch(ue->frame_parms.N_RB_UL, abstraction_flag))!=NULL,"Can't get ue ulsch structures\n");
ue->dlsch_SI[i] = new_ue_dlsch(1,1,NSOFT,MAX_TURBO_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag);
ue->dlsch_ra[i] = new_ue_dlsch(1,1,NSOFT,MAX_TURBO_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag);
ue->dlsch_SI[i] = new_ue_dlsch(1,1,NSOFT,1,MAX_TURBO_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag);
ue->dlsch_ra[i] = new_ue_dlsch(1,1,NSOFT,1,MAX_TURBO_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag);
ue->transmission_mode[i] = ue->frame_parms.nb_antenna_ports_eNB==1 ? 1 : 2;
}
ue->dlsch_rx_slsch = new_ue_dlsch(1,4,NSOFT,1,MAX_TURBO_ITERATIONS,ue->frame_parms.N_RB_DL, abstraction_flag);
ue->dlsch_slsch = new_eNB_dlsch(1,1,NSOFT,ue->frame_parms.N_RB_DL, abstraction_flag,&ue->frame_parms);
ue->ulsch_slsch = new_ue_ulsch(ue->frame_parms.N_RB_DL, abstraction_flag);
for (i=0;i<10;i++) ue->dlsch_slsch->harq_ids[i] = 0;
ue->slsch_txcnt = 0;
ue->slsch_errors = 0;
for (int i=0;i<4;i++) ue->slsch_rxcnt[i] = 0;
ue->frame_parms.pucch_config_common.deltaPUCCH_Shift = 1;
ue->dlsch_MCH[0] = new_ue_dlsch(1,NUMBER_OF_HARQ_PID_MAX,NSOFT,MAX_TURBO_ITERATIONS_MBSFN,ue->frame_parms.N_RB_DL,0);
ue->dlsch_MCH[0] = new_ue_dlsch(1,1,NSOFT,NUMBER_OF_HARQ_PID_MAX,MAX_TURBO_ITERATIONS_MBSFN,ue->frame_parms.N_RB_DL,0);
}
void free_ue_resources(PHY_VARS_UE *ue) {
for (int aa=0;aa<ue->frame_parms.nb_antennas_rx;aa++) {
free(ue->pusch_slcch->rxdataF_ext[aa]);
free(ue->pusch_slcch->drs_ch_estimates[aa]);
free(ue->pusch_slcch->rxdataF_comp[aa]);
free(ue->pusch_slcch->ul_ch_mag[aa]);
free(ue->slcch_rxdataF[aa]);
free(ue->slcch_rxdata_7_5kHz[aa]);
}
free(ue->pusch_slcch->rxdataF_ext);
free(ue->pusch_slcch->drs_ch_estimates);
free(ue->pusch_slcch->rxdataF_comp);
free(ue->pusch_slcch->ul_ch_mag);
free(ue->slcch_rxdataF);
free(ue->slcch_rxdata_7_5kHz);
for (int aa=0;aa<ue->frame_parms.nb_antennas_rx;aa++) {
free(ue->pusch_slsch->rxdataF_ext[aa]);
free(ue->pusch_slsch->drs_ch_estimates[aa]);
free(ue->pusch_slsch->rxdataF_comp[aa]);
free(ue->pusch_slsch->ul_ch_mag[aa]);
free(ue->slsch_rxdataF[aa]);
free(ue->slsch_rxdata_7_5kHz[aa]);
}
free(ue->pusch_slsch->rxdataF_ext);
free(ue->pusch_slsch->drs_ch_estimates);
free(ue->pusch_slsch->rxdataF_comp);
free(ue->pusch_slsch->ul_ch_mag);
free(ue->slsch_rxdataF);
free(ue->slsch_rxdata_7_5kHz);
free(ue->slsch_dlsch_llr);
free(ue->slsch_ulsch_llr);
}
......@@ -211,7 +211,7 @@ int32_t lte_ul_channel_estimation(LTE_DL_FRAME_PARMS *frame_parms,
uint32_t v,
uint32_t cyclic_shift,
unsigned char l,
unsigned char Ns,
int interpolate,
uint16_t rnti);
......
......@@ -937,6 +937,8 @@ typedef struct {
int payload_length;
/// pointer to payload
uint8_t *payload;
/// index of current subframe modulo 10 in subframe pool
uint8_t ljmod10;
} SLSCH_t;
typedef struct {
......
......@@ -143,7 +143,7 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,uint32_
}*/
for (i=0; i<10; i++)
dlsch->harq_ids[i] = Mdlharq;
dlsch->harq_ids[i] = 8;
for (i=0; i<Mdlharq; i++) {
dlsch->harq_processes[i] = (LTE_DL_eNB_HARQ_t *)malloc16(sizeof(LTE_DL_eNB_HARQ_t));
......@@ -537,22 +537,22 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
return(0);
}
int dlsch_encoding(PHY_VARS_eNB *eNB,
unsigned char *a,
uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch,
int frame,
uint8_t subframe,
time_stats_t *rm_stats,
time_stats_t *te_stats,
time_stats_t *i_stats)
int dlsch_encoding0(LTE_DL_FRAME_PARMS *frame_parms,
unsigned char *a,
uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch,
int frame,
uint8_t subframe,
time_stats_t *rm_stats,
time_stats_t *te_stats,
time_stats_t *i_stats)
{
unsigned int G;
unsigned int crc=1;
unsigned short iind;
LTE_DL_FRAME_PARMS *frame_parms = &eNB->frame_parms;
unsigned char harq_pid = dlsch->harq_ids[subframe];
unsigned short nb_rb = dlsch->harq_processes[harq_pid]->nb_rb;
unsigned int A;
......@@ -573,7 +573,9 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
beamforming_mode = 8;
else if(dlsch->harq_processes[harq_pid]->mimo_mode == TM9_10)
beamforming_mode = 9;
G = get_G(frame_parms,nb_rb,dlsch->harq_processes[harq_pid]->rb_alloc,mod_order,dlsch->harq_processes[harq_pid]->Nl,num_pdcch_symbols,frame,subframe,beamforming_mode);
if (num_pdcch_symbols > 0) G = get_G(frame_parms,nb_rb,dlsch->harq_processes[harq_pid]->rb_alloc,mod_order,dlsch->harq_processes[harq_pid]->Nl,num_pdcch_symbols,frame,subframe,beamforming_mode); // regular DLSCH coding
else G = nb_rb * ((frame_parms->Ncp == 0)?12:10) * 12 * mod_order; // SLSCH Coding
// if (dlsch->harq_processes[harq_pid]->Ndi == 1) { // this is a new packet
......@@ -719,6 +721,28 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
return(0);
}
int dlsch_encoding(PHY_VARS_eNB *eNB,
unsigned char *a,
uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch,
int frame,
uint8_t subframe,
time_stats_t *rm_stats,
time_stats_t *te_stats,
time_stats_t *i_stats)
{
return(dlsch_encoding0(&eNB->frame_parms,
a,
num_pdcch_symbols,
dlsch,
frame,
subframe,
rm_stats,
te_stats,
i_stats));
}
int dlsch_encoding_SIC(PHY_VARS_UE *ue,
unsigned char *a,
......
......@@ -74,7 +74,7 @@ void free_ue_dlsch(LTE_UE_DLSCH_t *dlsch)
}
}
LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_turbo_iterations,uint8_t N_RB_DL, uint8_t abstraction_flag)
LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,int nharq,uint8_t max_turbo_iterations,uint8_t N_RB_DL, uint8_t abstraction_flag)
{
LTE_UE_DLSCH_t *dlsch;
......@@ -108,8 +108,8 @@ LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_
dlsch->Mdlharq = Mdlharq;
dlsch->Nsoft = Nsoft;
dlsch->max_turbo_iterations = max_turbo_iterations;
for (i=0; i<Mdlharq; i++) {
for (i=0; i<nharq; i++) {
// printf("new_ue_dlsch: Harq process %d\n",i);
dlsch->harq_processes[i] = (LTE_DL_UE_HARQ_t *)malloc16(sizeof(LTE_DL_UE_HARQ_t));
......@@ -368,7 +368,7 @@ decoder_if_t tc;
(r==0) ? harq_process->F : 0);
#ifdef DEBUG_DLSCH_DECODING
LOG_D(PHY,"HARQ_PID %d Rate Matching Segment %d (coded bits %d,unpunctured/repeated bits %d, TBS %d, mod_order %d, nb_rb %d, Nl %d, rv %d, round %d)...\n",
printf("HARQ_PID %d Rate Matching Segment %d (coded bits %d,unpunctured/repeated bits %d, TBS %d, mod_order %d, nb_rb %d, Nl %d, rv %d, round %d)...\n",
harq_pid,r, G,
Kr*3,
harq_process->TBS,
......
......@@ -41,7 +41,9 @@ int generate_drs_pusch(PHY_VARS_UE *ue,
unsigned int subframe,
unsigned int first_rb,
unsigned int nb_rb,
uint8_t ant)
uint8_t ant,
uint32_t *gh,
int ljmod10)
{
uint16_t k,l,Msc_RS,Msc_RS_idx,rb,drs_offset;
......@@ -94,15 +96,15 @@ int generate_drs_pusch(PHY_VARS_UE *ue,
AssertFatal(1==0,"SL Transmission type 3/4 not supported for now\n");
break;
case PSSCH_12:
/* Need to figure this out ...
u0=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[subframe<<1];
u1=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[1+(subframe<<1)];
v0=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[subframe<<1];
v1=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)];*/
cyclic_shift0 = (ue->slsch->n_ss_PSSCH>>1)&7;
u0=ue->gh[ue->slsch->group_destination_id][ljmod10<<1];
u1=ue->gh[ue->slsch->group_destination_id][1+(ljmod10<<1)];
v0=0;//frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[subframe<<1];
v1=0;//frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)];
cyclic_shift0 = (ue->slsch->group_destination_id>>1)&7;
cyclic_shift1 = cyclic_shift0;
lstart = (3 - frame_parms->Ncp);
linc = frame_parms->symbols_per_tti;
linc = (7 - frame_parms->Ncp);
break;
case PSSCH_34:
AssertFatal(1==0,"SL Transmission type 3/4 not supported for now\n");
......@@ -147,13 +149,13 @@ int generate_drs_pusch(PHY_VARS_UE *ue,
return(-1);
}
for (l = (3 - frame_parms->Ncp),u=u0,v=v0,cyclic_shift=cyclic_shift0;
for (l = lstart,u=u0,v=v0,cyclic_shift=cyclic_shift0;
l<frame_parms->symbols_per_tti;
l += linc,u=u1,v=v1,cyclic_shift=cyclic_shift1) {
drs_offset = 0;
#ifdef DEBUG_DRS
printf("drs_modulation: Msc_RS = %d, Msc_RS_idx = %d, u=%d,v=%d\n",Msc_RS, Msc_RS_idx,u,v);
printf("drs_modulation: l %d Msc_RS = %d, Msc_RS_idx = %d, u=%d,v=%d\n",l,Msc_RS, Msc_RS_idx,u,v);
#endif
......
......@@ -73,10 +73,11 @@ void free_ue_dlsch(LTE_UE_DLSCH_t *dlsch);
@param Kmimo Kmimo factor from 36-212/36-213
@param Mdlharq Maximum number of HARQ rounds (36-212/36-213)
@param Nsoft Soft-LLR buffer size from UE-Category
@param nharq Number of harq processes
@params N_RB_DL total number of resource blocks (determine the operating BW)
@param abstraction_flag Flag to indicate abstracted interface
*/
LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_turbo_iterations,uint8_t N_RB_DL, uint8_t abstraction_flag);
LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,int nharq,uint8_t max_turbo_iterations,uint8_t N_RB_DL, uint8_t abstraction_flag);
void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch);
......@@ -1507,7 +1508,7 @@ void generate_sldch(PHY_VARS_UE *ue,SLDCH_t *sldch,int frame_tx,int subframe_tx)
\param frame_tx Frame number
\param subframe_tx subframe number
*/
void generate_slsch(PHY_VARS_UE *ue,SLSCH_t *slss,int frame_tx,int subframe_tx);
void generate_slsch(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,SLSCH_t *slss,int frame_tx,int subframe_tx);
void generate_64qam_table(void);
void generate_16qam_table(void);
......@@ -1691,7 +1692,9 @@ int32_t generate_drs_pusch(PHY_VARS_UE *phy_vars_ue,
uint32_t subframe,
uint32_t first_rb,
uint32_t nb_rb,
uint8_t ant);
uint8_t ant,
uint32_t *gh,
int ljmod10);
/*!
\brief This function initializes the Group Hopping, Sequence Hopping and nPRS sequences for PUCCH/PUSCH according to 36.211 v8.6.0. It should be called after configuration of UE (reception of SIB2/3) and initial configuration of eNB (or after reconfiguration of cell-specific parameters).
......@@ -1714,8 +1717,9 @@ void ulsch_modulation(int32_t **txdataF,
frame_t frame,
uint32_t subframe,
LTE_DL_FRAME_PARMS *frame_parms,
LTE_UE_ULSCH_t *ulsch);
LTE_UE_ULSCH_t *ulsch,
int slsch_flag,
uint32_t cinit);
void ulsch_extract_rbs_single(int32_t **rxdataF,
int32_t **rxdataF_ext,
......
This diff is collapsed.
......@@ -477,10 +477,10 @@ int32_t ulsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms,
int i;
// printf("qpsk llr for symbol %d (pos %d), llr offset %d\n",symbol,(symbol*frame_parms->N_RB_DL*12),llr128U-(__m128i*)ulsch_llr);
// printf("qpsk llr for symbol %d (pos %d), nb_rb %d\n",symbol,(symbol*frame_parms->N_RB_DL*12),nb_rb);
for (i=0; i<(nb_rb*3); i++) {
//printf("%d,%d,%d,%d,%d,%d,%d,%d\n",((int16_t *)rxF)[0],((int16_t *)rxF)[1],((int16_t *)rxF)[2],((int16_t *)rxF)[3],((int16_t *)rxF)[4],((int16_t *)rxF)[5],((int16_t *)rxF)[6],((int16_t *)rxF)[7]);
// printf("%d,%d,%d,%d,%d,%d,%d,%d\n",((int16_t *)rxF)[0],((int16_t *)rxF)[1],((int16_t *)rxF)[2],((int16_t *)rxF)[3],((int16_t *)rxF)[4],((int16_t *)rxF)[5],((int16_t *)rxF)[6],((int16_t *)rxF)[7]);
*(*llrp128) = *rxF;
rxF++;
(*llrp128)++;
......@@ -735,7 +735,7 @@ void ulsch_extract_rbs_single(int32_t **rxdataF,
nb_rb2 = 2*nb_rb - nb_rb1; // 2 times no. RBs after the DC
#ifdef DEBUG_ULSCH
printf("ulsch_extract_rbs_single: 2*nb_rb1 = %d, 2*nb_rb2 = %d\n",nb_rb1,nb_rb2);
printf("ulsch_extract_rbs_single: symbol %d 2*nb_rb1 = %d, 2*nb_rb2 = %d, first_rb %d\n",symbol,nb_rb1,nb_rb2,first_rb);
#endif
rxF_ext = &rxdataF_ext[aarx][(symbol*frame_parms->N_RB_UL*12)];
......@@ -753,6 +753,9 @@ void ulsch_extract_rbs_single(int32_t **rxdataF,
} else { //there is only data in the second half
rxF = &rxdataF[aarx][(6*(2*first_rb - frame_parms->N_RB_UL) + symbol*frame_parms->ofdm_symbol_size)];
#ifdef DEBUG_ULSCH
printf("copying %d REs from %p to %p\n",nb_rb2*6,rxF,rxF_ext);
#endif
memcpy(rxF_ext, rxF, nb_rb2*6*sizeof(int));
rxF_ext += nb_rb2*6;
}
......@@ -1166,26 +1169,43 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
l/(frame_parms->symbols_per_tti/2),
frame_parms);
int Ns = l/(frame_parms->symbols_per_tti/2);
int lmod = l%(frame_parms->symbols_per_tti/2);
int cyclic_shift = (frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift +
eNB->ulsch[UE_id]->harq_processes[harq_pid]->n_DMRS2 +
frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[(subframe<<1)+Ns]) % 12;
lte_ul_channel_estimation(&eNB->frame_parms,
pusch_vars->drs_ch_estimates,
pusch_vars->drs_ch_estimates_time,
pusch_vars->rxdataF_ext,
ulsch[UE_id]->harq_processes[harq_pid]->nb_rb,
proc->frame_rx,
subframe,
frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[Ns+(subframe<<1)],
frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[Ns+(subframe<<1)],
cyclic_shift,
lmod,
Ns,
ulsch[UE_id]->rnti);
}
int cyclic_shift = (frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift +
eNB->ulsch[UE_id]->harq_processes[harq_pid]->n_DMRS2 +
frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[(subframe<<1)]) % 12;
lte_ul_channel_estimation(&eNB->frame_parms,
pusch_vars->drs_ch_estimates,
pusch_vars->drs_ch_estimates_time,
pusch_vars->rxdataF_ext,
ulsch[UE_id]->harq_processes[harq_pid]->nb_rb,
proc->frame_rx,
subframe,
frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[(subframe<<1)],
frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[(subframe<<1)],
cyclic_shift,
3 - frame_parms->Ncp,
1, // interpolation
ulsch[UE_id]->rnti);
cyclic_shift = (frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift +
eNB->ulsch[UE_id]->harq_processes[harq_pid]->n_DMRS2 +
frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[1+(subframe<<1)]) % 12;
lte_ul_channel_estimation(&eNB->frame_parms,
pusch_vars->drs_ch_estimates,
pusch_vars->drs_ch_estimates_time,
pusch_vars->rxdataF_ext,
ulsch[UE_id]->harq_processes[harq_pid]->nb_rb,
proc->frame_rx,
subframe,
frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[1+(subframe<<1)],
frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)],
cyclic_shift,
10 - 2*frame_parms->Ncp,
1, // interpolation
ulsch[UE_id]->rnti);
int correction_factor = 1;
int deltaMCS=1;
int MPR_times_100Ks;
......@@ -1281,10 +1301,6 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
}
}
//#ifdef DEBUG_ULSCH
// Inverse-Transform equalized outputs
// printf("Doing IDFTs\n");
......
......@@ -370,7 +370,9 @@ void ulsch_modulation(int32_t **txdataF,
uint32_t frame,
uint32_t subframe,
LTE_DL_FRAME_PARMS *frame_parms,
LTE_UE_ULSCH_t *ulsch)
LTE_UE_ULSCH_t *ulsch,
int slsch_flag,
uint32_t cinit)
{
uint8_t qam64_table_offset_re = 0;
......@@ -383,7 +385,7 @@ void ulsch_modulation(int32_t **txdataF,
int re_offset,re_offset0,i,Msymb,j,k,nsymb,Msc_PUSCH,l;
// uint8_t harq_pid = (rag_flag == 1) ? 0 : subframe2harq_pid_tdd(frame_parms->tdd_config,subframe);
uint8_t harq_pid = subframe2harq_pid(frame_parms,frame,subframe);
uint8_t harq_pid;
uint8_t Q_m;
int32_t *txptr;
uint32_t symbol_offset;
......@@ -394,26 +396,31 @@ void ulsch_modulation(int32_t **txdataF,
uint32_t x1, x2, s=0;
uint8_t c;
if (slsch_flag ==0) {
harq_pid = subframe2harq_pid(frame_parms,frame,subframe);
// x1 is set in lte_gold_generic
x2 = (ulsch->rnti<<14) + (subframe<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.3.1
}
else {
harq_pid = 0;
x2 = cinit;
LOG_I(PHY,"Setting seed for SL to %x\n",x2);
}
if (!ulsch) {
printf("ulsch_modulation.c: Null ulsch\n");
return;
}
// x1 is set in lte_gold_generic
x2 = (ulsch->rnti<<14) + (subframe<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.3.1
if (harq_pid>=8) {
printf("ulsch_modulation.c: Illegal harq_pid %d\n",harq_pid);
return;
}
AssertFatal(harq_pid<8,
"ulsch_modulation.c: Illegal harq_pid %d\n",harq_pid);
first_rb = ulsch->harq_processes[harq_pid]->first_rb;
nb_rb = ulsch->harq_processes[harq_pid]->nb_rb;
if (nb_rb == 0) {
printf("ulsch_modulation.c: Frame %d, Subframe %d Illegal nb_rb %d\n",frame,subframe,nb_rb);
return;
}
AssertFatal(nb_rb > 0 && nb_rb < frame_parms->N_RB_UL,
"ulsch_modulation.c: Frame %d, Subframe %d Illegal nb_rb %d, harq_pid %d\n",frame,subframe,nb_rb,harq_pid);
if (first_rb > frame_parms->N_RB_UL) {
printf("ulsch_modulation.c: Frame %d, Subframe %d Illegal first_rb %d\n",frame,subframe,first_rb);
......@@ -432,16 +439,16 @@ void ulsch_modulation(int32_t **txdataF,
Msc_PUSCH = ulsch->harq_processes[harq_pid]->nb_rb*12;
#ifdef DEBUG_ULSCH_MODULATION
LOG_D(PHY,"ulsch_modulation.c: Doing modulation (rnti %x,x2 %x) for G=%d bits, harq_pid %d , nb_rb %d, Q_m %d, Nsymb_pusch %d (nsymb %d), subframe %d\n",
LOG_I(PHY,"ulsch_modulation.c: Doing modulation (rnti %x,x2 %x) for G=%d bits, harq_pid %d , nb_rb %d, Q_m %d, Nsymb_pusch %d (nsymb %d), subframe %d\n",
ulsch->rnti,x2,G,harq_pid,ulsch->harq_processes[harq_pid]->nb_rb,Q_m, ulsch->Nsymb_pusch,nsymb,subframe);
#endif
// scrambling (Note the placeholding bits are handled in ulsch_coding.c directly!)
//printf("ulsch bits: ");
// printf("ulsch bits: ");
s = lte_gold_generic(&x1, &x2, 1);
k=0;
//printf("G %d\n",G);
// printf("G %d\n",G);
for (i=0; i<(1+(G>>5)); i++) {
for (j=0; j<32; j++,k++) {
c = (uint8_t)((s>>j)&1);
......@@ -454,7 +461,7 @@ void ulsch_modulation(int32_t **txdataF,
ulsch->b_tilde[k] = ulsch->b_tilde[k-1];
} else {
ulsch->b_tilde[k] = (ulsch->h[k]+c)&1;
// printf("i %d : %d (h %d c %d)\n", (i<<5)+j,ulsch->b_tilde[k],ulsch->h[k],c);
// printf("i %d : %d (h %d c %d)\n", (i<<5)+j,ulsch->b_tilde[k],ulsch->h[k],c);
}
}
......@@ -619,7 +626,7 @@ void ulsch_modulation(int32_t **txdataF,
((int16_t*)&ulsch->d[i])[0] = (ulsch->b_tilde[j] == 1) ? (-gain_lin_QPSK) : gain_lin_QPSK;
((int16_t*)&ulsch->d[i])[1] = (ulsch->b_tilde[j+1] == 1)? (-gain_lin_QPSK) : gain_lin_QPSK;
// if (i<Msc_PUSCH)
// printf("input %d/%d Msc_PUSCH %d (%p): %d,%d\n", i,Msymb,Msc_PUSCH,&ulsch->d[i],((int16_t*)&ulsch->d[i])[0],((int16_t*)&ulsch->d[i])[1]);
// printf("input %d/%d Msc_PUSCH %d (%p): %d,%d\n", i,Msymb,Msc_PUSCH,&ulsch->d[i],((int16_t*)&ulsch->d[i])[0],((int16_t*)&ulsch->d[i])[1]);
break;
......
......@@ -22,9 +22,10 @@
#include "PHY/defs.h"
#include "PHY/extern.h"
#include "defs.h"
//#define DEBUG_FEP
//#define DEBUG_FEP
//#undef LOG_D
//#define LOG_D(A,B,C...) printf(B,C)
int slot_fep_ul(RU_t *ru,
unsigned char l,
......@@ -88,15 +89,9 @@ int slot_fep_ul(RU_t *ru,
slot_offset = (fp->samples_per_tti>>1) * (Ns&1);
}
if (l<0 || l>=7-fp->Ncp) {
LOG_E(PHY,"slot_fep: l must be between 0 and %d\n",7-fp->Ncp);
return(-1);
}
AssertFatal(l>=0 && l<7-fp->Ncp,"slot_fep: l must be between 0 and %d\n",7-fp->Ncp);
AssertFatal(Ns>=0 && Ns<20,"slot_fep: Ns must be between 0 and 19\n");
if (Ns<0 || Ns>=20) {
LOG_E(PHY,"slot_fep: Ns must be between 0 and 19\n");
return(-1);
}
#ifdef DEBUG_FEP
LOG_D(PHY,"slot_fep: Ns %d offset %d, symbol %d, nb_prefix_samples %d\n",Ns,slot_offset,symbol, nb_prefix_samples);
......@@ -113,6 +108,10 @@ int slot_fep_ul(RU_t *ru,
(int16_t *)&common->rxdataF[aa][fp->ofdm_symbol_size*symbol],
1
);
#ifdef DEBUG_FEP
LOG_D(PHY,"slot_fep: symbol %d %d dB (output)\n",l,
dB_fixed(signal_energy(&common->rxdataF[aa][fp->ofdm_symbol_size*symbol],fp->ofdm_symbol_size)));
#endif
} else {
rx_offset += (fp->ofdm_symbol_size+nb_prefix_samples)*l;
......@@ -121,16 +120,32 @@ int slot_fep_ul(RU_t *ru,
memcpy((void *)&tmp_dft_in,
(void *)&common->rxdata_7_5kHz[aa][(rx_offset % frame_length_samples)],
fp->ofdm_symbol_size*sizeof(int));
#ifdef DEBUG_FEP
LOG_D(PHY,"slot_fep: symbol %d %d dB\n",l,
dB_fixed(signal_energy(&tmp_dft_in,fp->ofdm_symbol_size)));
#endif
dft( (short *) tmp_dft_in,
(short*) &common->rxdataF[aa][fp->ofdm_symbol_size*symbol],
1
);
#ifdef DEBUG_FEP
LOG_D(PHY,"slot_fep: symbol %d %d dB (output)\n",l,
dB_fixed(signal_energy(&common->rxdataF[aa][fp->ofdm_symbol_size*symbol],fp->ofdm_symbol_size)));
#endif
}
else{
#ifdef DEBUG_FEP
LOG_D(PHY,"slot_fep: symbol %d %d dB\n",l,
dB_fixed(signal_energy(&common->rxdata_7_5kHz[aa][rx_offset],fp->ofdm_symbol_size)));
#endif
dft( (short *)&common->rxdata_7_5kHz[aa][rx_offset],
(short*)&common->rxdataF[aa][fp->ofdm_symbol_size*symbol],
1
);
#ifdef DEBUG_FEP
LOG_D(PHY,"slot_fep: symbol %d %d dB (output)\n",l,
dB_fixed(signal_energy(&common->rxdataF[aa][fp->ofdm_symbol_size*symbol],fp->ofdm_symbol_size)));
#endif
}
}
}
......
......@@ -205,13 +205,14 @@ void remove_7_5_kHz(RU_t *ru,uint8_t slot)
kHz7_5ptr128 = (int16x8_t *)kHz7_5ptr;
#endif
// apply 7.5 kHz
// if (((slot>>1)&1) == 0) { // apply the sinusoid from the table directly
for (i=0; i<(len>>2); i++) {
#if defined(__x86_64__) || defined(__i386__)
kHz7_5_2 = _mm_sign_epi16(*kHz7_5ptr128,*(__m128i*)&conjugate75_2[0]);
mmtmp_re = _mm_madd_epi16(*rxptr128,kHz7_5_2);
// Real part of complex multiplication (note: 7_5kHz signal is conjugated for this to work)
mmtmp_im = _mm_shufflelo_epi16(kHz7_5_2,_MM_SHUFFLE(2,3,0,1));
mmtmp_im = _mm_shufflehi_epi16(mmtmp_im,_MM_SHUFFLE(2,3,0,1));
......@@ -222,11 +223,14 @@ void remove_7_5_kHz(RU_t *ru,uint8_t slot)
mmtmp_re2 = _mm_unpacklo_epi32(mmtmp_re,mmtmp_im);
mmtmp_im2 = _mm_unpackhi_epi32(mmtmp_re,mmtmp_im);
rxptr128_7_5kHz[0] = _mm_packs_epi32(mmtmp_re2,mmtmp_im2);
rxptr128++;
rxptr128_7_5kHz++;
kHz7_5ptr128++;
#elif defined(__arm__)
kHz7_5ptr128[0] = vmulq_s16(kHz7_5ptr128[0],((int16x8_t*)conjugate75_2)[0]);
......
......@@ -66,8 +66,8 @@ int write_output(const char *fname,const char *vname,void *data,int length,int d
case 15:
for (i=0; i<length<<1; i+=(2*dec)) {
//fprintf(fp,"%d + j*(%d)\n",((short *)data)[i],((short *)data)[i+1]);
fprintf(fp,"%d,%d,",((short *)data)[i],((short *)data)[i+1]);
fprintf(fp,"%d + j*(%d)\n",((short *)data)[i],((short *)data)[i+1]);
//fprintf(fp,"%d,%d,",((short *)data)[i],((short *)data)[i+1]);
}
fprintf(fp,"\n");
......
......@@ -1264,13 +1264,30 @@ typedef struct {
LTE_UE_DLSCH_t *dlsch_MCH[NUMBER_OF_CONNECTED_eNB_MAX];
// This is for SIC in the UE, to store the reencoded data
LTE_eNB_DLSCH_t *dlsch_eNB[NUMBER_OF_CONNECTED_eNB_MAX];
// Sidelink-specific variables
SL_chan_t sl_chan;
LTE_eNB_DLSCH_t *dlsch_slsch;
LTE_UE_ULSCH_t *ulsch_slsch;
LTE_eNB_PUSCH *pusch_slsch;
LTE_eNB_PUSCH *pusch_slcch;
LTE_UE_DLSCH_t *dlsch_rx_slsch;
int16_t **slsch_rxdataF;
int16_t **slcch_rxdataF;
int16_t **slsch_rxdata_7_5kHz;
int16_t **slcch_rxdata_7_5kHz;
int16_t *slsch_dlsch_llr;
int16_t *slsch_ulsch_llr;
SLSCH_t *slsch;
SLSCH_t slsch_rx;
int slsch_active;
int slsch_sdu_active;
int slsch_rx_sdu_active;
int slcch_received;
int slsch_decoded;
uint8_t sidelink_l2_emulation;
uint32_t slsch_txcnt;
uint32_t slsch_errors;
uint32_t slsch_rxcnt[4];
//Paging parameters
uint32_t IMSImod1024;
uint32_t PF;
......@@ -1346,8 +1363,11 @@ typedef struct {
int current_dlsch_cqi[NUMBER_OF_CONNECTED_eNB_MAX];
unsigned char first_run_timing_advance[NUMBER_OF_CONNECTED_eNB_MAX];
uint8_t sidelink_active;
uint8_t destination_id;
uint32_t gh[256][20];
uint8_t pscch_coded;
uint8_t pscch_generated;
uint8_t pssch_generated;
uint8_t generate_prach;
uint8_t prach_cnt;
uint8_t prach_PreambleIndex;
......
......@@ -1112,7 +1112,7 @@ typedef struct {
/// maximum size for N_SL_RB=100, SCI_A=1+13+7+5+11+8 = 45,
#define SCI_A 45
/// SCI_E=12 REs * 6 symbols * 2 bits/RE
/// SCI_E=12 REs * (7-1) symbols * 2 bits/RE
#define SCI_E (12*6*2)
typedef struct {
/// Coded PSCCH bits (12 REs, 12 OFDM symbols, 2 bits/RE)
......
......@@ -1290,6 +1290,7 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, uint8_t empt
frame_parms->nb_prefix_samples,
CYCLIC_PREFIX);
else {
normal_prefix_mod(&ue->common_vars.txdataF[aa][subframe_tx*nsymb*frame_parms->ofdm_symbol_size],
#if defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_BLADERF) || defined(OAI_LMSSDR)
dummy_tx_buffer,
......@@ -1848,7 +1849,9 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
frame_tx,
subframe_tx,
&ue->frame_parms,
ue->ulsch[eNB_id]);
ue->ulsch[eNB_id],
0,
0);
for (aa=0; aa<1/*frame_parms->nb_antennas_tx*/; aa++)
generate_drs_pusch(ue,
proc,
......@@ -1857,7 +1860,9 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
subframe_tx,
first_rb,
nb_rb,
aa);
aa,
NULL,
0);
#if UE_TIMING_TRACE
stop_meas(&ue->ulsch_modulation_stats);
#endif
......@@ -2352,7 +2357,7 @@ void phy_procedures_UE_SL_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc) {
if ((sldch = ue_get_sldch(ue->Mod_id,ue->CC_id,frame_tx,subframe_tx)) != NULL) generate_sldch(ue,sldch,frame_tx,subframe_tx);
// check for SLSCH
if ((slsch = ue_get_slsch(ue->Mod_id,ue->CC_id,frame_tx,subframe_tx)) != NULL) generate_slsch(ue,slsch,frame_tx,subframe_tx);
if ((slsch = ue_get_slsch(ue->Mod_id,ue->CC_id,frame_tx,subframe_tx)) != NULL) generate_slsch(ue,proc,slsch,frame_tx,subframe_tx);
}
......
......@@ -110,7 +110,7 @@ double dac_fixed_gain(double *s_re[2],
// printf("DAC: amp %f, amp1 %f dB (%d,%d), tx_power %f (%f),length %d,pos %d\n",20*log10(amp),20*log10(*amp1p),input_offset,input_offset_meas,txpwr_dBm,length, 10*log10((double)signal_energy((int32_t*)&input[0][input_offset_meas],length_meas)/NB_RE),input_offset_meas);
//printf("DAC: amp %f, amp1 %f dB (%d,%d), tx_power %f (%f),length %d,pos %d\n",20*log10(amp),20*log10(*amp1p),input_offset,input_offset_meas,txpwr_dBm,length, 10*log10((double)signal_energy((int32_t*)&input[0][input_offset_meas],length_meas)/NB_RE),input_offset_meas);
/*
if (nb_tx_antennas==2)
......@@ -133,5 +133,12 @@ double dac_fixed_gain(double *s_re[2],
// printf("ener %e\n",signal_energy_fp(s_re,s_im,nb_tx_antennas,length,0));
return(signal_energy_fp(s_re,s_im,nb_tx_antennas,length<length_meas?length:length_meas,0)/NB_RE);
double *s_re2[2],*s_im2[2];
for (i=0;i<nb_tx_antennas;i++) {
s_re2[i]=&s_re[i][-input_offset+input_offset_meas];
s_im2[i]=&s_re[i][-input_offset+input_offset_meas];
}
// printf("DAC: input_offset_meas %d (%p,%p)\n",-input_offset+input_offset_meas,s_re[0],s_re2[0]);
return(signal_energy_fp(s_re2,s_im2,nb_tx_antennas,length<length_meas?length:length_meas,0)/NB_RE);
}
......@@ -60,8 +60,14 @@
#include "oaisim.h"
#define RF
//#define DEBUG_SIM
//#define DEBUG_SIM
/*
#undef LOG_I
#define LOG_I(A,B,C...) printf(B,C);
#undef LOG_D
#define LOG_D(A,B,C...) printf(B,C);
*/
int number_rb_ul;
int first_rbUL ;
......@@ -543,7 +549,7 @@ void do_UL_sig(channel_desc_t *UE2RU[NUMBER_OF_UE_MAX][NUMBER_OF_RU_MAX][MAX_NUM
}
void do_SL_sig(int UE_id,channel_desc_t *UE2UE[NUMBER_OF_UE_MAX][NUMBER_OF_UE_MAX][MAX_NUM_CCs],
uint16_t subframe,LTE_DL_FRAME_PARMS *frame_parms,
uint16_t subframe,uint16_t slot, LTE_DL_FRAME_PARMS *frame_parms,
uint32_t frame,uint8_t CC_id)
{
......@@ -599,11 +605,11 @@ void do_SL_sig(int UE_id,channel_desc_t *UE2UE[NUMBER_OF_UE_MAX][NUMBER_OF_UE_MA
if (((double)PHY_vars_UE_g[UE_id][CC_id]->tx_power_dBm[subframe] +
UE2UE[UE_id][0][CC_id]->path_loss_dB) <= -125.0) {
// don't simulate a UE that is too weak
LOG_D(OCM,"[SIM][UL] UE %d tx_pwr %d dBm (num_RE %d) for subframe %d (sf_offset %d)\n",
LOG_D(OCM,"[SIM][SL] UE %d tx_pwr %d dBm (num_RE %d) for subframe %d (sf_offset %d,slot_ind %d)\n",
UE_id,
PHY_vars_UE_g[UE_id][CC_id]->tx_power_dBm[subframe],
PHY_vars_UE_g[UE_id][CC_id]->tx_total_RE[subframe],
subframe,sf_offset);
subframe,slot,sf_offset);
} else {
tx_pwr = dac_fixed_gain((double**)s_re,
(double**)s_im,
......@@ -611,19 +617,20 @@ void do_SL_sig(int UE_id,channel_desc_t *UE2UE[NUMBER_OF_UE_MAX][NUMBER_OF_UE_MA
sf_offset,
nb_antennas_tx,
frame_parms->samples_per_tti,
sf_offset,
(slot == 2)? sf_offset+(frame_parms->samples_per_tti>>1) : sf_offset,
frame_parms->ofdm_symbol_size,
14,
(double)PHY_vars_UE_g[UE_id][CC_id]->tx_power_dBm[subframe]-10*log10((double)PHY_vars_UE_g[UE_id][CC_id]->tx_total_RE[subframe]),
1,
NULL,
PHY_vars_UE_g[UE_id][CC_id]->tx_total_RE[subframe]); // This make the previous argument the total power
LOG_D(OCM,"[SIM][UL] UE %d tx_pwr %f dBm (target %d dBm, num_RE %d) for subframe %d (sf_offset %d)\n",
LOG_I(OCM,"[SIM][SL] UE %d tx_pwr %f dBm (target %d dBm, num_RE %d) for subframe %d (sf_offset %d/%d)\n",
UE_id,
10*log10(tx_pwr*PHY_vars_UE_g[UE_id][CC_id]->tx_total_RE[subframe]),
PHY_vars_UE_g[UE_id][CC_id]->tx_power_dBm[subframe],
PHY_vars_UE_g[UE_id][CC_id]->tx_total_RE[subframe],
subframe,sf_offset);
subframe,sf_offset,
(slot == 2)? sf_offset+(frame_parms->samples_per_tti>>1) : sf_offset);
multipath_channel(UE2UE[UE_id][0][CC_id],s_re,s_im,r_re0,r_im0,
......@@ -633,12 +640,12 @@ void do_SL_sig(int UE_id,channel_desc_t *UE2UE[NUMBER_OF_UE_MAX][NUMBER_OF_UE_MA
rx_pwr = signal_energy_fp2(UE2UE[UE_id][0][CC_id]->ch[0],
UE2UE[UE_id][0][CC_id]->channel_length)*UE2UE[UE_id][0][CC_id]->channel_length;
LOG_D(OCM,"[SIM][UL] subframe %d Channel UE %d => UE %d : %f dB (hold %d,length %d, PL %f)\n",subframe,UE_id,0,10*log10(rx_pwr),
LOG_I(OCM,"[SIM][SL] subframe %d Channel UE %d => UE %d : %f dB (hold %d,length %d, PL %f)\n",subframe,UE_id,0,10*log10(rx_pwr),
hold_channel,UE2UE[UE_id][0][CC_id]->channel_length,
UE2UE[UE_id][0][CC_id]->path_loss_dB);
rx_pwr = signal_energy_fp(r_re0,r_im0,nb_antennas_rx,frame_parms->samples_per_tti,0);
LOG_D(OCM,"[SIM][UL] UE %d (%d/%d rx antennas) : rx_pwr %f dBm (tx_pwr - PL %f) for subframe %d, sptti %d\n",
LOG_I(OCM,"[SIM][SL] UE %d (%d/%d rx antennas) : rx_pwr %f dBm (tx_pwr - PL %f) for subframe %d, sptti %d\n",
UE_id,nb_antennas_rx,UE2UE[UE_id][0][CC_id]->nb_rx,10*log10(rx_pwr),10*log10(tx_pwr*PHY_vars_UE_g[UE_id][CC_id]->tx_total_RE[subframe])+UE2UE[UE_id][0][CC_id]->path_loss_dB,subframe,frame_parms->samples_per_tti);
/*
if (abs(10*log10(rx_pwr)-10*log10(tx_pwr*PHY_vars_UE_g[UE_id][CC_id]->tx_total_RE[subframe])-UE2RU[UE_id][ru_id][CC_id]->path_loss_dB)>3) {
......@@ -666,7 +673,7 @@ void do_SL_sig(int UE_id,channel_desc_t *UE2UE[NUMBER_OF_UE_MAX][NUMBER_OF_UE_MA
double *r_im_p[2] = {r_im_SL[0][0],r_im_SL[0][1]};
rx_pwr = signal_energy_fp(r_re_p,r_im_p,nb_antennas_rx,frame_parms->samples_per_tti,0);
LOG_D(OCM,"[SIM][UL] UE %d (%d/%d rx antennas) : rx_pwr %f dBm (before RF) for subframe %d, gain %f\n",
LOG_D(OCM,"[SIM][SL] UE %d (%d/%d rx antennas) : rx_pwr %f dBm (before RF) for subframe %d, gain %f\n",
UE_id,nb_antennas_rx,nb_antennas_rx,10*log10(rx_pwr),subframe,
PHY_vars_UE_g[UE_id][CC_id]->rx_total_gain_dB - 66.227);
rf_rx_simple(r_re_p,
......@@ -678,8 +685,8 @@ void do_SL_sig(int UE_id,channel_desc_t *UE2UE[NUMBER_OF_UE_MAX][NUMBER_OF_UE_MA
#ifdef DEBUG_SIM
rx_pwr = signal_energy_fp(r_re_p,r_im_p,nb_antennas_rx,frame_parms->samples_per_tti,0);//*(double)frame_parms->ofdm_symbol_size/(12.0*frame_parms->N_RB_DL;
LOG_D(OCM,"[SIM][UL] rx_pwr (ADC in) %f dB for subframe %d (rx_gain %f)\n",10*log10(rx_pwr),subframe,
PHY_vars_UE_g[0][CC_id]->rx_total_gain_dB);
LOG_D(OCM,"[SIM][SL] rx_pwr (ADC in) %f dB for subframe %d (rx_gain %d)\n",10*log10(rx_pwr),subframe,
PHY_vars_UE_g[UE_id][CC_id]->rx_total_gain_dB);
#endif
rxdata = PHY_vars_UE_g[0][CC_id]->common_vars.rxdata;
......@@ -697,7 +704,7 @@ void do_SL_sig(int UE_id,channel_desc_t *UE2UE[NUMBER_OF_UE_MAX][NUMBER_OF_UE_MA
#ifdef DEBUG_SIM
rx_pwr2 = signal_energy(rxdata[0]+sf_offset,frame_parms->samples_per_tti)*(double)frame_parms->ofdm_symbol_size/(12.0*frame_parms->N_RB_DL);
LOG_D(OCM,"[SIM][UL] UE %d rx_pwr (ADC out) %f dB (%d) for subframe %d (offset %d) = %p\n",UE_id,10*log10((double)rx_pwr2),rx_pwr2,subframe,sf_offset,rxdata[0]+sf_offset);
LOG_D(OCM,"[SIM][SL] UE %d rx_pwr (ADC out) %f dB (%d) for subframe %d (offset %d) = %p\n",UE_id,10*log10((double)rx_pwr2),rx_pwr2,subframe,sf_offset,rxdata[0]+sf_offset);
#else
UNUSED_VARIABLE(tx_pwr);
UNUSED_VARIABLE(rx_pwr);
......
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