Commit 93bf1630 authored by Raymond Knopp's avatar Raymond Knopp

commit prior to merge with develop

parent addaeffb
......@@ -843,6 +843,7 @@ set(PHY_SRC
${OPENAIR1_DIR}/PHY/CODING/viterbi_lte.c
${OPENAIR1_DIR}/PHY/INIT/lte_init.c
${OPENAIR1_DIR}/PHY/INIT/lte_parms.c
${OPENAIR1_DIR}/PHY/INIT/lte_param_init.c
${OPENAIR1_DIR}/PHY/TOOLS/file_output.c
${OPENAIR1_DIR}/PHY/TOOLS/lte_dfts.c
${OPENAIR1_DIR}/PHY/TOOLS/log2_approx.c
......
......@@ -68,33 +68,57 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
break;
default:
msg("Illegal oversampling %d\n",osf);
printf("Illegal oversampling %d\n",osf);
return(-1);
}
switch (frame_parms->N_RB_DL) {
case 100:
if (osf>1) {
msg("Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
printf("Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
return(-1);
}
frame_parms->ofdm_symbol_size = 2048;
frame_parms->log2_symbol_size = 11;
frame_parms->samples_per_tti = 30720;
frame_parms->first_carrier_offset = 2048-600;
if (frame_parms->threequarter_fs) {
frame_parms->ofdm_symbol_size = 1536;
frame_parms->samples_per_tti = 23040;
frame_parms->first_carrier_offset = 1536-600;
frame_parms->nb_prefix_samples=(frame_parms->nb_prefix_samples*3)>>2;
frame_parms->nb_prefix_samples0=(frame_parms->nb_prefix_samples0*3)>>2;
}
else {
frame_parms->ofdm_symbol_size = 2048;
frame_parms->samples_per_tti = 30720;
frame_parms->first_carrier_offset = 2048-600;
}
frame_parms->N_RBGS = 4;
frame_parms->N_RBG = 25;
break;
case 75:
if (osf>1) {
printf("Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
return(-1);
}
frame_parms->ofdm_symbol_size = 1536;
frame_parms->samples_per_tti = 23040;
frame_parms->first_carrier_offset = 1536-450;
frame_parms->nb_prefix_samples=(frame_parms->nb_prefix_samples*3)>>2;
frame_parms->nb_prefix_samples0=(frame_parms->nb_prefix_samples0*3)>>2;
frame_parms->N_RBGS = 4;
frame_parms->N_RBG = 25;
break;
case 50:
if (osf>1) {
msg("Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
printf("Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
return(-1);
}
frame_parms->ofdm_symbol_size = 1024*osf;
frame_parms->log2_symbol_size = 10+log2_osf;
frame_parms->samples_per_tti = 15360*osf;
frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 300;
frame_parms->nb_prefix_samples>>=(1-log2_osf);
......@@ -105,13 +129,13 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
case 25:
if (osf>2) {
msg("Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
printf("Illegal oversampling %d for N_RB_DL %d\n",osf,frame_parms->N_RB_DL);
return(-1);
}
frame_parms->ofdm_symbol_size = 512*osf;
frame_parms->log2_symbol_size = 9+log2_osf;
frame_parms->samples_per_tti = 7680*osf;
frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 150;
frame_parms->nb_prefix_samples>>=(2-log2_osf);
......@@ -124,7 +148,6 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
case 15:
frame_parms->ofdm_symbol_size = 256*osf;
frame_parms->log2_symbol_size = 8+log2_osf;
frame_parms->samples_per_tti = 3840*osf;
frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 90;
frame_parms->nb_prefix_samples>>=(3-log2_osf);
......@@ -135,7 +158,6 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
case 6:
frame_parms->ofdm_symbol_size = 128*osf;
frame_parms->log2_symbol_size = 7+log2_osf;
frame_parms->samples_per_tti = 1920*osf;
frame_parms->first_carrier_offset = frame_parms->ofdm_symbol_size - 36;
frame_parms->nb_prefix_samples>>=(4-log2_osf);
......@@ -145,7 +167,7 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
break;
default:
msg("init_frame_parms: Error: Number of resource blocks (N_RB_DL %d) undefined, frame_parms = %p \n",frame_parms->N_RB_DL, frame_parms);
printf("init_frame_parms: Error: Number of resource blocks (N_RB_DL %d) undefined, frame_parms = %p \n",frame_parms->N_RB_DL, frame_parms);
return(-1);
break;
}
......@@ -159,23 +181,22 @@ int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf)
void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms)
{
msg("frame_parms->N_RB_DL=%d\n",frame_parms->N_RB_DL);
msg("frame_parms->N_RB_UL=%d\n",frame_parms->N_RB_UL);
msg("frame_parms->Nid_cell=%d\n",frame_parms->Nid_cell);
msg("frame_parms->Ncp=%d\n",frame_parms->Ncp);
msg("frame_parms->Ncp_UL=%d\n",frame_parms->Ncp_UL);
msg("frame_parms->nushift=%d\n",frame_parms->nushift);
msg("frame_parms->frame_type=%d\n",frame_parms->frame_type);
msg("frame_parms->tdd_config=%d\n",frame_parms->tdd_config);
msg("frame_parms->tdd_config_S=%d\n",frame_parms->tdd_config_S);
msg("frame_parms->mode1_flag=%d\n",frame_parms->mode1_flag);
msg("frame_parms->nb_antennas_tx=%d\n",frame_parms->nb_antennas_tx);
msg("frame_parms->nb_antennas_rx=%d\n",frame_parms->nb_antennas_rx);
msg("frame_parms->ofdm_symbol_size=%d\n",frame_parms->ofdm_symbol_size);
msg("frame_parms->log2_symbol_size=%d\n",frame_parms->log2_symbol_size);
msg("frame_parms->nb_prefix_samples=%d\n",frame_parms->nb_prefix_samples);
msg("frame_parms->nb_prefix_samples0=%d\n",frame_parms->nb_prefix_samples0);
msg("frame_parms->first_carrier_offset=%d\n",frame_parms->first_carrier_offset);
msg("frame_parms->samples_per_tti=%d\n",frame_parms->samples_per_tti);
msg("frame_parms->symbols_per_tti=%d\n",frame_parms->symbols_per_tti);
printf("frame_parms->N_RB_DL=%d\n",frame_parms->N_RB_DL);
printf("frame_parms->N_RB_UL=%d\n",frame_parms->N_RB_UL);
printf("frame_parms->Nid_cell=%d\n",frame_parms->Nid_cell);
printf("frame_parms->Ncp=%d\n",frame_parms->Ncp);
printf("frame_parms->Ncp_UL=%d\n",frame_parms->Ncp_UL);
printf("frame_parms->nushift=%d\n",frame_parms->nushift);
printf("frame_parms->frame_type=%d\n",frame_parms->frame_type);
printf("frame_parms->tdd_config=%d\n",frame_parms->tdd_config);
printf("frame_parms->tdd_config_S=%d\n",frame_parms->tdd_config_S);
printf("frame_parms->mode1_flag=%d\n",frame_parms->mode1_flag);
printf("frame_parms->nb_antennas_tx=%d\n",frame_parms->nb_antennas_tx);
printf("frame_parms->nb_antennas_rx=%d\n",frame_parms->nb_antennas_rx);
printf("frame_parms->ofdm_symbol_size=%d\n",frame_parms->ofdm_symbol_size);
printf("frame_parms->nb_prefix_samples=%d\n",frame_parms->nb_prefix_samples);
printf("frame_parms->nb_prefix_samples0=%d\n",frame_parms->nb_prefix_samples0);
printf("frame_parms->first_carrier_offset=%d\n",frame_parms->first_carrier_offset);
printf("frame_parms->samples_per_tti=%d\n",frame_parms->samples_per_tti);
printf("frame_parms->symbols_per_tti=%d\n",frame_parms->symbols_per_tti);
}
......@@ -703,24 +703,28 @@ int lte_dl_channel_estimation(PHY_VARS_UE *phy_vars_ue,
void (*idft)(int16_t *,int16_t *, int);
switch (phy_vars_ue->lte_frame_parms.log2_symbol_size) {
case 7:
switch (phy_vars_ue->lte_frame_parms.ofdm_symbol_size) {
case 128:
idft = idft128;
break;
case 8:
case 256:
idft = idft256;
break;
case 9:
case 512:
idft = idft512;
break;
case 10:
case 1024:
idft = idft1024;
break;
case 11:
case 1536:
idft = idft1536;
break;
case 2048:
idft = idft2048;
break;
......
......@@ -61,7 +61,6 @@ int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *com
{
int i,k;
//unsigned short ds = frame_parms->log2_symbol_size - 7;
sync_corr_ue0 = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_tti);
sync_corr_ue1 = (int *)malloc16(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(int)*frame_parms->samples_per_tti);
......@@ -184,13 +183,6 @@ int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *com
LOG_E(PHY,"Unsupported N_RB_DL %d\n",frame_parms->N_RB_DL);
break;
}
/*
frame_parms->twiddle_ifft, /// complex twiddle factors
frame_parms->rev, /// bit reversed permutation vector
frame_parms->log2_symbol_size,/// log2(FFT_SIZE)
(frame_parms->log2_symbol_size/2),
0); /// 0 - input is in complex Q1.15 format, 1 - input is in complex redundant Q1.15 format)
*/
for (i=0; i<frame_parms->ofdm_symbol_size; i++)
((int32_t*)primary_synch0_time)[i] = sync_tmp[i];
......
......@@ -432,7 +432,7 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *phy_vars_eNB,
in_fft_ptr_0 = &temp_in_fft_0[0];
in_fft_ptr_1 = &temp_in_fft_1[0];
for(j=0; j<(1<<(frame_parms->log2_symbol_size))/12; j++) {
for(j=0; j<(frame_parms->ofdm_symbol_size)/12; j++) {
if (j>19) {
((int16_t*)in_fft_ptr_0)[-40+(2*j)] = ((int16_t*)temp_out_ifft_0)[-80+(2*j)]*rx_power_correction;
((int16_t*)in_fft_ptr_0)[-40+(2*j)+1] = ((int16_t*)temp_out_ifft_0)[-80+(2*j+1)]*rx_power_correction;
......
......@@ -72,7 +72,7 @@ int lte_dl_cell_spec_SS(PHY_VARS_eNB *phy_vars_eNB,
else if ((p==1) && (l>0))
nu = 0;
else {
msg("lte_dl_cell_spec: p %d, l %d -> ERROR\n",p,l);
printf("lte_dl_cell_spec: p %d, l %d -> ERROR\n",p,l);
return(-1);
}
......@@ -94,9 +94,9 @@ int lte_dl_cell_spec_SS(PHY_VARS_eNB *phy_vars_eNB,
output[k] = qpsk[(phy_vars_eNB->lte_gold_table[Ns][l][mprime_dword]>>(2*mprime_qpsk_symb))&3];
//output[k] = (lte_gold_table[eNB_offset][Ns][l][mprime_dword]>>(2*mprime_qpsk_symb))&3;
#ifdef DEBUG_DL_CELL_SPEC
msg("Ns %d, l %d, m %d,mprime_dword %d, mprime_qpsk_symbol %d\n",
printf("Ns %d, l %d, m %d,mprime_dword %d, mprime_qpsk_symbol %d\n",
Ns,l,m,mprime_dword,mprime_qpsk_symb);
msg("index = %d (k %d)\n",(phy_vars_eNB->lte_gold_table[Ns][l][mprime_dword]>>(2*mprime_qpsk_symb))&3,k);
printf("index = %d (k %d)\n",(phy_vars_eNB->lte_gold_table[Ns][l][mprime_dword]>>(2*mprime_qpsk_symb))&3,k);
#endif
mprime++;
......@@ -151,7 +151,7 @@ int lte_dl_cell_spec(PHY_VARS_eNB *phy_vars_eNB,
else if ((p==1) && (l>0))
nu = 0;
else {
msg("lte_dl_cell_spec: p %d, l %d -> ERROR\n",p,l);
printf("lte_dl_cell_spec: p %d, l %d -> ERROR\n",p,l);
return(-1);
}
......@@ -177,9 +177,9 @@ int lte_dl_cell_spec(PHY_VARS_eNB *phy_vars_eNB,
output[k] = qpsk[(phy_vars_eNB->lte_gold_table[Ns][l][mprime_dword]>>(2*mprime_qpsk_symb))&3];
//output[k] = (lte_gold_table[eNB_offset][Ns][l][mprime_dword]>>(2*mprime_qpsk_symb))&3;
#ifdef DEBUG_DL_CELL_SPEC
msg("Ns %d, l %d, m %d,mprime_dword %d, mprime_qpsk_symbol %d\n",
printf("Ns %d, l %d, m %d,mprime_dword %d, mprime_qpsk_symbol %d\n",
Ns,l,m,mprime_dword,mprime_qpsk_symb);
msg("index = %d (k %d)\n",(phy_vars_eNB->lte_gold_table[Ns][l][mprime_dword]>>(2*mprime_qpsk_symb))&3,k);
printf("index = %d (k %d)\n",(phy_vars_eNB->lte_gold_table[Ns][l][mprime_dword]>>(2*mprime_qpsk_symb))&3,k);
#endif
mprime++;
......
......@@ -34,12 +34,12 @@
*/
/**
\fn void PHY_ofdm_mod(int *input,int *output,unsigned char log2fftsize,unsigned char nb_symbols,unsigned short nb_prefix_samples,Extension_t etype)
\fn void PHY_ofdm_mod(int *input,int *output,int fftsize,unsigned char nb_symbols,unsigned short nb_prefix_samples,Extension_t etype)
This function performs OFDM modulation with cyclic extension or zero-padding.
@param input The sequence input samples in the frequency-domain. This is a concatenation of the input symbols in SIMD redundant format
@param output The time-domain output signal
@param log2fftsize Base-2 logarithm of the OFDM symbol size (\f$N_d\f$)
@param fftsize size of OFDM symbol size (\f$N_d\f$)
@param nb_symbols The number of OFDM symbols in the block
@param nb_prefix_samples The number of prefix/suffix/zero samples
@param etype Type of extension (CYCLIC_PREFIX,CYCLIC_SUFFIX,ZEROS)
......@@ -47,7 +47,7 @@ This function performs OFDM modulation with cyclic extension or zero-padding.
*/
void PHY_ofdm_mod(int *input,
int *output,
unsigned char log2fftsize,
int fftsize,
unsigned char nb_symbols,
unsigned short nb_prefix_samples,
Extension_t etype
......
......@@ -61,9 +61,9 @@ void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRA
txdata+(i*(frame_parms->samples_per_tti>>1)));
#endif
PHY_ofdm_mod(txdataF+(i*NUMBER_OF_OFDM_CARRIERS*frame_parms->symbols_per_tti>>1), // input
PHY_ofdm_mod(txdataF+(i*frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti>>1), // input
txdata+(i*frame_parms->samples_per_tti>>1), // output
frame_parms->log2_symbol_size, // log2_fft_size
frame_parms->ofdm_symbol_size,
1, // number of symbols
frame_parms->nb_prefix_samples0, // number of prefix samples
CYCLIC_PREFIX);
......@@ -71,9 +71,9 @@ void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRA
printf("slot i %d (txdata offset %d)\n",i,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES0+(i*frame_parms->samples_per_tti>>1));
#endif
PHY_ofdm_mod(txdataF+NUMBER_OF_OFDM_CARRIERS+(i*NUMBER_OF_OFDM_CARRIERS*(frame_parms->symbols_per_tti>>1)), // input
PHY_ofdm_mod(txdataF+frame_parms->ofdm_symbol_size+(i*frame_parms->ofdm_symbol_size*(frame_parms->symbols_per_tti>>1)), // input
txdata+OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES0+(i*(frame_parms->samples_per_tti>>1)), // output
frame_parms->log2_symbol_size, // log2_fft_size
frame_parms->ofdm_symbol_size,
(short_offset==1) ? 1 :(frame_parms->symbols_per_tti>>1)-1,//6, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples
CYCLIC_PREFIX);
......@@ -84,7 +84,7 @@ void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRA
void PHY_ofdm_mod(int *input, /// pointer to complex input
int *output, /// pointer to complex output
unsigned char log2fftsize, /// log2(FFT_SIZE)
int fftsize, /// FFT_SIZE
unsigned char nb_symbols, /// number of OFDM symbols
unsigned short nb_prefix_samples, /// cyclic prefix length
Extension_t etype /// type of extension
......@@ -100,24 +100,28 @@ void PHY_ofdm_mod(int *input, /// pointer to complex input
int *temp_ptr=(int*)0;
void (*idft)(int16_t *,int16_t *, int);
switch (log2fftsize) {
case 7:
switch (fftsize) {
case 128:
idft = idft128;
break;
case 8:
case 256:
idft = idft256;
break;
case 9:
case 512:
idft = idft512;
break;
case 10:
case 1024:
idft = idft1024;
break;
case 11:
case 1536:
idft = idft1536;
break;
case 2048:
idft = idft2048;
break;
......@@ -127,8 +131,8 @@ void PHY_ofdm_mod(int *input, /// pointer to complex input
}
#ifdef DEBUG_OFDM_MOD
msg("[PHY] OFDM mod (size %d,prefix %d) Symbols %d, input %p, output %p\n",
1<<log2fftsize,nb_prefix_samples,nb_symbols,input,output);
printf("[PHY] OFDM mod (size %d,prefix %d) Symbols %d, input %p, output %p\n",
fftsize,nb_prefix_samples,nb_symbols,input,output);
#endif
......@@ -136,35 +140,31 @@ void PHY_ofdm_mod(int *input, /// pointer to complex input
for (i=0; i<nb_symbols; i++) {
#ifdef DEBUG_OFDM_MOD
msg("[PHY] symbol %d/%d (%p,%p -> %p)\n",i,nb_symbols,input,&input[i<<log2fftsize],&output[(i<<log2fftsize) + ((i)*nb_prefix_samples)]);
printf("[PHY] symbol %d/%d offset %d (%p,%p -> %p)\n",i,nb_symbols,i*fftsize+(i*nb_prefix_samples),input,&input[i*fftsize],&output[(i*fftsize) + ((i)*nb_prefix_samples)]);
#endif
idft((int16_t *)&input[i<<log2fftsize],
(log2fftsize==7) ? (int16_t *)temp : (int16_t *)&output[(i<<log2fftsize) + ((1+i)*nb_prefix_samples)],
idft((int16_t *)&input[i*fftsize],
(fftsize==128) ? (int16_t *)temp : (int16_t *)&output[(i*fftsize) + ((1+i)*nb_prefix_samples)],
1);
// write_output("fft_out.m","fftout",temp,(1<<log2fftsize)*2,1,1);
//memset(temp,0,1<<log2fftsize);
// Copy to frame buffer with Cyclic Extension
// Note: will have to adjust for synchronization offset!
switch (etype) {
case CYCLIC_PREFIX:
output_ptr = &output[(i<<log2fftsize) + ((1+i)*nb_prefix_samples)];
output_ptr = &output[(i*fftsize) + ((1+i)*nb_prefix_samples)];
temp_ptr = (int *)temp;
// msg("Doing cyclic prefix method\n");
if (log2fftsize==7) {
for (j=0; j<((1<<log2fftsize)) ; j++) {
if (fftsize==128) {
for (j=0; j<fftsize ; j++) {
output_ptr[j] = temp_ptr[j];
}
}
j=(1<<log2fftsize);
j=fftsize;
for (k=-1; k>=-nb_prefix_samples; k--) {
output_ptr[k] = output_ptr[--j];
......@@ -175,19 +175,19 @@ void PHY_ofdm_mod(int *input, /// pointer to complex input
case CYCLIC_SUFFIX:
output_ptr = &output[(i<<log2fftsize)+ (i*nb_prefix_samples)];
output_ptr = &output[(i*fftsize)+ (i*nb_prefix_samples)];
temp_ptr = (int *)temp;
// msg("Doing cyclic suffix method\n");
for (j=0; j<(1<<log2fftsize) ; j++) {
for (j=0; j<fftsize ; j++) {
output_ptr[j] = temp_ptr[2*j];
}
for (j=0; j<nb_prefix_samples; j++)
output_ptr[(1<<log2fftsize)+j] = output_ptr[j];
output_ptr[fftsize+j] = output_ptr[j];
break;
......@@ -198,11 +198,11 @@ void PHY_ofdm_mod(int *input, /// pointer to complex input
case NONE:
// msg("NO EXTENSION!\n");
output_ptr = &output[(i<<log2fftsize)];
output_ptr = &output[fftsize];
temp_ptr = (int *)temp;
for (j=0; j<(1<<log2fftsize) ; j++) {
for (j=0; j<fftsize ; j++) {
output_ptr[j] = temp_ptr[2*j];
......@@ -219,14 +219,7 @@ void PHY_ofdm_mod(int *input, /// pointer to complex input
}
/*
printf("input %p, output %p, log2fftsize %d, nsymb %d\n",input,output,log2fftsize,nb_symbols);
for (i=0;i<16;i++)
printf("%d %d\n",((short *)input)[i<<1],((short *)input)[1+(i<<1)]);
printf("------\n");
for (i=0;i<16;i++)
printf("%d %d\n",((short *)output)[i<<1],((short *)output)[1+(i<<1)]);
*/
}
......@@ -244,7 +237,7 @@ void do_OFDM_mod(mod_sym_t **txdataF, int32_t **txdata, uint32_t frame,uint16_t
LOG_D(PHY,"Frame %d, subframe %d: Doing MBSFN modulation (slot_offset %d)\n",frame,next_slot>>1,slot_offset);
PHY_ofdm_mod(&txdataF[aa][slot_offset_F], // input
&txdata[aa][slot_offset], // output
frame_parms->log2_symbol_size, // log2_fft_size
frame_parms->ofdm_symbol_size,
12, // number of symbols
frame_parms->ofdm_symbol_size>>2, // number of prefix samples
CYCLIC_PREFIX);
......@@ -252,7 +245,7 @@ void do_OFDM_mod(mod_sym_t **txdataF, int32_t **txdata, uint32_t frame,uint16_t
if (frame_parms->Ncp == EXTENDED)
PHY_ofdm_mod(&txdataF[aa][slot_offset_F], // input
&txdata[aa][slot_offset], // output
frame_parms->log2_symbol_size, // log2_fft_size
frame_parms->ofdm_symbol_size,
2, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples
CYCLIC_PREFIX);
......@@ -268,7 +261,7 @@ void do_OFDM_mod(mod_sym_t **txdataF, int32_t **txdata, uint32_t frame,uint16_t
if (frame_parms->Ncp == EXTENDED)
PHY_ofdm_mod(&txdataF[aa][slot_offset_F], // input
&txdata[aa][slot_offset], // output
frame_parms->log2_symbol_size, // log2_fft_size
frame_parms->ofdm_symbol_size,
6, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples
CYCLIC_PREFIX);
......
......@@ -58,24 +58,28 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue,
void (*dft)(int16_t *,int16_t *, int);
int tmp_dft_in[256]; // This is for misalignment issues for 6 and 15 PRBs
switch (frame_parms->log2_symbol_size) {
case 7:
switch (frame_parms->ofdm_symbol_size) {
case 128:
dft = dft128;
break;
case 8:
case 256:
dft = dft256;
break;
case 9:
case 512:
dft = dft512;
break;
case 10:
case 1024:
dft = dft1024;
break;
case 11:
case 1536:
dft = dft1536;
break;
case 2048:
dft = dft2048;
break;
......@@ -96,12 +100,12 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue,
if (l<0 || l>=7-frame_parms->Ncp) {
msg("slot_fep: l must be between 0 and %d\n",7-frame_parms->Ncp);
printf("slot_fep: l must be between 0 and %d\n",7-frame_parms->Ncp);
return(-1);
}
if (Ns<0 || Ns>=20) {
msg("slot_fep: Ns must be between 0 and 19\n");
printf("slot_fep: Ns must be between 0 and 19\n");
return(-1);
}
......@@ -116,7 +120,7 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue,
#ifdef DEBUG_FEP
// if (phy_vars_ue->frame <100)
msg("slot_fep: frame %d: slot %d, symbol %d, nb_prefix_samples %d, nb_prefix_samples0 %d, slot_offset %d, subframe_offset %d, sample_offset %d,rx_offset %d\n", phy_vars_ue->frame_rx,Ns, symbol,
printf("slot_fep: frame %d: slot %d, symbol %d, nb_prefix_samples %d, nb_prefix_samples0 %d, slot_offset %d, subframe_offset %d, sample_offset %d,rx_offset %d\n", phy_vars_ue->frame_rx,Ns, symbol,
nb_prefix_samples,nb_prefix_samples0,slot_offset,subframe_offset,sample_offset,rx_offset);
#endif
......@@ -147,7 +151,7 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue,
#ifdef DEBUG_FEP
// if (phy_vars_ue->frame <100)
msg("slot_fep: frame %d: slot %d, symbol %d, nb_prefix_samples %d, nb_prefix_samples0 %d, slot_offset %d, subframe_offset %d, sample_offset %d,rx_offset %d\n", phy_vars_ue->frame_rx,Ns, symbol,
printf("slot_fep: frame %d: slot %d, symbol %d, nb_prefix_samples %d, nb_prefix_samples0 %d, slot_offset %d, subframe_offset %d, sample_offset %d,rx_offset %d\n", phy_vars_ue->frame_rx,Ns, symbol,
nb_prefix_samples,nb_prefix_samples0,slot_offset,subframe_offset,sample_offset,rx_offset);
#endif
......@@ -182,7 +186,7 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue,
for (aa=0; aa<frame_parms->nb_antennas_tx_eNB; aa++) {
#ifdef DEBUG_FEP
msg("Channel estimation eNB %d, aatx %d, slot %d, symbol %d\n",eNB_id,aa,Ns,l);
printf("Channel estimation eNB %d, aatx %d, slot %d, symbol %d\n",eNB_id,aa,Ns,l);
#endif
start_meas(&phy_vars_ue->dlsch_channel_estimation_stats);
lte_dl_channel_estimation(phy_vars_ue,eNB_id,0,
......@@ -205,7 +209,7 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue,
// do frequency offset estimation here!
// use channel estimates from current symbol (=ch_t) and last symbol (ch_{t-1})
#ifdef DEBUG_FEP
msg("Frequency offset estimation\n");
printf("Frequency offset estimation\n");
#endif
if (l==(4-frame_parms->Ncp)) {
......@@ -222,7 +226,7 @@ int slot_fep(PHY_VARS_UE *phy_vars_ue,
}
#ifdef DEBUG_FEP
msg("slot_fep: done\n");
printf("slot_fep: done\n");
#endif
return(0);
}
......@@ -54,25 +54,29 @@ int slot_fep_mbsfn(PHY_VARS_UE *phy_vars_ue,
unsigned int frame_length_samples = frame_parms->samples_per_tti * 10;
void (*dft)(int16_t *,int16_t *, int);
switch (frame_parms->log2_symbol_size) {
switch (frame_parms->ofdm_symbol_size) {
case 7:
case 128:
dft = dft128;
break;
case 8:
case 256:
dft = dft256;
break;
case 9:
case 512:
dft = dft512;
break;
case 10:
case 1024:
dft = dft1024;
break;
case 11:
case 1536:
dft = dft1536;
break;
case 2048:
dft = dft2048;
break;
......
......@@ -50,24 +50,28 @@ int slot_fep_ul(LTE_DL_FRAME_PARMS *frame_parms,
void (*dft)(int16_t *,int16_t *, int);
switch (frame_parms->log2_symbol_size) {
case 7:
switch (frame_parms->ofdm_symbol_size) {
case 128:
dft = dft128;
break;
case 8:
case 256:
dft = dft256;
break;
case 9:
case 512:
dft = dft512;
break;
case 10:
case 1024:
dft = dft1024;
break;
case 11:
case 1536:
dft = dft1536;
break;
case 2048:
dft = dft2048;
break;
......
......@@ -45,8 +45,10 @@
#define debug_msg
#define ONE_OVER_SQRT2_Q15 23170
#endif
#define ONE_OVER_SQRT3_Q15 18919
#include "PHY/sse_intrin.h"
......@@ -3180,6 +3182,8 @@ void idft1536(int16_t *input, int16_t *output)
int i,i2,j;
uint32_t tmp[3][512 ]__attribute__((aligned(16)));
uint32_t tmpo[3][512] __attribute__((aligned(16)));
simd_q15_t *y128p=(simd_q15_t*)output;
simd_q15_t ONE_OVER_SQRT3_Q15_128 = set1_int16(ONE_OVER_SQRT3_Q15);
for (i=0,j=0; i<512; i++) {
tmp[0][i] = ((uint32_t *)input)[j++];
......@@ -3190,17 +3194,6 @@ void idft1536(int16_t *input, int16_t *output)
idft512((int16_t*)(tmp[0]),(int16_t*)(tmpo[0]),1);
idft512((int16_t*)(tmp[1]),(int16_t*)(tmpo[1]),1);
idft512((int16_t*)(tmp[2]),(int16_t*)(tmpo[2]),1);
/*
for (i=1; i<512; i++) {
tmpo[0][i] = tmpo[0][i<<1];
tmpo[1][i] = tmpo[1][i<<1];
tmpo[2][i] = tmpo[2][i<<1];
}*/
// write_output("in.m","in",input,6144,1,1);
// write_output("out0.m","o0",tmpo[0],2048,1,1);
// write_output("out1.m","o1",tmpo[1],2048,1,1);
// write_output("out2.m","o2",tmpo[2],2048,1,1);
for (i=0,i2=0; i<1024; i+=8,i2+=4) {
ibfly3((simd_q15_t*)(&tmpo[0][i2]),(simd_q15_t*)(&tmpo[1][i2]),((simd_q15_t*)&tmpo[2][i2]),
......@@ -3209,6 +3202,26 @@ void idft1536(int16_t *input, int16_t *output)
}
for (i=0; i<24; i++) {
y128p[0] = mulhi_int16(y128p[0],ONE_OVER_SQRT3_Q15_128);
y128p[1] = mulhi_int16(y128p[1],ONE_OVER_SQRT3_Q15_128);
y128p[2] = mulhi_int16(y128p[2],ONE_OVER_SQRT3_Q15_128);
y128p[3] = mulhi_int16(y128p[3],ONE_OVER_SQRT3_Q15_128);
y128p[4] = mulhi_int16(y128p[4],ONE_OVER_SQRT3_Q15_128);
y128p[5] = mulhi_int16(y128p[5],ONE_OVER_SQRT3_Q15_128);
y128p[6] = mulhi_int16(y128p[6],ONE_OVER_SQRT3_Q15_128);
y128p[7] = mulhi_int16(y128p[7],ONE_OVER_SQRT3_Q15_128);
y128p[8] = mulhi_int16(y128p[8],ONE_OVER_SQRT3_Q15_128);
y128p[9] = mulhi_int16(y128p[9],ONE_OVER_SQRT3_Q15_128);
y128p[10] = mulhi_int16(y128p[10],ONE_OVER_SQRT3_Q15_128);
y128p[11] = mulhi_int16(y128p[11],ONE_OVER_SQRT3_Q15_128);
y128p[12] = mulhi_int16(y128p[12],ONE_OVER_SQRT3_Q15_128);
y128p[13] = mulhi_int16(y128p[13],ONE_OVER_SQRT3_Q15_128);
y128p[14] = mulhi_int16(y128p[14],ONE_OVER_SQRT3_Q15_128);
y128p[15] = mulhi_int16(y128p[15],ONE_OVER_SQRT3_Q15_128);
y128p+=16;
}
_mm_empty();
_m_empty();
......@@ -516,10 +516,10 @@ typedef struct {
uint8_t dual_tx;
/// flag to indicate SISO transmission
uint8_t mode1_flag;
/// Indicator that 20 MHz channel uses 3/4 sampling frequency
uint8_t threequarter_fs;
/// Size of FFT
uint16_t ofdm_symbol_size;
/// log2(Size of FFT)
uint8_t log2_symbol_size;
/// Number of prefix samples in all but first symbol of slot
uint16_t nb_prefix_samples;
/// Number of prefix samples in first symbol of slot
......
......@@ -117,7 +117,6 @@
*/
#define NUMBER_OF_OFDM_CARRIERS (frame_parms->ofdm_symbol_size)
#define NUMBER_OF_SYMBOLS_PER_FRAME (frame_parms->symbols_per_tti*LTE_NUMBER_OF_SUBFRAMES_PER_FRAME)
#define LOG2_NUMBER_OF_OFDM_CARRIERS (frame_parms->log2_symbol_size)
#define NUMBER_OF_USEFUL_CARRIERS (12*frame_parms->N_RB_DL)
#define NUMBER_OF_ZERO_CARRIERS (NUMBER_OF_OFDM_CARRIERS-NUMBER_OF_USEFUL_CARRIERS)
#define NUMBER_OF_USEFUL_CARRIERS_BYTES (NUMBER_OF_USEFUL_CARRIERS>>2)
......
......@@ -1262,7 +1262,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
#else
&phy_vars_ue->lte_ue_common_vars.txdata[aa][ulsch_start],
#endif
frame_parms->log2_symbol_size,
frame_parms->ofdm_symbol_size,
nsymb,
frame_parms->nb_prefix_samples,
CYCLIC_PREFIX);
......
......@@ -107,88 +107,6 @@ void handler(int sig)
exit(1);
}
void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmission_mode,uint8_t extended_prefix_flag,uint8_t fdd_flag, uint16_t Nid_cell,uint8_t tdd_config,uint8_t N_RB_DL,
uint8_t osf,uint32_t perfect_ce)
{
LTE_DL_FRAME_PARMS *lte_frame_parms;
int i;
printf("Start lte_param_init\n");
PHY_vars_eNB = malloc(sizeof(PHY_VARS_eNB));
PHY_vars_UE = malloc(sizeof(PHY_VARS_UE));
//PHY_config = malloc(sizeof(PHY_CONFIG));
mac_xface = malloc(sizeof(MAC_xface));
srand(0);
randominit(0);
set_taus_seed(0);
lte_frame_parms = &(PHY_vars_eNB->lte_frame_parms);
lte_frame_parms->N_RB_DL = N_RB_DL; //50 for 10MHz and 25 for 5 MHz
lte_frame_parms->N_RB_UL = N_RB_DL;
lte_frame_parms->Ncp = extended_prefix_flag;
lte_frame_parms->Nid_cell = Nid_cell;
lte_frame_parms->nushift = Nid_cell%6;
lte_frame_parms->nb_antennas_tx = N_tx;
lte_frame_parms->nb_antennas_rx = N_rx;
lte_frame_parms->nb_antennas_tx_eNB = N_tx;
lte_frame_parms->phich_config_common.phich_resource = one;
lte_frame_parms->tdd_config = tdd_config;
lte_frame_parms->frame_type = (fdd_flag==1)?0 : 1;
// lte_frame_parms->Csrs = 2;
// lte_frame_parms->Bsrs = 0;
// lte_frame_parms->kTC = 0;44
// lte_frame_parms->n_RRC = 0;
lte_frame_parms->mode1_flag = (transmission_mode == 1)? 1 : 0;
init_frame_parms(lte_frame_parms,osf);
//copy_lte_parms_to_phy_framing(lte_frame_parms, &(PHY_config->PHY_framing));
// phy_init_top(lte_frame_parms); //allocation
PHY_vars_UE->is_secondary_ue = 0;
PHY_vars_UE->lte_frame_parms = *lte_frame_parms;
PHY_vars_eNB->lte_frame_parms = *lte_frame_parms;
phy_init_lte_top(lte_frame_parms);
dump_frame_parms(lte_frame_parms);
PHY_vars_UE->PHY_measurements.n_adj_cells=0;
PHY_vars_UE->PHY_measurements.adj_cell_id[0] = Nid_cell+1;
PHY_vars_UE->PHY_measurements.adj_cell_id[1] = Nid_cell+2;
for (i=0; i<3; i++)
lte_gold(lte_frame_parms,PHY_vars_UE->lte_gold_table[i],Nid_cell+i);
phy_init_lte_ue(PHY_vars_UE,1,0);
phy_init_lte_eNB(PHY_vars_eNB,0,0,0);
generate_pcfich_reg_mapping(&PHY_vars_UE->lte_frame_parms);
generate_phich_reg_mapping(&PHY_vars_UE->lte_frame_parms);
// DL power control init
if (transmission_mode == 1) {
PHY_vars_eNB->pdsch_config_dedicated->p_a = dB0; // 4 = 0dB
((PHY_vars_eNB->lte_frame_parms).pdsch_config_common).p_b = 0;
PHY_vars_UE->pdsch_config_dedicated->p_a = dB0; // 4 = 0dB
((PHY_vars_UE->lte_frame_parms).pdsch_config_common).p_b = 0;
} else { // rho_a = rhob
PHY_vars_eNB->pdsch_config_dedicated->p_a = dB0; // 4 = 0dB
((PHY_vars_eNB->lte_frame_parms).pdsch_config_common).p_b = 1;
PHY_vars_UE->pdsch_config_dedicated->p_a = dB0; // 4 = 0dB
((PHY_vars_UE->lte_frame_parms).pdsch_config_common).p_b = 1;
}
PHY_vars_UE->perfect_ce = perfect_ce;
printf("Done lte_param_init\n");
}
//DCI2_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu2_2A[2];
......@@ -214,7 +132,7 @@ void do_OFDM_mod_l(mod_sym_t **txdataF, int32_t **txdata, uint16_t next_slot, LT
if (frame_parms->Ncp == 1)
PHY_ofdm_mod(&txdataF[aa][slot_offset_F], // input
&txdata[aa][slot_offset], // output
frame_parms->log2_symbol_size, // log2_fft_size
frame_parms->ofdm_symbol_size,
6, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples
CYCLIC_PREFIX);
......@@ -318,7 +236,7 @@ int main(int argc, char **argv)
double blerr[4],uncoded_ber,avg_ber;
short *uncoded_ber_bit=NULL;
uint8_t N_RB_DL=25,osf=1;
uint8_t fdd_flag = 0;
frame_t frame_type = FDD;
#ifdef XFORMS
FD_lte_phy_scope_ue *form_ue;
char title[255];
......@@ -350,6 +268,8 @@ int main(int argc, char **argv)
FILE *proc_fd = NULL;
char buf[64];
int threequarter_fs=0;
opp_enabled=1; // to enable the time meas
#if defined(__arm__)
......@@ -378,13 +298,17 @@ int main(int argc, char **argv)
num_layers = 1;
perfect_ce = 0;
while ((c = getopt (argc, argv, "ahdpZDe:m:n:o:s:f:t:c:g:r:F:x:y:z:AM:N:I:i:O:R:S:C:T:b:u:v:w:B:PLl:Y")) != -1) {
while ((c = getopt (argc, argv, "ahdpZDe:Em:n:o:s:f:t:c:g:r:F:x:y:z:AM:N:I:i:O:R:S:C:T:b:u:v:w:B:PLl:Y")) != -1) {
switch (c) {
case 'a':
awgn_flag = 1;
channel_model = AWGN;
break;
case 'A':
abstx = 1;
break;
case 'b':
tdd_config=atoi(optarg);
break;
......@@ -393,10 +317,59 @@ int main(int argc, char **argv)
N_RB_DL=atoi(optarg);
break;
case 'c':
num_pdcch_symbols=atoi(optarg);
break;
case 'C':
Nid_cell = atoi(optarg);
break;
case 'd':
dci_flag = 1;
break;
case 'D':
frame_type=TDD;
break;
case 'e':
num_rounds=1;
common_flag = 1;
TPC = atoi(optarg);
break;
case 'E':
threequarter_fs=1;
break;
case 'f':
input_snr_step= atof(optarg);
break;
case 'F':
forgetting_factor = atof(optarg);
break;
case 'i':
input_fd = fopen(optarg,"r");
input_file=1;
dci_flag = 1;
break;
case 'I':
input_trch_fd = fopen(optarg,"r");
input_trch_file=1;
break;
case 'L':
llr8_flag=1;
break;
case 'l':
offset_mumimo_llr_drange_fix=atoi(optarg);
break;
case 'm':
mcs1 = atoi(optarg);
break;
......@@ -405,6 +378,11 @@ int main(int argc, char **argv)
mcs2 = atoi(optarg);
break;
case 'O':
test_perf=atoi(optarg);
//print_perf =1;
break;
case 't':
mcs_i = atoi(optarg);
i_mod = get_Qm(mcs_i);
......@@ -414,27 +392,16 @@ int main(int argc, char **argv)
n_frames = atoi(optarg);
break;
case 'C':
Nid_cell = atoi(optarg);
break;
case 'o':
rx_sample_offset = atoi(optarg);
break;
case 'D':
fdd_flag = 1;
break;
case 'r':
DLSCH_RB_ALLOC = atoi(optarg);
rballocset = 1;
break;
case 'F':
forgetting_factor = atof(optarg);
break;
case 's':
snr0 = atof(optarg);
break;
......@@ -443,13 +410,6 @@ int main(int argc, char **argv)
snr_int = atof(optarg);
break;
case 'f':
input_snr_step= atof(optarg);
break;
case 'A':
abstx = 1;
break;
case 'N':
n_ch_rlz= atof(optarg);
......@@ -459,10 +419,6 @@ int main(int argc, char **argv)
extended_prefix_flag=1;
break;
case 'c':
num_pdcch_symbols=atoi(optarg);
break;
case 'g':
memcpy(channel_model_input,optarg,10);
......@@ -530,62 +486,6 @@ int main(int argc, char **argv)
break;
case 'x':
transmission_mode=atoi(optarg);
if ((transmission_mode!=1) &&
(transmission_mode!=2) &&
(transmission_mode!=3) &&
(transmission_mode!=4) &&
(transmission_mode!=5) &&
(transmission_mode!=6)) {
msg("Unsupported transmission mode %d\n",transmission_mode);
exit(-1);
}
if (transmission_mode>1) {
n_tx = 2;
}
break;
case 'y':
n_tx=atoi(optarg);
if ((n_tx==0) || (n_tx>2)) {
msg("Unsupported number of tx antennas %d\n",n_tx);
exit(-1);
}
break;
case 'z':
n_rx=atoi(optarg);
if ((n_rx==0) || (n_rx>2)) {
msg("Unsupported number of rx antennas %d\n",n_rx);
exit(-1);
}
break;
case 'I':
input_trch_fd = fopen(optarg,"r");
input_trch_file=1;
break;
case 'i':
input_fd = fopen(optarg,"r");
input_file=1;
dci_flag = 1;
break;
case 'e':
num_rounds=1;
common_flag = 1;
TPC = atoi(optarg);
break;
case 'R':
num_rounds=atoi(optarg);
break;
......@@ -623,26 +523,54 @@ int main(int argc, char **argv)
print_perf=1;
break;
case 'L':
llr8_flag=1;
case 'x':
transmission_mode=atoi(optarg);
if ((transmission_mode!=1) &&
(transmission_mode!=2) &&
(transmission_mode!=3) &&
(transmission_mode!=4) &&
(transmission_mode!=5) &&
(transmission_mode!=6)) {
msg("Unsupported transmission mode %d\n",transmission_mode);
exit(-1);
}
if (transmission_mode>1) {
n_tx = 2;
}
break;
case 'l':
offset_mumimo_llr_drange_fix=atoi(optarg);
case 'y':
n_tx=atoi(optarg);
if ((n_tx==0) || (n_tx>2)) {
msg("Unsupported number of tx antennas %d\n",n_tx);
exit(-1);
}
break;
case 'O':
test_perf=atoi(optarg);
//print_perf =1;
case 'Y':
perfect_ce=1;
break;
case 'z':
n_rx=atoi(optarg);
if ((n_rx==0) || (n_rx>2)) {
msg("Unsupported number of rx antennas %d\n",n_rx);
exit(-1);
}
break;
case 'Z':
dump_table=1;
break;
case 'Y':
perfect_ce=1;
break;
case 'h':
default:
......@@ -723,8 +651,10 @@ int main(int argc, char **argv)
printf("dual_stream_UE=%d\n", dual_stream_UE);
}
lte_param_init(n_tx,n_rx,transmission_mode,extended_prefix_flag,fdd_flag,Nid_cell,tdd_config,N_RB_DL,osf,perfect_ce);
lte_param_init(n_tx,n_rx,transmission_mode,extended_prefix_flag,frame_type,Nid_cell,tdd_config,N_RB_DL,threequarter_fs,osf,perfect_ce);
eNB_id_i = PHY_vars_UE->n_connected_eNB;
printf("Setting mcs1 = %d\n",mcs1);
......@@ -2553,7 +2483,7 @@ PMI_FEEDBACK:
}
}
}
/*
num_pdcch_symbols_2 = generate_dci_top(num_ue_spec_dci,
num_common_dci,
dci_alloc,
......@@ -2562,7 +2492,7 @@ PMI_FEEDBACK:
&PHY_vars_eNB->lte_frame_parms,
PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id],
subframe);
*/
if (num_pdcch_symbols_2 > num_pdcch_symbols) {
msg("Error: given num_pdcch_symbols not big enough (%d > %d)\n",num_pdcch_symbols_2,num_pdcch_symbols);
exit(-1);
......@@ -2667,6 +2597,7 @@ PMI_FEEDBACK:
}
start_meas(&PHY_vars_eNB->dlsch_modulation_stats);
re_allocated = dlsch_modulation(PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNB_id],
AMP,
subframe,
......@@ -2674,6 +2605,7 @@ PMI_FEEDBACK:
num_pdcch_symbols,
PHY_vars_eNB->dlsch_eNB[k][0],
PHY_vars_eNB->dlsch_eNB[k][1]);
stop_meas(&PHY_vars_eNB->dlsch_modulation_stats);
/*
if (trials==0 && round==0)
......
......@@ -457,7 +457,7 @@ int main(int argc, char **argv)
PHY_ofdm_mod(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0][0], // input,
txdata[0], // output
frame_parms->log2_symbol_size, // log2_fft_size
frame_parms->ofdm_symbol_size,
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*nsymb, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples
CYCLIC_PREFIX);
......
......@@ -53,87 +53,11 @@
#include "OCG_vars.h"
PHY_VARS_eNB *PHY_vars_eNb,*PHY_vars_eNb1,*PHY_vars_eNb2;
PHY_VARS_eNB *PHY_vars_eNB,*PHY_vars_eNB1,*PHY_vars_eNB2;
PHY_VARS_UE *PHY_vars_UE;
#define DLSCH_RB_ALLOC 0x1fbf // igore DC component,RB13
void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmission_mode,unsigned char extended_prefix_flag,unsigned char frame_type, uint16_t Nid_cell,uint8_t N_RB_DL,uint8_t osf)
{
// unsigned int ind;
LTE_DL_FRAME_PARMS *lte_frame_parms;
int i;
printf("Start lte_param_init\n");
PHY_vars_eNb = malloc(sizeof(PHY_VARS_eNB));
PHY_vars_eNb1 = malloc(sizeof(PHY_VARS_eNB));
PHY_vars_eNb2 = malloc(sizeof(PHY_VARS_eNB));
PHY_vars_UE = malloc(sizeof(PHY_VARS_UE));
//PHY_config = malloc(sizeof(PHY_CONFIG));
mac_xface = malloc(sizeof(MAC_xface));
randominit(0);
set_taus_seed(0);
lte_frame_parms = &(PHY_vars_eNb->lte_frame_parms);
lte_frame_parms->N_RB_DL = N_RB_DL; //50 for 10MHz and 25 for 5 MHz
lte_frame_parms->N_RB_UL = N_RB_DL;
lte_frame_parms->Ncp = extended_prefix_flag;
lte_frame_parms->Nid_cell = Nid_cell;
lte_frame_parms->nushift = Nid_cell%6;
lte_frame_parms->nb_antennas_tx = N_tx;
lte_frame_parms->nb_antennas_tx_eNB = N_tx;
lte_frame_parms->nb_antennas_rx = N_rx;
// lte_frame_parms->Csrs = 2;
// lte_frame_parms->Bsrs = 0;
// lte_frame_parms->kTC = 0;
// lte_frame_parms->n_RRC = 0;
lte_frame_parms->mode1_flag = (transmission_mode == 1)? 1 : 0;
lte_frame_parms->tdd_config = 3;
lte_frame_parms->frame_type = frame_type;
init_frame_parms(lte_frame_parms,osf);
//copy_lte_parms_to_phy_framing(lte_frame_parms, &(PHY_config->PHY_framing));
PHY_vars_UE->lte_frame_parms = *lte_frame_parms;
phy_init_lte_top(lte_frame_parms);
PHY_vars_UE->PHY_measurements.n_adj_cells=2;
PHY_vars_UE->PHY_measurements.adj_cell_id[0] = Nid_cell+1;
PHY_vars_UE->PHY_measurements.adj_cell_id[1] = Nid_cell+2;
for (i=0; i<3; i++)
lte_gold(lte_frame_parms,PHY_vars_UE->lte_gold_table[i],Nid_cell+i);
phy_init_lte_ue(PHY_vars_UE,1,0);
phy_init_lte_eNB(PHY_vars_eNb,0,0,0);
memcpy((void*)&PHY_vars_eNb1->lte_frame_parms,(void*)&PHY_vars_eNb->lte_frame_parms,sizeof(LTE_DL_FRAME_PARMS));
PHY_vars_eNb1->lte_frame_parms.Nid_cell=Nid_cell+1;
PHY_vars_eNb1->lte_frame_parms.nushift=(Nid_cell+1)%6;
PHY_vars_eNb1->Mod_id=1;
memcpy((void*)&PHY_vars_eNb2->lte_frame_parms,(void*)&PHY_vars_eNb->lte_frame_parms,sizeof(LTE_DL_FRAME_PARMS));
PHY_vars_eNb2->lte_frame_parms.Nid_cell=Nid_cell+2;
PHY_vars_eNb2->lte_frame_parms.nushift=(Nid_cell+2)%6;
PHY_vars_eNb2->Mod_id=2;
phy_init_lte_eNB(PHY_vars_eNb1,0,0,0);
phy_init_lte_eNB(PHY_vars_eNb2,0,0,0);
phy_init_lte_top(lte_frame_parms);
printf("Done lte_param_init\n");
}
mod_sym_t *dummybuf[4];
mod_sym_t dummy0[2048*14];
mod_sym_t dummy1[2048*14];
......@@ -420,6 +344,28 @@ int main(int argc, char **argv)
lte_param_init(n_tx,n_rx,transmission_mode,extended_prefix_flag,frame_type,Nid_cell,N_RB_DL,osf);
PHY_vars_eNB1 = malloc(sizeof(PHY_VARS_eNB));
PHY_vars_eNB2 = malloc(sizeof(PHY_VARS_eNB));
PHY_vars_UE->PHY_measurements.n_adj_cells=2;
PHY_vars_UE->PHY_measurements.adj_cell_id[0] = Nid_cell+1;
PHY_vars_UE->PHY_measurements.adj_cell_id[1] = Nid_cell+2;
for (i=0; i<3; i++)
lte_gold(&PHY_vars_eNB->lte_frame_parms,PHY_vars_UE->lte_gold_table[i],Nid_cell+i);
memcpy((void*)&PHY_vars_eNB1->lte_frame_parms,(void*)&PHY_vars_eNB->lte_frame_parms,sizeof(LTE_DL_FRAME_PARMS));
PHY_vars_eNB1->lte_frame_parms.Nid_cell=Nid_cell+1;
PHY_vars_eNB1->lte_frame_parms.nushift=(Nid_cell+1)%6;
PHY_vars_eNB1->Mod_id=1;
memcpy((void*)&PHY_vars_eNB2->lte_frame_parms,(void*)&PHY_vars_eNB->lte_frame_parms,sizeof(LTE_DL_FRAME_PARMS));
PHY_vars_eNB2->lte_frame_parms.Nid_cell=Nid_cell+2;
PHY_vars_eNB2->lte_frame_parms.nushift=(Nid_cell+2)%6;
PHY_vars_eNB2->Mod_id=2;
phy_init_lte_eNB(PHY_vars_eNB1,0,0,0);
phy_init_lte_eNB(PHY_vars_eNB2,0,0,0);
#ifdef XFORMS
fl_initialize (&argc, argv, NULL, 0, 0);
form_ue = create_lte_phy_scope_ue();
......@@ -436,13 +382,13 @@ int main(int argc, char **argv)
printf("SNR0 %f, SNR1 %f\n",snr0,snr1);
frame_parms = &PHY_vars_eNb->lte_frame_parms;
frame_parms = &PHY_vars_eNB->lte_frame_parms;
txdata = PHY_vars_eNb->lte_eNB_common_vars.txdata[0];
txdata1 = PHY_vars_eNb1->lte_eNB_common_vars.txdata[0];
txdata2 = PHY_vars_eNb2->lte_eNB_common_vars.txdata[0];
txdata = PHY_vars_eNB->lte_eNB_common_vars.txdata[0];
txdata1 = PHY_vars_eNB1->lte_eNB_common_vars.txdata[0];
txdata2 = PHY_vars_eNB2->lte_eNB_common_vars.txdata[0];
s_re = malloc(2*sizeof(double*));
......@@ -463,8 +409,8 @@ int main(int argc, char **argv)
printf("FFT Size %d, Extended Prefix %d, Samples per subframe %d, Symbols per subframe %d, interf (%d,%d)\n",NUMBER_OF_OFDM_CARRIERS,
frame_parms->Ncp,frame_parms->samples_per_tti,nsymb,interf1,interf2);
printf("PHY_vars_eNb1->lte_eNB_common_vars.txdataF[0][0] = %p\n",
PHY_vars_eNb1->lte_eNB_common_vars.txdataF[0][0]);
printf("PHY_vars_eNB1->lte_eNB_common_vars.txdataF[0][0] = %p\n",
PHY_vars_eNB1->lte_eNB_common_vars.txdataF[0][0]);
DLSCH_alloc_pdu2.rah = 0;
......@@ -479,31 +425,31 @@ int main(int argc, char **argv)
// Forget second codeword
DLSCH_alloc_pdu2.tpmi = (transmission_mode==6 ? 5 : 0) ; // precoding
eNB2UE = new_channel_desc_scm(PHY_vars_eNb->lte_frame_parms.nb_antennas_tx,
eNB2UE = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antennas_tx,
PHY_vars_UE->lte_frame_parms.nb_antennas_rx,
channel_model,
N_RB2sampling_rate(PHY_vars_eNb->lte_frame_parms.N_RB_DL),
N_RB2channel_bandwidth(PHY_vars_eNb->lte_frame_parms.N_RB_DL),
N_RB2sampling_rate(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
N_RB2channel_bandwidth(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
0,
0,
0);
if (interf1>-20)
eNB2UE1 = new_channel_desc_scm(PHY_vars_eNb->lte_frame_parms.nb_antennas_tx,
eNB2UE1 = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antennas_tx,
PHY_vars_UE->lte_frame_parms.nb_antennas_rx,
channel_model,
N_RB2sampling_rate(PHY_vars_eNb->lte_frame_parms.N_RB_DL),
N_RB2channel_bandwidth(PHY_vars_eNb->lte_frame_parms.N_RB_DL),
N_RB2sampling_rate(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
N_RB2channel_bandwidth(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
0,
4,
0);
if (interf2>-20)
eNB2UE2 = new_channel_desc_scm(PHY_vars_eNb->lte_frame_parms.nb_antennas_tx,
eNB2UE2 = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antennas_tx,
PHY_vars_UE->lte_frame_parms.nb_antennas_rx,
channel_model,
N_RB2sampling_rate(PHY_vars_eNb->lte_frame_parms.N_RB_DL),
N_RB2channel_bandwidth(PHY_vars_eNb->lte_frame_parms.N_RB_DL),
N_RB2sampling_rate(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
N_RB2channel_bandwidth(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
0,
8,
0);
......@@ -567,47 +513,47 @@ int main(int argc, char **argv)
pbch_pdu[1]=1;
pbch_pdu[2]=0;
if (PHY_vars_eNb->lte_frame_parms.frame_type == 0) {
generate_pss(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
if (PHY_vars_eNB->lte_frame_parms.frame_type == 0) {
generate_pss(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
AMP,
&PHY_vars_eNb->lte_frame_parms,
(PHY_vars_eNb->lte_frame_parms.Ncp==0) ? 6 : 5,
&PHY_vars_eNB->lte_frame_parms,
(PHY_vars_eNB->lte_frame_parms.Ncp==0) ? 6 : 5,
0);
generate_sss(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
generate_sss(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
AMP,
&PHY_vars_eNb->lte_frame_parms,
(PHY_vars_eNb->lte_frame_parms.Ncp==0) ? 5 : 4,
&PHY_vars_eNB->lte_frame_parms,
(PHY_vars_eNB->lte_frame_parms.Ncp==0) ? 5 : 4,
0);
generate_pss(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
generate_pss(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
AMP,
&PHY_vars_eNb->lte_frame_parms,
(PHY_vars_eNb->lte_frame_parms.Ncp==0) ? 6 : 5,
&PHY_vars_eNB->lte_frame_parms,
(PHY_vars_eNB->lte_frame_parms.Ncp==0) ? 6 : 5,
10);
generate_sss(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
generate_sss(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
AMP,
&PHY_vars_eNb->lte_frame_parms,
(PHY_vars_eNb->lte_frame_parms.Ncp==0) ? 5 : 4,
&PHY_vars_eNB->lte_frame_parms,
(PHY_vars_eNB->lte_frame_parms.Ncp==0) ? 5 : 4,
10);
} else {
generate_sss(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
generate_sss(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
AMP,
&PHY_vars_eNb->lte_frame_parms,
(PHY_vars_eNb->lte_frame_parms.Ncp==0) ? 6 : 5,
&PHY_vars_eNB->lte_frame_parms,
(PHY_vars_eNB->lte_frame_parms.Ncp==0) ? 6 : 5,
1);
generate_pss(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
generate_pss(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
AMP,
&PHY_vars_eNb->lte_frame_parms,
&PHY_vars_eNB->lte_frame_parms,
2,
2);
generate_sss(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
generate_sss(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
AMP,
&PHY_vars_eNb->lte_frame_parms,
(PHY_vars_eNb->lte_frame_parms.Ncp==0) ? 6 : 5,
&PHY_vars_eNB->lte_frame_parms,
(PHY_vars_eNB->lte_frame_parms.Ncp==0) ? 6 : 5,
11);
generate_pss(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
generate_pss(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
AMP,
&PHY_vars_eNb->lte_frame_parms,
&PHY_vars_eNB->lte_frame_parms,
2,
12);
......@@ -626,11 +572,11 @@ int main(int argc, char **argv)
dci_alloc[1].rnti = 0x1234;
*/
printf("Generating PBCH for mode1_flag = %d\n", PHY_vars_eNb->lte_frame_parms.mode1_flag);
printf("Generating PBCH for mode1_flag = %d\n", PHY_vars_eNB->lte_frame_parms.mode1_flag);
generate_pilots(PHY_vars_eNb,
PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
generate_pilots(PHY_vars_eNB,
PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
AMP,
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
......@@ -641,8 +587,8 @@ int main(int argc, char **argv)
dci_alloc,
0,
1024,
&PHY_vars_eNb->lte_frame_parms,
PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
&PHY_vars_eNB->lte_frame_parms,
PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
0);
*/
......@@ -657,47 +603,47 @@ int main(int argc, char **argv)
dummybuf[1] = dummy1;
dummybuf[2] = dummy2;
dummybuf[3] = dummy3;
generate_pbch(&PHY_vars_eNb->lte_eNB_pbch,
generate_pbch(&PHY_vars_eNB->lte_eNB_pbch,
(mod_sym_t**)dummybuf,
AMP,
&PHY_vars_eNb->lte_frame_parms,
&PHY_vars_eNB->lte_frame_parms,
pbch_pdu,
0);
}
generate_pbch(&PHY_vars_eNb->lte_eNB_pbch,
PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
generate_pbch(&PHY_vars_eNB->lte_eNB_pbch,
PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
AMP,
&PHY_vars_eNb->lte_frame_parms,
&PHY_vars_eNB->lte_frame_parms,
pbch_pdu,
pbch_phase);
/*
generate_pbch(&PHY_vars_eNb->lte_eNB_pbch,
PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
generate_pbch(&PHY_vars_eNB->lte_eNB_pbch,
PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
AMP,
&PHY_vars_eNb->lte_frame_parms,
&PHY_vars_eNB->lte_frame_parms,
pbch_pdu,
1);
*/
if (interf1>-20) {
/*
generate_pss(PHY_vars_eNb1->lte_eNB_common_vars.txdataF[0],
generate_pss(PHY_vars_eNB1->lte_eNB_common_vars.txdataF[0],
AMP,
&PHY_vars_eNb1->lte_frame_parms,
(PHY_vars_eNb1->lte_frame_parms.Ncp==0)?6:5,
&PHY_vars_eNB1->lte_frame_parms,
(PHY_vars_eNB1->lte_frame_parms.Ncp==0)?6:5,
0);
*/
generate_pilots(PHY_vars_eNb1,
PHY_vars_eNb1->lte_eNB_common_vars.txdataF[0],
generate_pilots(PHY_vars_eNB1,
PHY_vars_eNB1->lte_eNB_common_vars.txdataF[0],
AMP,
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
generate_pbch(&PHY_vars_eNb1->lte_eNB_pbch,
PHY_vars_eNb1->lte_eNB_common_vars.txdataF[0],
generate_pbch(&PHY_vars_eNB1->lte_eNB_pbch,
PHY_vars_eNB1->lte_eNB_common_vars.txdataF[0],
AMP,
&PHY_vars_eNb1->lte_frame_parms,
&PHY_vars_eNB1->lte_frame_parms,
pbch_pdu,
0);
......@@ -705,26 +651,26 @@ int main(int argc, char **argv)
if (interf2>-20) {
/*
generate_pss(PHY_vars_eNb2->lte_eNB_common_vars.txdataF[0],
generate_pss(PHY_vars_eNB2->lte_eNB_common_vars.txdataF[0],
AMP,
&PHY_vars_eNb2->lte_frame_parms,
(PHY_vars_eNb2->lte_frame_parms.Ncp==0)?6:5,
&PHY_vars_eNB2->lte_frame_parms,
(PHY_vars_eNB2->lte_frame_parms.Ncp==0)?6:5,
0);
*/
generate_pilots(PHY_vars_eNb2,
PHY_vars_eNb2->lte_eNB_common_vars.txdataF[0],
generate_pilots(PHY_vars_eNB2,
PHY_vars_eNB2->lte_eNB_common_vars.txdataF[0],
AMP,
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
generate_pbch(&PHY_vars_eNb2->lte_eNB_pbch,
PHY_vars_eNb2->lte_eNB_common_vars.txdataF[0],
generate_pbch(&PHY_vars_eNB2->lte_eNB_pbch,
PHY_vars_eNB2->lte_eNB_common_vars.txdataF[0],
AMP,
&PHY_vars_eNb2->lte_frame_parms,
&PHY_vars_eNB2->lte_frame_parms,
pbch_pdu,
0);
......@@ -733,10 +679,10 @@ int main(int argc, char **argv)
// write_output("pilotsF.m","rsF",txdataF[0],lte_frame_parms->ofdm_symbol_size,1,1);
write_output("txsigF0.m","txsF0", PHY_vars_eNb->lte_eNB_common_vars.txdataF[0][0],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX,1,1);
write_output("txsigF0.m","txsF0", PHY_vars_eNB->lte_eNB_common_vars.txdataF[0][0],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX,1,1);
if (PHY_vars_eNb->lte_frame_parms.nb_antennas_tx>1)
write_output("txsigF1.m","txsF1", PHY_vars_eNb->lte_eNB_common_vars.txdataF[0][1],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX,1,1);
if (PHY_vars_eNB->lte_frame_parms.nb_antennas_tx>1)
write_output("txsigF1.m","txsF1", PHY_vars_eNB->lte_eNB_common_vars.txdataF[0][1],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX,1,1);
tx_lev = 0;
tx_lev1 = 0;
......@@ -745,16 +691,16 @@ int main(int argc, char **argv)
for (aa=0; aa<PHY_vars_eNb->lte_frame_parms.nb_antennas_tx; aa++) {
for (aa=0; aa<PHY_vars_eNB->lte_frame_parms.nb_antennas_tx; aa++) {
if (frame_parms->Ncp == 1)
PHY_ofdm_mod(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0][aa], // input,
PHY_ofdm_mod(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0][aa], // input,
txdata[aa], // output
frame_parms->log2_symbol_size, // log2_fft_size
frame_parms->ofdm_symbol_size,
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*nsymb, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples
CYCLIC_PREFIX);
else {
normal_prefix_mod(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0][aa],
normal_prefix_mod(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0][aa],
txdata[aa],
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*nsymb,
frame_parms);
......@@ -765,17 +711,17 @@ int main(int argc, char **argv)
}
if (interf1>-20) {
for (aa=0; aa<PHY_vars_eNb1->lte_frame_parms.nb_antennas_tx; aa++) {
for (aa=0; aa<PHY_vars_eNB1->lte_frame_parms.nb_antennas_tx; aa++) {
if (frame_parms->Ncp == 1)
PHY_ofdm_mod(PHY_vars_eNb1->lte_eNB_common_vars.txdataF[0][aa], // input,
PHY_vars_eNb1->lte_eNB_common_vars.txdata[0][aa], // output
frame_parms->log2_symbol_size, // log2_fft_size
PHY_ofdm_mod(PHY_vars_eNB1->lte_eNB_common_vars.txdataF[0][aa], // input,
PHY_vars_eNB1->lte_eNB_common_vars.txdata[0][aa], // output
frame_parms->ofdm_symbol_size,
2*nsymb, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples
CYCLIC_PREFIX);
else {
normal_prefix_mod(PHY_vars_eNb1->lte_eNB_common_vars.txdataF[0][aa],
PHY_vars_eNb1->lte_eNB_common_vars.txdata[0][aa],
normal_prefix_mod(PHY_vars_eNB1->lte_eNB_common_vars.txdataF[0][aa],
PHY_vars_eNB1->lte_eNB_common_vars.txdata[0][aa],
2*nsymb,
frame_parms);
}
......@@ -784,24 +730,24 @@ int main(int argc, char **argv)
OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES);
}
write_output("txsigF0_1.m","txsF0_1", PHY_vars_eNb1->lte_eNB_common_vars.txdataF[0][0],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX,1,1);
write_output("txsigF0_1.m","txsF0_1", PHY_vars_eNB1->lte_eNB_common_vars.txdataF[0][0],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX,1,1);
if (PHY_vars_eNb1->lte_frame_parms.nb_antennas_tx>1)
write_output("txsigF1_1.m","txsF1_1", PHY_vars_eNb1->lte_eNB_common_vars.txdataF[0][1],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX,1,1);
if (PHY_vars_eNB1->lte_frame_parms.nb_antennas_tx>1)
write_output("txsigF1_1.m","txsF1_1", PHY_vars_eNB1->lte_eNB_common_vars.txdataF[0][1],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX,1,1);
}
if (interf2>-20) {
for (aa=0; aa<PHY_vars_eNb2->lte_frame_parms.nb_antennas_tx; aa++) {
for (aa=0; aa<PHY_vars_eNB2->lte_frame_parms.nb_antennas_tx; aa++) {
if (frame_parms->Ncp == 1)
PHY_ofdm_mod(PHY_vars_eNb2->lte_eNB_common_vars.txdataF[0][aa], // input,
PHY_vars_eNb2->lte_eNB_common_vars.txdata[0][aa], // output
frame_parms->log2_symbol_size, // log2_fft_size
PHY_ofdm_mod(PHY_vars_eNB2->lte_eNB_common_vars.txdataF[0][aa], // input,
PHY_vars_eNB2->lte_eNB_common_vars.txdata[0][aa], // output
frame_parms->ofdm_symbol_size,
2*nsymb, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples
CYCLIC_PREFIX);
else {
normal_prefix_mod(PHY_vars_eNb2->lte_eNB_common_vars.txdataF[0][aa],
PHY_vars_eNb2->lte_eNB_common_vars.txdata[0][aa],
normal_prefix_mod(PHY_vars_eNB2->lte_eNB_common_vars.txdataF[0][aa],
PHY_vars_eNB2->lte_eNB_common_vars.txdata[0][aa],
2*nsymb,
frame_parms);
}
......@@ -810,10 +756,10 @@ int main(int argc, char **argv)
OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES);
}
write_output("txsigF0_2.m","txsF0_2", PHY_vars_eNb2->lte_eNB_common_vars.txdataF[0][0],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX,1,1);
write_output("txsigF0_2.m","txsF0_2", PHY_vars_eNB2->lte_eNB_common_vars.txdataF[0][0],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX,1,1);
if (PHY_vars_eNb2->lte_frame_parms.nb_antennas_tx>1)
write_output("txsigF1_2.m","txsF1_2", PHY_vars_eNb2->lte_eNB_common_vars.txdataF[0][1],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX,1,1);
if (PHY_vars_eNB2->lte_frame_parms.nb_antennas_tx>1)
write_output("txsigF1_2.m","txsF1_2", PHY_vars_eNB2->lte_eNB_common_vars.txdataF[0][1],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX,1,1);
}
// tx_lev_dB = (unsigned int) dB_fixed(tx_lev);
......@@ -823,15 +769,15 @@ int main(int argc, char **argv)
if (frame_parms->nb_antennas_tx>1)
write_output("txsig1.m","txs1", txdata[1],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
write_output("txsig0_1.m","txs0_1", PHY_vars_eNb1->lte_eNB_common_vars.txdata[0][0],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
write_output("txsig0_1.m","txs0_1", PHY_vars_eNB1->lte_eNB_common_vars.txdata[0][0],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
if (frame_parms->nb_antennas_tx>1)
write_output("txsig1_1.m","txs1_1", PHY_vars_eNb1->lte_eNB_common_vars.txdata[0][1],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
write_output("txsig1_1.m","txs1_1", PHY_vars_eNB1->lte_eNB_common_vars.txdata[0][1],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
write_output("txsig0_2.m","txs0_2", PHY_vars_eNb2->lte_eNB_common_vars.txdata[0][0],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
write_output("txsig0_2.m","txs0_2", PHY_vars_eNB2->lte_eNB_common_vars.txdata[0][0],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
if (frame_parms->nb_antennas_tx>1)
write_output("txsig1_2.m","txs1_2", PHY_vars_eNb2->lte_eNB_common_vars.txdata[0][1],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
write_output("txsig1_2.m","txs1_2", PHY_vars_eNB2->lte_eNB_common_vars.txdata[0][1],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
} else { //read in from file
i=0;
......@@ -864,7 +810,7 @@ int main(int argc, char **argv)
// multipath channel
for (i=0; i<2*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; i++) {
for (aa=0; aa<PHY_vars_eNb->lte_frame_parms.nb_antennas_tx; aa++) {
for (aa=0; aa<PHY_vars_eNB->lte_frame_parms.nb_antennas_tx; aa++) {
s_re[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)]);
s_im[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)+1]);
......@@ -925,7 +871,7 @@ int main(int argc, char **argv)
}
}
sigma2_dB = 10*log10((double)tx_lev) +10*log10((double)PHY_vars_eNb->lte_frame_parms.ofdm_symbol_size/(double)(12*NB_RB)) - SNR;
sigma2_dB = 10*log10((double)tx_lev) +10*log10((double)PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size/(double)(12*NB_RB)) - SNR;
if (n_frames==1)
printf("sigma2_dB %f (SNR %f dB) tx_lev_dB %f,%f,%f\n",sigma2_dB,SNR,
......@@ -947,7 +893,7 @@ int main(int argc, char **argv)
for (n_trials=0; n_trials<ntrials; n_trials++) {
//printf("n_trial %d\n",n_trials);
for (i=0; i<2*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; i++) {
for (aa=0; aa<PHY_vars_eNb->lte_frame_parms.nb_antennas_rx; aa++) {
for (aa=0; aa<PHY_vars_eNB->lte_frame_parms.nb_antennas_rx; aa++) {
if (n_trials==0) {
r_re[aa][i] += (pow(10.0,.05*interf1)*r_re1[aa][i] + pow(10.0,.05*interf2)*r_re2[aa][i]);
r_im[aa][i] += (pow(10.0,.05*interf1)*r_im1[aa][i] + pow(10.0,.05*interf2)*r_im2[aa][i]);
......@@ -983,14 +929,14 @@ int main(int argc, char **argv)
*/
for (l=0; l<PHY_vars_eNb->lte_frame_parms.symbols_per_tti; l++) {
for (l=0; l<PHY_vars_eNB->lte_frame_parms.symbols_per_tti; l++) {
// subframe_offset = (l/PHY_vars_eNb->lte_frame_parms.symbols_per_tti)*PHY_vars_eNb->lte_frame_parms.samples_per_tti;
// subframe_offset = (l/PHY_vars_eNB->lte_frame_parms.symbols_per_tti)*PHY_vars_eNB->lte_frame_parms.samples_per_tti;
// printf("subframe_offset = %d\n",subframe_offset);
slot_fep(PHY_vars_UE,
l%(PHY_vars_eNb->lte_frame_parms.symbols_per_tti/2),
l/(PHY_vars_eNb->lte_frame_parms.symbols_per_tti/2),
l%(PHY_vars_eNB->lte_frame_parms.symbols_per_tti/2),
l/(PHY_vars_eNB->lte_frame_parms.symbols_per_tti/2),
0,
0,
0);
......@@ -1026,7 +972,7 @@ int main(int argc, char **argv)
*/
}
if (l==((PHY_vars_eNb->lte_frame_parms.Ncp==0)?4:3)) {
if (l==((PHY_vars_eNB->lte_frame_parms.Ncp==0)?4:3)) {
//sprintf(fname,"dl_ch00_%d.m",l);
//sprintf(vname,"dl_ch00_%d",l);
//write_output(fname,vname,&(lte_ue_common_vars->dl_ch_estimates[0][lte_frame_parms->ofdm_symbol_size*(l%6)]),lte_frame_parms->ofdm_symbol_size,1,1);
......@@ -1038,7 +984,7 @@ int main(int argc, char **argv)
1);
}
if (l==((PHY_vars_eNb->lte_frame_parms.Ncp==0)?10:9)) {
if (l==((PHY_vars_eNB->lte_frame_parms.Ncp==0)?10:9)) {
for (frame_mod4=0; frame_mod4<4; frame_mod4++) {
pbch_tx_ant = rx_pbch(&PHY_vars_UE->lte_ue_common_vars,
......@@ -1059,7 +1005,7 @@ int main(int argc, char **argv)
pbch_tx_ant = rx_pbch(&PHY_vars_UE->lte_ue_common_vars,
PHY_vars_UE->lte_ue_pbch_vars[0],
&PHY_vars_eNb->lte_frame_parms,
&PHY_vars_eNB->lte_frame_parms,
0,
ALAMOUTI,
PHY_vars_UE->high_speed_flag,
......@@ -1119,10 +1065,10 @@ int main(int argc, char **argv)
if (n_frames==1) {
write_output("H00.m","h00",&(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[0][0][0]),((frame_parms->Ncp==0)?7:6)*(PHY_vars_eNb->lte_frame_parms.ofdm_symbol_size),1,1);
write_output("H00.m","h00",&(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[0][0][0]),((frame_parms->Ncp==0)?7:6)*(PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size),1,1);
if (n_tx==2)
write_output("H10.m","h10",&(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[0][2][0]),((frame_parms->Ncp==0)?7:6)*(PHY_vars_eNb->lte_frame_parms.ofdm_symbol_size),1,1);
write_output("H10.m","h10",&(PHY_vars_UE->lte_ue_common_vars.dl_ch_estimates[0][2][0]),((frame_parms->Ncp==0)?7:6)*(PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size),1,1);
write_output("rxsig0.m","rxs0", PHY_vars_UE->lte_ue_common_vars.rxdata[0],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
write_output("rxsigF0.m","rxsF0", PHY_vars_UE->lte_ue_common_vars.rxdataF[0],NUMBER_OF_OFDM_CARRIERS*2*((frame_parms->Ncp==0)?14:12),2,1);
......
......@@ -58,98 +58,6 @@ PHY_VARS_UE *PHY_vars_UE;
#define CCCH_RB_ALLOC computeRIV(PHY_vars_eNB->lte_frame_parms.N_RB_UL,0,2)
#define DLSCH_RB_ALLOC 0x1fbf // igore DC component,RB13
void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmission_mode,unsigned char extended_prefix_flag,uint16_t Nid_cell,uint8_t tdd_config,uint8_t N_RB_DL,
lte_frame_type_t frame_type,uint8_t osf,uint32_t perfect_ce)
{
unsigned int i;
LTE_DL_FRAME_PARMS *lte_frame_parms;
printf("Start lte_param_init (Nid_cell %d, extended_prefix %d, transmission_mode %d, N_tx %d, N_rx %d)\n",
Nid_cell, extended_prefix_flag,transmission_mode,N_tx,N_rx);
PHY_vars_eNB = malloc(sizeof(PHY_VARS_eNB));
PHY_vars_eNB1 = malloc(sizeof(PHY_VARS_eNB));
PHY_vars_eNB2 = malloc(sizeof(PHY_VARS_eNB));
PHY_vars_UE = malloc(sizeof(PHY_VARS_UE));
//PHY_config = malloc(sizeof(PHY_CONFIG));
mac_xface = malloc(sizeof(MAC_xface));
randominit(0);
set_taus_seed(0);
lte_frame_parms = &(PHY_vars_eNB->lte_frame_parms);
lte_frame_parms->N_RB_DL = N_RB_DL; //50 for 10MHz and 25 for 5 MHz
lte_frame_parms->N_RB_UL = N_RB_DL;
lte_frame_parms->Ncp = extended_prefix_flag;
lte_frame_parms->Nid_cell = Nid_cell;
lte_frame_parms->nushift = Nid_cell%6;
lte_frame_parms->nb_antennas_tx_eNB = N_tx;
lte_frame_parms->nb_antennas_tx = N_tx;
lte_frame_parms->nb_antennas_rx = N_rx;
lte_frame_parms->phich_config_common.phich_resource = one; //half
lte_frame_parms->tdd_config = tdd_config;
lte_frame_parms->frame_type = frame_type;
// lte_frame_parms->Csrs = 2;
// lte_frame_parms->Bsrs = 0;
// lte_frame_parms->kTC = 0;
// lte_frame_parms->n_RRC = 0;
lte_frame_parms->mode1_flag = (transmission_mode == 1)? 1 : 0;
init_frame_parms(lte_frame_parms,osf);
//copy_lte_parms_to_phy_framing(lte_frame_parms, &(PHY_config->PHY_framing));
memcpy(&PHY_vars_UE->lte_frame_parms,lte_frame_parms,sizeof(LTE_DL_FRAME_PARMS));
phy_init_lte_top(lte_frame_parms);
phy_init_lte_ue(PHY_vars_UE,1,0);
phy_init_lte_eNB(PHY_vars_eNB,0,0,0);
memcpy((void*)&PHY_vars_eNB1->lte_frame_parms,(void*)&PHY_vars_eNB->lte_frame_parms,sizeof(LTE_DL_FRAME_PARMS));
PHY_vars_eNB1->lte_frame_parms.nushift=(Nid_cell+1)%6;
PHY_vars_eNB1->lte_frame_parms.Nid_cell=Nid_cell+1;
memcpy((void*)&PHY_vars_eNB2->lte_frame_parms,(void*)&PHY_vars_eNB->lte_frame_parms,sizeof(LTE_DL_FRAME_PARMS));
PHY_vars_eNB2->lte_frame_parms.nushift=(Nid_cell+2)%6;
PHY_vars_eNB2->lte_frame_parms.Nid_cell=Nid_cell+2;
phy_init_lte_eNB(PHY_vars_eNB1,0,0,0);
phy_init_lte_eNB(PHY_vars_eNB2,0,0,0);
phy_init_lte_top(lte_frame_parms);
PHY_vars_UE->PHY_measurements.n_adj_cells=2;
PHY_vars_UE->PHY_measurements.adj_cell_id[0] = Nid_cell+1;
PHY_vars_UE->PHY_measurements.adj_cell_id[1] = Nid_cell+2;
PHY_vars_UE->perfect_ce = perfect_ce;
for (i=0; i<3; i++)
lte_gold(lte_frame_parms,PHY_vars_UE->lte_gold_table[i],Nid_cell+i);
generate_pcfich_reg_mapping(&PHY_vars_UE->lte_frame_parms);
generate_phich_reg_mapping(&PHY_vars_UE->lte_frame_parms);
printf("Done lte_param_init\n");
CCCH_alloc_pdu.type = 1;
CCCH_alloc_pdu.vrb_type = 0;
CCCH_alloc_pdu.rballoc = CCCH_RB_ALLOC;
CCCH_alloc_pdu.ndi = 1;
CCCH_alloc_pdu.mcs = 1;
CCCH_alloc_pdu.harq_pid = 0;
}
DCI_PDU DCI_pdu;
DCI_PDU *get_dci(LTE_DL_FRAME_PARMS *lte_frame_parms,uint8_t log2L, uint8_t log2Lcommon, uint8_t format_selector, uint32_t rnti)
......@@ -798,9 +706,10 @@ int main(int argc, char **argv)
n_rx,
transmission_mode,
extended_prefix_flag,
frame_type,
Nid_cell,
tdd_config,
N_RB_DL,frame_type,
N_RB_DL,
osf,
perfect_ce);
......@@ -1084,7 +993,7 @@ int main(int argc, char **argv)
if (PHY_vars_eNB->lte_frame_parms.Ncp == 1)
PHY_ofdm_mod(&PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNb_id][aa][subframe*nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size], // input,
&txdata[aa][subframe*PHY_vars_eNB->lte_frame_parms.samples_per_tti], // output
PHY_vars_eNB->lte_frame_parms.log2_symbol_size, // log2_fft_size
PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size,
2*nsymb, // number of symbols
PHY_vars_eNB->lte_frame_parms.nb_prefix_samples, // number of prefix samples
CYCLIC_PREFIX);
......
......@@ -56,58 +56,6 @@ PHY_VARS_UE *PHY_vars_UE;
void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmission_mode,unsigned char extended_prefix_flag,uint16_t Nid_cell,uint8_t N_RB_DL,uint8_t osf)
{
LTE_DL_FRAME_PARMS *lte_frame_parms;
printf("Start lte_param_init\n");
PHY_vars_eNB = malloc(sizeof(PHY_VARS_eNB));
PHY_vars_UE = malloc(sizeof(PHY_VARS_UE));
//PHY_config = malloc(sizeof(PHY_CONFIG));
mac_xface = malloc(sizeof(MAC_xface));
randominit(0);
set_taus_seed(0);
lte_frame_parms = &(PHY_vars_eNB->lte_frame_parms);
lte_frame_parms->N_RB_DL = N_RB_DL; //50 for 10MHz and 25 for 5 MHz
lte_frame_parms->N_RB_UL = N_RB_DL;
lte_frame_parms->Ncp = extended_prefix_flag;
lte_frame_parms->Nid_cell = Nid_cell;
lte_frame_parms->nushift = 0;
lte_frame_parms->nb_antennas_tx = N_tx;
lte_frame_parms->nb_antennas_rx = N_rx;
// lte_frame_parms->Csrs = 2;
// lte_frame_parms->Bsrs = 0;
// lte_frame_parms->kTC = 0;
// lte_frame_parms->n_RRC = 0;
lte_frame_parms->mode1_flag = (transmission_mode == 1)? 1 : 0;
lte_frame_parms->tdd_config = 1;
lte_frame_parms->frame_type = 1;
init_frame_parms(lte_frame_parms,osf);
//copy_lte_parms_to_phy_framing(lte_frame_parms, &(PHY_config->PHY_framing));
PHY_vars_UE->lte_frame_parms = *lte_frame_parms;
phy_init_lte_top(lte_frame_parms);
phy_init_lte_ue(PHY_vars_UE,1,0);
phy_init_lte_eNB(PHY_vars_eNB,0,0,0);
printf("Done lte_param_init\n");
}
extern uint16_t prach_root_sequence_map0_3[838];
int main(int argc, char **argv)
......@@ -370,7 +318,16 @@ int main(int argc, char **argv)
if (transmission_mode==2)
n_tx=2;
lte_param_init(n_tx,n_rx,transmission_mode,extended_prefix_flag,Nid_cell,N_RB_DL,osf);
lte_param_init(n_tx,
n_rx,
transmission_mode,
extended_prefix_flag,
FDD,
Nid_cell,
3,
N_RB_DL,
osf,
0);
if (snr1set==0) {
......
......@@ -58,60 +58,6 @@ PHY_VARS_UE *PHY_vars_UE;
void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmission_mode,unsigned char extended_prefix_flag,uint16_t Nid_cell,uint8_t N_RB_DL,uint8_t osf)
{
LTE_DL_FRAME_PARMS *lte_frame_parms;
printf("Start lte_param_init\n");
PHY_vars_eNB = malloc(sizeof(PHY_VARS_eNB));
PHY_vars_UE = malloc(sizeof(PHY_VARS_UE));
//PHY_config = malloc(sizeof(PHY_CONFIG));
mac_xface = malloc(sizeof(MAC_xface));
randominit(0);
set_taus_seed(0);
lte_frame_parms = &(PHY_vars_eNB->lte_frame_parms);
lte_frame_parms->N_RB_DL = N_RB_DL; //50 for 10MHz and 25 for 5 MHz
lte_frame_parms->N_RB_UL = N_RB_DL;
lte_frame_parms->Ncp = extended_prefix_flag;
lte_frame_parms->Nid_cell = Nid_cell;
lte_frame_parms->nushift = 0;
lte_frame_parms->nb_antennas_tx = N_tx;
lte_frame_parms->nb_antennas_rx = N_rx;
// lte_frame_parms->Csrs = 2;
// lte_frame_parms->Bsrs = 0;
// lte_frame_parms->kTC = 0;
// lte_frame_parms->n_RRC = 0;
lte_frame_parms->mode1_flag = (transmission_mode == 1)? 1 : 0;
lte_frame_parms->tdd_config = 3;
lte_frame_parms->frame_type = 0;
init_frame_parms(lte_frame_parms,osf);
//copy_lte_parms_to_phy_framing(lte_frame_parms, &(PHY_config->PHY_framing));
// phy_init_top(lte_frame_parms); //allocation
PHY_vars_UE->lte_frame_parms = *lte_frame_parms;
phy_init_lte_ue(PHY_vars_UE,1,0);
phy_init_lte_eNB(PHY_vars_eNB,0,0,0);
phy_init_lte_top(lte_frame_parms);
printf("Done lte_param_init\n");
}
int main(int argc, char **argv)
{
......@@ -368,7 +314,16 @@ int main(int argc, char **argv)
if (transmission_mode==2)
n_tx=2;
lte_param_init(n_tx,n_rx,transmission_mode,extended_prefix_flag,Nid_cell,N_RB_DL,osf);
lte_param_init(n_tx,
n_rx,
transmission_mode,
extended_prefix_flag,
Nid_cell,
FDD,
3,
N_RB_DL,
osf,
0);
if (snr1set==0) {
......@@ -473,7 +428,7 @@ int main(int argc, char **argv)
if (frame_parms->Ncp == 1)
PHY_ofdm_mod(txdataF2[aa], // input
txdata[aa], // output
frame_parms->log2_symbol_size, // log2_fft_size
frame_parms->ofdm_symbol_size,
2*nsymb, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples
CYCLIC_PREFIX);
......@@ -496,7 +451,7 @@ int main(int argc, char **argv)
if (frame_parms->Ncp == 1)
PHY_ofdm_mod(&PHY_vars_UE->lte_ue_common_vars.txdataF[aa][2*subframe*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES_NO_PREFIX], // input,
&txdata[aa][PHY_vars_eNB->lte_frame_parms.samples_per_tti*subframe], // output
frame_parms->log2_symbol_size, // log2_fft_size
frame_parms->ofdm_symbol_size,
nsymb, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples
CYCLIC_PREFIX);
......
......@@ -56,94 +56,11 @@
#define BW 20.0
PHY_VARS_eNB *PHY_vars_eNb,*PHY_vars_eNb1,*PHY_vars_eNb2;
PHY_VARS_eNB *PHY_vars_eNB,*PHY_vars_eNB1,*PHY_vars_eNB2;
PHY_VARS_UE *PHY_vars_UE;
#define DLSCH_RB_ALLOC 0x1fbf // igore DC component,RB13
void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmission_mode,unsigned char extended_prefix_flag,unsigned char frame_type, uint16_t Nid_cell,uint8_t N_RB_DL,uint8_t osf)
{
// unsigned int ind;
LTE_DL_FRAME_PARMS *lte_frame_parms;
int i;
printf("Start lte_param_init\n");
PHY_vars_eNb = malloc(sizeof(PHY_VARS_eNB));
PHY_vars_eNb1 = malloc(sizeof(PHY_VARS_eNB));
PHY_vars_eNb2 = malloc(sizeof(PHY_VARS_eNB));
PHY_vars_UE = malloc(sizeof(PHY_VARS_UE));
//PHY_config = malloc(sizeof(PHY_CONFIG));
mac_xface = malloc(sizeof(MAC_xface));
randominit(0);
set_taus_seed(0);
lte_frame_parms = &(PHY_vars_eNb->lte_frame_parms);
lte_frame_parms->N_RB_DL = N_RB_DL; //50 for 10MHz and 25 for 5 MHz
lte_frame_parms->N_RB_UL = N_RB_DL;
lte_frame_parms->Ncp = extended_prefix_flag;
lte_frame_parms->Nid_cell = Nid_cell;
lte_frame_parms->nushift = Nid_cell%6;
lte_frame_parms->nb_antennas_tx = N_tx;
lte_frame_parms->nb_antennas_tx_eNB = N_tx;
lte_frame_parms->nb_antennas_rx = N_rx;
// lte_frame_parms->Csrs = 2;
// lte_frame_parms->Bsrs = 0;
// lte_frame_parms->kTC = 0;
// lte_frame_parms->n_RRC = 0;
lte_frame_parms->mode1_flag = (transmission_mode == 1)? 1 : 0;
lte_frame_parms->tdd_config = 3;
lte_frame_parms->frame_type = frame_type;
init_frame_parms(lte_frame_parms,osf);
//copy_lte_parms_to_phy_framing(lte_frame_parms, &(PHY_config->PHY_framing));
PHY_vars_UE->lte_frame_parms = *lte_frame_parms;
phy_init_lte_top(lte_frame_parms);
PHY_vars_UE->PHY_measurements.n_adj_cells=2;
PHY_vars_UE->PHY_measurements.adj_cell_id[0] = Nid_cell+1;
PHY_vars_UE->PHY_measurements.adj_cell_id[1] = Nid_cell+2;
for (i=0; i<3; i++)
lte_gold(lte_frame_parms,PHY_vars_UE->lte_gold_table[i],Nid_cell+i);
phy_init_lte_ue(PHY_vars_UE,1,0);
phy_init_lte_eNB(PHY_vars_eNb,0,0,0);
for (i=0; i<10; i++) {
PHY_vars_UE->scan_info[0].amp[0][i] = 0;
PHY_vars_UE->scan_info[0].amp[1][i] = 0;
PHY_vars_UE->scan_info[0].amp[2][i] = 0;
}
memcpy((void*)&PHY_vars_eNb1->lte_frame_parms,(void*)&PHY_vars_eNb->lte_frame_parms,sizeof(LTE_DL_FRAME_PARMS));
PHY_vars_eNb1->lte_frame_parms.Nid_cell=Nid_cell+1;
PHY_vars_eNb1->lte_frame_parms.nushift=(Nid_cell+1)%6;
PHY_vars_eNb1->Mod_id=1;
memcpy((void*)&PHY_vars_eNb2->lte_frame_parms,(void*)&PHY_vars_eNb->lte_frame_parms,sizeof(LTE_DL_FRAME_PARMS));
PHY_vars_eNb2->lte_frame_parms.Nid_cell=Nid_cell+2;
PHY_vars_eNb2->lte_frame_parms.nushift=(Nid_cell+2)%6;
PHY_vars_eNb2->Mod_id=2;
phy_init_lte_eNB(PHY_vars_eNb1,0,0,0);
phy_init_lte_eNB(PHY_vars_eNb2,0,0,0);
phy_init_lte_top(lte_frame_parms);
printf("Done lte_param_init\n");
}
mod_sym_t *dummybuf[4];
mod_sym_t dummy0[2048*14];
mod_sym_t dummy1[2048*14];
......@@ -404,7 +321,16 @@ int main(int argc, char **argv)
if (transmission_mode>=2)
n_tx=2;
lte_param_init(n_tx,n_rx,transmission_mode,extended_prefix_flag,frame_type,Nid_cell,N_RB_DL,osf);
lte_param_init(n_tx,
n_rx,
transmission_mode,
extended_prefix_flag,
frame_type,
Nid_cell,
3,
N_RB_DL,
osf,
0);
#ifdef XFORMS
fl_initialize (&argc, argv, NULL, 0, 0);
......@@ -422,13 +348,13 @@ int main(int argc, char **argv)
printf("SNR0 %f, SNR1 %f\n",snr0,snr1);
frame_parms = &PHY_vars_eNb->lte_frame_parms;
frame_parms = &PHY_vars_eNB->lte_frame_parms;
txdata = PHY_vars_eNb->lte_eNB_common_vars.txdata[0];
txdata1 = PHY_vars_eNb1->lte_eNB_common_vars.txdata[0];
txdata2 = PHY_vars_eNb2->lte_eNB_common_vars.txdata[0];
txdata = PHY_vars_eNB->lte_eNB_common_vars.txdata[0];
txdata1 = PHY_vars_eNB1->lte_eNB_common_vars.txdata[0];
txdata2 = PHY_vars_eNB2->lte_eNB_common_vars.txdata[0];
s_re = malloc(2*sizeof(double*));
......@@ -449,8 +375,8 @@ int main(int argc, char **argv)
printf("FFT Size %d, Extended Prefix %d, Samples per subframe %d, Symbols per subframe %d\n",NUMBER_OF_OFDM_CARRIERS,
frame_parms->Ncp,frame_parms->samples_per_tti,nsymb);
printf("PHY_vars_eNb1->lte_eNB_common_vars.txdataF[0][0] = %p\n",
PHY_vars_eNb1->lte_eNB_common_vars.txdataF[0][0]);
printf("PHY_vars_eNB1->lte_eNB_common_vars.txdataF[0][0] = %p\n",
PHY_vars_eNB1->lte_eNB_common_vars.txdataF[0][0]);
DLSCH_alloc_pdu2.rah = 0;
......@@ -465,13 +391,14 @@ int main(int argc, char **argv)
// Forget second codeword
DLSCH_alloc_pdu2.tpmi = (transmission_mode==6 ? 5 : 0) ; // precoding
eNB2UE = new_channel_desc_scm(PHY_vars_eNb->lte_frame_parms.nb_antennas_tx,
PHY_vars_UE->lte_frame_parms.nb_antennas_rx,
channel_model,
BW,
0,
0,
0);
eNB2UE = new_channel_desc_scm(PHY_vars_eNB->lte_frame_parms.nb_antennas_tx,
PHY_vars_UE->lte_frame_parms.nb_antennas_rx,
channel_model,
N_RB2sampling_rate(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
N_RB2channel_bandwidth(PHY_vars_eNB->lte_frame_parms.N_RB_DL),
0,
0,
0);
if (eNB2UE==NULL) {
......@@ -512,51 +439,51 @@ int main(int argc, char **argv)
pbch_pdu[1]=1;
pbch_pdu[2]=0;
if (PHY_vars_eNb->lte_frame_parms.frame_type == FDD) {
generate_pss(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
if (PHY_vars_eNB->lte_frame_parms.frame_type == FDD) {
generate_pss(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
AMP,
&PHY_vars_eNb->lte_frame_parms,
(PHY_vars_eNb->lte_frame_parms.Ncp==NORMAL) ? 6 : 5,
&PHY_vars_eNB->lte_frame_parms,
(PHY_vars_eNB->lte_frame_parms.Ncp==NORMAL) ? 6 : 5,
0);
/*
generate_sss(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
generate_sss(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
AMP,
&PHY_vars_eNb->lte_frame_parms,
(PHY_vars_eNb->lte_frame_parms.Ncp==0) ? 5 : 4,
&PHY_vars_eNB->lte_frame_parms,
(PHY_vars_eNB->lte_frame_parms.Ncp==0) ? 5 : 4,
0);*/
generate_pss(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
generate_pss(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
AMP,
&PHY_vars_eNb->lte_frame_parms,
(PHY_vars_eNb->lte_frame_parms.Ncp==0) ? 6 : 5,
&PHY_vars_eNB->lte_frame_parms,
(PHY_vars_eNB->lte_frame_parms.Ncp==0) ? 6 : 5,
10);
/*
generate_sss(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
generate_sss(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
AMP,
&PHY_vars_eNb->lte_frame_parms,
(PHY_vars_eNb->lte_frame_parms.Ncp==0) ? 5 : 4,
&PHY_vars_eNB->lte_frame_parms,
(PHY_vars_eNB->lte_frame_parms.Ncp==0) ? 5 : 4,
10);
*/
} else {
generate_sss(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
generate_sss(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
AMP,
&PHY_vars_eNb->lte_frame_parms,
(PHY_vars_eNb->lte_frame_parms.Ncp==0) ? 6 : 5,
&PHY_vars_eNB->lte_frame_parms,
(PHY_vars_eNB->lte_frame_parms.Ncp==0) ? 6 : 5,
1);
generate_pss(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
generate_pss(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
AMP,
&PHY_vars_eNb->lte_frame_parms,
&PHY_vars_eNB->lte_frame_parms,
2,
2);
generate_sss(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
generate_sss(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
AMP,
&PHY_vars_eNb->lte_frame_parms,
(PHY_vars_eNb->lte_frame_parms.Ncp==0) ? 6 : 5,
&PHY_vars_eNB->lte_frame_parms,
(PHY_vars_eNB->lte_frame_parms.Ncp==0) ? 6 : 5,
11);
generate_pss(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
generate_pss(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
AMP,
&PHY_vars_eNb->lte_frame_parms,
&PHY_vars_eNB->lte_frame_parms,
2,
12);
......@@ -565,8 +492,8 @@ int main(int argc, char **argv)
/*
generate_pilots(PHY_vars_eNb,
PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
generate_pilots(PHY_vars_eNB,
PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
AMP,
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME);
......@@ -577,8 +504,8 @@ int main(int argc, char **argv)
dci_alloc,
0,
1024,
&PHY_vars_eNb->lte_frame_parms,
PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
&PHY_vars_eNB->lte_frame_parms,
PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
0);
*/
......@@ -593,25 +520,25 @@ int main(int argc, char **argv)
dummybuf[1] = dummy1;
dummybuf[2] = dummy2;
dummybuf[3] = dummy3;
generate_pbch(&PHY_vars_eNb->lte_eNB_pbch,
generate_pbch(&PHY_vars_eNB->lte_eNB_pbch,
(mod_sym_t**)dummybuf,
AMP,
&PHY_vars_eNb->lte_frame_parms,
&PHY_vars_eNB->lte_frame_parms,
pbch_pdu,
0);
}
generate_pbch(&PHY_vars_eNb->lte_eNB_pbch,
PHY_vars_eNb->lte_eNB_common_vars.txdataF[0],
generate_pbch(&PHY_vars_eNB->lte_eNB_pbch,
PHY_vars_eNB->lte_eNB_common_vars.txdataF[0],
AMP,
&PHY_vars_eNb->lte_frame_parms,
&PHY_vars_eNB->lte_frame_parms,
pbch_pdu,
pbch_phase);
*/
write_output("txsigF0.m","txsF0", PHY_vars_eNb->lte_eNB_common_vars.txdataF[0][0],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX,1,1);
write_output("txsigF0.m","txsF0", PHY_vars_eNB->lte_eNB_common_vars.txdataF[0][0],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX,1,1);
if (PHY_vars_eNb->lte_frame_parms.nb_antennas_tx>1)
write_output("txsigF1.m","txsF1", PHY_vars_eNb->lte_eNB_common_vars.txdataF[0][1],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX,1,1);
if (PHY_vars_eNB->lte_frame_parms.nb_antennas_tx>1)
write_output("txsigF1.m","txsF1", PHY_vars_eNB->lte_eNB_common_vars.txdataF[0][1],FRAME_LENGTH_COMPLEX_SAMPLES_NO_PREFIX,1,1);
tx_lev = 0;
tx_lev1 = 0;
......@@ -620,16 +547,16 @@ int main(int argc, char **argv)
for (aa=0; aa<PHY_vars_eNb->lte_frame_parms.nb_antennas_tx; aa++) {
for (aa=0; aa<PHY_vars_eNB->lte_frame_parms.nb_antennas_tx; aa++) {
if (frame_parms->Ncp == 1)
PHY_ofdm_mod(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0][aa], // input,
PHY_ofdm_mod(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0][aa], // input,
txdata[aa], // output
frame_parms->log2_symbol_size, // log2_fft_size
frame_parms->ofdm_symbol_size,
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*nsymb, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples
CYCLIC_PREFIX);
else {
normal_prefix_mod(PHY_vars_eNb->lte_eNB_common_vars.txdataF[0][aa],
normal_prefix_mod(PHY_vars_eNB->lte_eNB_common_vars.txdataF[0][aa],
txdata[aa],
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*nsymb,
frame_parms);
......@@ -648,7 +575,7 @@ int main(int argc, char **argv)
// multipath channel
for (i=0; i<2*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; i++) {
for (aa=0; aa<PHY_vars_eNb->lte_frame_parms.nb_antennas_tx; aa++) {
for (aa=0; aa<PHY_vars_eNB->lte_frame_parms.nb_antennas_tx; aa++) {
s_re[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)]);
s_im[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)+1]);
}
......@@ -667,7 +594,7 @@ int main(int argc, char **argv)
multipath_channel(eNB2UE,s_re,s_im,r_re,r_im,
2*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES,0);
sigma2_dB = 10*log10((double)tx_lev) +10*log10((double)PHY_vars_eNb->lte_frame_parms.ofdm_symbol_size/(double)(12*NB_RB)) - SNR;
sigma2_dB = 10*log10((double)tx_lev) +10*log10((double)PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size/(double)(12*NB_RB)) - SNR;
if (n_frames==1)
printf("sigma2_dB %f (SNR %f dB) tx_lev_dB %f,%f,%f\n",sigma2_dB,SNR,
......@@ -689,7 +616,7 @@ int main(int argc, char **argv)
for (n_trials=0; n_trials<ntrials; n_trials++) {
//printf("n_trial %d\n",n_trials);
for (i=0; i<2*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; i++) {
for (aa=0; aa<PHY_vars_eNb->lte_frame_parms.nb_antennas_rx; aa++) {
for (aa=0; aa<PHY_vars_eNB->lte_frame_parms.nb_antennas_rx; aa++) {
((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[2*i] = (short) ((r_re[aa][i] +sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
((short*) PHY_vars_UE->lte_ue_common_vars.rxdata[aa])[2*i+1] = (short) ((r_im[aa][i] + (iqim*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
}
......
......@@ -1189,7 +1189,7 @@ int main(int argc, char **argv)
if (frame_parms->Ncp == 1)
PHY_ofdm_mod(txdataF2[aa], // input
txdata[aa], // output
PHY_vars_eNB->lte_frame_parms.log2_symbol_size, // log2_fft_size
PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size, // log2_fft_size
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*nsymb, // number of symbols
PHY_vars_eNB->lte_frame_parms.nb_prefix_samples, // number of prefix samples
PHY_vars_eNB->lte_frame_parms.twiddle_ifft, // IFFT twiddle factors
......@@ -1218,7 +1218,7 @@ int main(int argc, char **argv)
if (frame_parms->Ncp == 1)
PHY_ofdm_mod(PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNb_id][aa], // input,
txdata[aa], // output
frame_parms->log2_symbol_size, // log2_fft_size
frame_parms->ofdm_symbol_size, // log2_fft_size
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*nsymb, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples
frame_parms->twiddle_ifft, // IFFT twiddle factors
......@@ -1240,7 +1240,7 @@ int main(int argc, char **argv)
if (frame_parms->Ncp == 1)
PHY_ofdm_mod(PHY_vars_eNB1->lte_eNB_common_vars.txdataF[eNb_id][aa], // input,
PHY_vars_eNB1->lte_eNB_common_vars.txdata[eNb_id][aa], // output
frame_parms->log2_symbol_size, // log2_fft_size
frame_parms->ofdm_symbol_size, // log2_fft_size
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*nsymb, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples
frame_parms->twiddle_ifft, // IFFT twiddle factors
......@@ -1260,7 +1260,7 @@ int main(int argc, char **argv)
if (frame_parms->Ncp == 1)
PHY_ofdm_mod(PHY_vars_eNB2->lte_eNB_common_vars.txdataF[eNb_id][aa], // input,
PHY_vars_eNB2->lte_eNB_common_vars.txdata[eNb_id][aa], // output
frame_parms->log2_symbol_size, // log2_fft_size
frame_parms->ofdm_symbol_size, // log2_fft_size
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*nsymb, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples
frame_parms->twiddle_ifft, // IFFT twiddle factors
......
......@@ -89,60 +89,6 @@ double t_rx_min = 1000000000; /*!< \brief initial min process time for tx */
int n_tx_dropped = 0; /*!< \brief initial max process time for tx */
int n_rx_dropped = 0; /*!< \brief initial max process time for rx */
void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmission_mode,uint8_t extended_prefix_flag,uint8_t N_RB_DL,uint8_t frame_type,uint8_t tdd_config,uint8_t osf)
{
LTE_DL_FRAME_PARMS *lte_frame_parms;
printf("Start lte_param_init\n");
PHY_vars_eNB = malloc(sizeof(PHY_VARS_eNB));
PHY_vars_UE = malloc(sizeof(PHY_VARS_UE));
//PHY_config = malloc(sizeof(PHY_CONFIG));
mac_xface = malloc(sizeof(MAC_xface));
randominit(0);
set_taus_seed(0);
lte_frame_parms = &(PHY_vars_eNB->lte_frame_parms);
lte_frame_parms->frame_type = frame_type;
lte_frame_parms->tdd_config = tdd_config;
lte_frame_parms->N_RB_DL = N_RB_DL; //50 for 10MHz and 25 for 5 MHz
lte_frame_parms->N_RB_UL = N_RB_DL;
lte_frame_parms->Ncp = extended_prefix_flag;
lte_frame_parms->Ncp_UL = extended_prefix_flag;
lte_frame_parms->Nid_cell = 10;
lte_frame_parms->nushift = 0;
lte_frame_parms->nb_antennas_tx = N_tx;
lte_frame_parms->nb_antennas_rx = N_rx;
// lte_frame_parms->Csrs = 2;
// lte_frame_parms->Bsrs = 0;
// lte_frame_parms->kTC = 0;
// lte_frame_parms->n_RRC = 0;
lte_frame_parms->mode1_flag = (transmission_mode == 1)? 1 : 0;
lte_frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift = 0;//n_DMRS1 set to 0
init_frame_parms(lte_frame_parms,osf);
//copy_lte_parms_to_phy_framing(lte_frame_parms, &(PHY_config->PHY_framing));
PHY_vars_UE->lte_frame_parms = *lte_frame_parms;
phy_init_lte_top(lte_frame_parms);
phy_init_lte_ue(PHY_vars_UE,1,0);
phy_init_lte_eNB(PHY_vars_eNB,0,0,0);
printf("Done lte_param_init\n");
}
int main(int argc, char **argv)
{
......@@ -520,7 +466,16 @@ int main(int argc, char **argv)
}
}
lte_param_init(1,n_rx,1,extended_prefix_flag,N_RB_DL,frame_type,tdd_config,osf);
lte_param_init(1,
n_rx,
1,
extended_prefix_flag,
frame_type,
0,
tdd_config,
N_RB_DL,
osf,
0);
if (nb_rb_set == 0)
nb_rb = PHY_vars_eNB->lte_frame_parms.N_RB_UL;
......@@ -1109,7 +1064,7 @@ int main(int argc, char **argv)
if (frame_parms->Ncp == 1)
PHY_ofdm_mod(&PHY_vars_UE->lte_ue_common_vars.txdataF[aa][subframe*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES_NO_PREFIX], // input
&txdata[aa][PHY_vars_eNB->lte_frame_parms.samples_per_tti*subframe], // output
PHY_vars_UE->lte_frame_parms.log2_symbol_size, // log2_fft_size
PHY_vars_UE->lte_frame_parms.ofdm_symbol_size,
nsymb, // number of symbols
PHY_vars_UE->lte_frame_parms.nb_prefix_samples, // number of prefix samples
CYCLIC_PREFIX);
......
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