Commit 9edbe82d authored by Khalid Ahmed's avatar Khalid Ahmed Committed by Thomas Schlichter

UE IFFT

parent a536aa29
...@@ -788,7 +788,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, ...@@ -788,7 +788,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue,
for (i=0; i<fp->nb_antennas_tx; i++) { for (i=0; i<fp->nb_antennas_tx; i++) {
common_vars->txdata[i] = (int32_t*)malloc16_clear( fp->samples_per_subframe*10*sizeof(int32_t) ); common_vars->txdata[i] = (int32_t*)malloc16_clear( fp->samples_per_subframe*10*sizeof(int32_t) );
common_vars->txdataF[i] = (int32_t *)malloc16_clear( fp->ofdm_symbol_size*fp->symbols_per_slot*fp->slots_per_frame*sizeof(int32_t) ); common_vars->txdataF[i] = (int32_t *)malloc16_clear( fp->samples_per_frame_wCP*sizeof(int32_t) );
} }
// init RX buffers // init RX buffers
......
...@@ -163,6 +163,10 @@ int main(int argc, char **argv) { ...@@ -163,6 +163,10 @@ int main(int argc, char **argv) {
uint8_t Imcs = 9; uint8_t Imcs = 9;
int eNB_id = 0; int eNB_id = 0;
int ap; int ap;
int tx_offset;
int sample_offsetF;
int slot_offsetF;
int txlev;
cpuf = get_cpu_freq_GHz(); cpuf = get_cpu_freq_GHz();
...@@ -627,7 +631,7 @@ int main(int argc, char **argv) { ...@@ -627,7 +631,7 @@ int main(int argc, char **argv) {
if (start_sc >= frame_parms->ofdm_symbol_size) if (start_sc >= frame_parms->ofdm_symbol_size)
start_sc -= frame_parms->ofdm_symbol_size; start_sc -= frame_parms->ofdm_symbol_size;
slot_offsetF = slot*frame_parms->symbols_per_slot*frame_parms->ofdm_symbol_size;
for (ap=0; ap<harq_process_ul_ue->Nl; ap++) { for (ap=0; ap<harq_process_ul_ue->Nl; ap++) {
...@@ -642,15 +646,18 @@ int main(int argc, char **argv) { ...@@ -642,15 +646,18 @@ int main(int argc, char **argv) {
uint16_t m=0, n=0, dmrs_idx=0, k=0; uint16_t m=0, n=0, dmrs_idx=0, k=0;
for (l=start_symbol; l<start_symbol+nb_symb_sch; l++) { for (l=start_symbol; l<start_symbol+nb_symb_sch; l++) {
k = start_sc; k = start_sc;
sample_offsetF = l*frame_parms->ofdm_symbol_size + k + slot_offsetF;
for (i=0; i<nb_rb*NR_NB_SC_PER_RB; i++) { for (i=0; i<nb_rb*NR_NB_SC_PER_RB; i++) {
if ((l == dmrs_symbol) && (k == ((start_sc+get_dmrs_freq_idx(n, k_prime, delta, dmrs_type))%(frame_parms->ofdm_symbol_size)))) { if ((l == dmrs_symbol) && (k == ((start_sc+get_dmrs_freq_idx(n, k_prime, delta, dmrs_type))%(frame_parms->ofdm_symbol_size)))) {
((int16_t*)txdataF[ap])[(l*frame_parms->ofdm_symbol_size + k)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*amp*mod_dmrs[dmrs_idx<<1]) >> 15; ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (Wt[l_prime[0]]*Wf[k_prime]*amp*mod_dmrs[dmrs_idx<<1]) >> 15;
((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*amp*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15; ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (Wt[l_prime[0]]*Wf[k_prime]*amp*mod_dmrs[(dmrs_idx<<1) + 1]) >> 15;
#ifdef DEBUG_PUSCH_MAPPING #ifdef DEBUG_PUSCH_MAPPING
printf("dmrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t txdataF: %d %d\n", printf("dmrs_idx %d\t l %d \t k %d \t k_prime %d \t n %d \t txdataF: %d %d\n",
dmrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[(l*frame_parms->ofdm_symbol_size + k)<<1], dmrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[(sample_offsetF)<<1],
((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1]); ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1]);
#endif #endif
dmrs_idx++; dmrs_idx++;
k_prime++; k_prime++;
...@@ -660,12 +667,12 @@ dmrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[(l*frame_parms->ofdm_symbol_ ...@@ -660,12 +667,12 @@ dmrs_idx, l, k, k_prime, n, ((int16_t*)txdataF[ap])[(l*frame_parms->ofdm_symbol_
else { else {
((int16_t*)txdataF[ap])[(l*frame_parms->ofdm_symbol_size + k)<<1] = (amp * tx_layers[ap][m<<1]) >> 15; ((int16_t*)txdataF[ap])[(sample_offsetF)<<1] = (amp * tx_layers[ap][m<<1]) >> 15;
((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (amp * tx_layers[ap][(m<<1) + 1]) >> 15; ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1] = (amp * tx_layers[ap][(m<<1) + 1]) >> 15;
#ifdef DEBUG_PUSCH_MAPPING #ifdef DEBUG_PUSCH_MAPPING
printf("m %d\t l %d \t k %d \t txdataF: %d %d\n", printf("m %d\t l %d \t k %d \t txdataF: %d %d\n",
m, l, k, ((int16_t*)txdataF[ap])[(l*frame_parms->ofdm_symbol_size + k)<<1], m, l, k, ((int16_t*)txdataF[ap])[(sample_offsetF)<<1],
((int16_t*)txdataF[ap])[((l*frame_parms->ofdm_symbol_size + k)<<1) + 1]); ((int16_t*)txdataF[ap])[((sample_offsetF)<<1) + 1]);
#endif #endif
m++; m++;
} }
...@@ -675,10 +682,34 @@ m, l, k, ((int16_t*)txdataF[ap])[(l*frame_parms->ofdm_symbol_size + k)<<1], ...@@ -675,10 +682,34 @@ m, l, k, ((int16_t*)txdataF[ap])[(l*frame_parms->ofdm_symbol_size + k)<<1],
} }
} }
/////////// ///////////
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
/////////////////////////IFFT///////////////////////
///////////
tx_offset = slot*frame_parms->samples_per_slot;
for (ap=0; ap<harq_process_ul_ue->Nl; ap++) {
if (frame_parms->Ncp == 1) { // extended cyclic prefix
PHY_ofdm_mod(&txdataF[ap][slot_offsetF],
&txdata[ap][tx_offset],
frame_parms->ofdm_symbol_size,
12,
frame_parms->nb_prefix_samples,
CYCLIC_PREFIX);
} else { // normal cyclic prefix
nr_normal_prefix_mod(&txdataF[ap][slot_offsetF],
&txdata[ap][tx_offset],
14,
frame_parms);
}
}
///////////
////////////////////////////////////////////////////
for (SNR = snr0; SNR < snr1; SNR += snr_step) { for (SNR = snr0; SNR < snr1; SNR += snr_step) {
n_errors = 0; n_errors = 0;
......
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