removed PHY/TOOLS/fft.c and all uses of this FFT implementation. All are replaced by the faster versions in PHY/TOOLS/lte_dfts.c

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7390 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
Raymond Knopp
2015-05-08 19:33:10 +00:00
parent f8bc7e385d
commit d6cdcb915b
45 changed files with 881 additions and 97149 deletions
-2
View File
@@ -768,9 +768,7 @@ set(PHY_SRC
${OPENAIR1_DIR}/PHY/CODING/viterbi_lte.c ${OPENAIR1_DIR}/PHY/CODING/viterbi_lte.c
${OPENAIR1_DIR}/PHY/INIT/lte_init.c ${OPENAIR1_DIR}/PHY/INIT/lte_init.c
${OPENAIR1_DIR}/PHY/INIT/lte_parms.c ${OPENAIR1_DIR}/PHY/INIT/lte_parms.c
${OPENAIR1_DIR}/PHY/INIT/init_top.c
${OPENAIR1_DIR}/PHY/TOOLS/file_output.c ${OPENAIR1_DIR}/PHY/TOOLS/file_output.c
${OPENAIR1_DIR}/PHY/TOOLS/fft.c
${OPENAIR1_DIR}/PHY/TOOLS/lte_dfts.c ${OPENAIR1_DIR}/PHY/TOOLS/lte_dfts.c
${OPENAIR1_DIR}/PHY/TOOLS/log2_approx.c ${OPENAIR1_DIR}/PHY/TOOLS/log2_approx.c
${OPENAIR1_DIR}/PHY/TOOLS/cmult_sv.c ${OPENAIR1_DIR}/PHY/TOOLS/cmult_sv.c
File diff suppressed because it is too large Load Diff
-361
View File
@@ -36,16 +36,6 @@
#include "MAC_INTERFACE/extern.h" #include "MAC_INTERFACE/extern.h"
//#include "ARCH/CBMIMO1/DEVICE_DRIVER/extern.h" //#include "ARCH/CBMIMO1/DEVICE_DRIVER/extern.h"
#ifdef CBMIMO1
#include "ARCH/COMMON/defs.h"
#include "ARCH/CBMIMO1/DEVICE_DRIVER/from_grlib_softconfig.h"
#include "ARCH/CBMIMO1/DEVICE_DRIVER/cbmimo1_device.h"
#include "ARCH/CBMIMO1/DEVICE_DRIVER/defs.h"
#include "ARCH/CBMIMO1/DEVICE_DRIVER/extern.h"
#include "ARCH/CBMIMO1/DEVICE_DRIVER/cbmimo1_pci.h"
//#include "pci_commands.h"
#endif //CBMIMO1
/*! /*!
* @addtogroup _PHY_STRUCTURES_ * @addtogroup _PHY_STRUCTURES_
* Memory Initializaion and Cleanup for LTE MODEM. * Memory Initializaion and Cleanup for LTE MODEM.
@@ -56,357 +46,6 @@
//#define DEBUG_PHY //#define DEBUG_PHY
/*
#ifndef USER_MODE
#include "SCHED/defs.h"
#endif //USER_MODE
*/
#ifndef USER_MODE
dma_addr_t dma_handle[4];
// Get from HW addresses
int init_signal_buffers(LTE_DL_FRAME_PARMS *frame_parms)
{
unsigned char card_id,i;
int *tmp_ptr;
mod_sym_t *tmp_ptr_tx;
unsigned int tx_dma_buffer_size_bytes;
for (card_id=0; card_id<number_of_cards; card_id++) {
for (i=0; i<NB_ANTENNAS_TX; i++) {
// Allocate memory for TX DMA Buffer
#ifdef IFFT_FPGA
tx_dma_buffer_size_bytes = NUMBER_OF_USEFUL_CARRIERS*NUMBER_OF_SYMBOLS_PER_FRAME*sizeof(mod_sym_t);
#else
#ifdef BIT8_TX
tx_dma_buffer_size_bytes = FRAME_LENGTH_BYTES>>1;
#else
tx_dma_buffer_size_bytes = FRAME_LENGTH_BYTES;
#endif
#endif
tmp_ptr_tx = (mod_sym_t *)bigmalloc16(tx_dma_buffer_size_bytes+2*PAGE_SIZE);
if (tmp_ptr_tx==NULL) {
msg("[PHY][INIT] Could not allocate TX_DMA %d (%x bytes)\n",i,
(unsigned int)(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(mod_sym_t) + 2*PAGE_SIZE));
return(-1);
} else {
bzero(tmp_ptr_tx,tx_dma_buffer_size_bytes+2*PAGE_SIZE);
pci_buffer[card_id][(2*i)] = (unsigned int)tmp_ptr_tx;
tmp_ptr_tx = (mod_sym_t*)(((unsigned int)tmp_ptr_tx + PAGE_SIZE -1) & PAGE_MASK);
// reserve_mem(tmp_ptr_tx,FRAME_LENGTH_BYTES+2*PAGE_SIZE);
#ifdef DEBUG_PHY
msg("[PHY][INIT] TX_DMA_BUFFER %d at %p (%p), size 0x%x\n",i,
(void *)tmp_ptr_tx,
(void *)virt_to_phys(tmp_ptr_tx),
(unsigned int)(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(mod_sym_t)+2*PAGE_SIZE));
#endif
}
TX_DMA_BUFFER[card_id][i] = (int) tmp_ptr_tx;
}
for (i=0; i<NB_ANTENNAS_RX; i++) {
// RX DMA Buffers
tmp_ptr = (int *)bigmalloc16(FRAME_LENGTH_BYTES+OFDM_SYMBOL_SIZE_BYTES+2*PAGE_SIZE);
if (tmp_ptr==NULL) {
#ifdef DEBUG_PHY
msg("[PHY][INIT] Could not allocate RX_DMA %d (%x bytes)\n",i,
FRAME_LENGTH_BYTES+2*OFDM_SYMBOL_SIZE_BYTES + 2*PAGE_SIZE);
#endif
return(-1);
} else {
bzero(tmp_ptr,FRAME_LENGTH_BYTES+OFDM_SYMBOL_SIZE_BYTES+2*PAGE_SIZE);
pci_buffer[card_id][1+(2*i)] = (int) tmp_ptr;
tmp_ptr = (int*) (((unsigned long)tmp_ptr + PAGE_SIZE -1) & PAGE_MASK);
// reserve_mem(tmp_ptr,FRAME_LENGTH_BYTES+2*PAGE_SIZE);
#ifdef DEBUG_PHY
msg("[PHY][INIT] RX_DMA_BUFFER %d at %p (%p), size 0x%x\n",i,
(void *)tmp_ptr,
(void *)virt_to_phys(tmp_ptr),(unsigned int)(FRAME_LENGTH_BYTES+OFDM_SYMBOL_SIZE_BYTES+2*PAGE_SIZE));
#endif
}
RX_DMA_BUFFER[card_id][i] = (int) tmp_ptr;
}
}
#ifndef NOCARD_TEST
for (card_id=0; card_id<number_of_cards; card_id++) {
// Allocate memory for PCI interface and store pointers to dma buffers
if (vid != XILINX_VENDOR) {
msg("[PHY][INIT] Setting up Leon PCI interface structure\n");
pci_interface[card_id] = (PCI_interface_t *)bigmalloc16(sizeof(PCI_interface_t));
msg("[PHY][INIT] PCI interface %d at %p\n",card_id,pci_interface[card_id]);
openair_writel(pdev[card_id],FROM_GRLIB_CFG_GRPCI_EUR_CTRL0_OFFSET+4,(unsigned int)virt_to_phys((volatile void*)pci_interface[card_id]));
for (i=0; i<NB_ANTENNAS_RX; i++) {
pci_interface[card_id]->adc_head[i] = (unsigned int)virt_to_phys((volatile void*)RX_DMA_BUFFER[card_id][i]);
pci_interface[card_id]->dac_head[i] = (unsigned int)virt_to_phys((volatile void*)TX_DMA_BUFFER[card_id][i]);
}
mbox = (unsigned int)(&pci_interface[0]->adac_cnt);
msg("[PHY][INIT] mbox = %p\n",mbox);
} else {
msg("[PHY][INIT] PCIe interface %d at %p\n",card_id,exmimo_pci_interface);
// openair_writel(pdev[card_id],FROM_GRLIB_CFG_GRPCI_EUR_CTRL0_OFFSET+4,(unsigned int)virt_to_phys((volatile void*)pci_interface[card_id]));
DAQ_MBOX = (unsigned int)bigmalloc16(16);
exmimo_pci_interface->rf.mbox = (unsigned int)virt_to_phys((volatile void*)DAQ_MBOX);
for (i=0; i<NB_ANTENNAS_RX; i++) {
exmimo_pci_interface->rf.adc_head[i] = (unsigned int)virt_to_phys((volatile void*)RX_DMA_BUFFER[card_id][i]);
exmimo_pci_interface->rf.dac_head[i] = (unsigned int)virt_to_phys((volatile void*)TX_DMA_BUFFER[card_id][i]);
}
}
}
#endif //NOCARD_TEST
return(0);
}
#endif // USER_MODE
/*
int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms) {
if (frame_parms->Ncp==1) {
frame_parms->nb_prefix_samples0=512;
frame_parms->nb_prefix_samples = 512;
frame_parms->symbols_per_tti = 12;
}
else {
frame_parms->nb_prefix_samples0 = 160;
frame_parms->nb_prefix_samples = 144;
frame_parms->symbols_per_tti = 14;
}
switch (frame_parms->N_RB_DL) {
case 100:
frame_parms->ofdm_symbol_size = 2048;
frame_parms->log2_symbol_size = 11;
frame_parms->samples_per_tti = 30720;
frame_parms->first_carrier_offset = 1448;
break;
case 50:
frame_parms->ofdm_symbol_size = 1024;
frame_parms->log2_symbol_size = 10;
frame_parms->samples_per_tti = 15360;
frame_parms->first_carrier_offset = 724;
frame_parms->nb_prefix_samples>>=1;
frame_parms->nb_prefix_samples0>>=1;
break;
case 25:
frame_parms->ofdm_symbol_size = 512;
frame_parms->log2_symbol_size = 9;
frame_parms->samples_per_tti = 7680;
frame_parms->first_carrier_offset = 362;
frame_parms->nb_prefix_samples>>=2;
frame_parms->nb_prefix_samples0>>=2;
break;
case 15:
frame_parms->ofdm_symbol_size = 256;
frame_parms->log2_symbol_size = 8;
frame_parms->samples_per_tti = 3840;
frame_parms->first_carrier_offset = 166;
frame_parms->nb_prefix_samples>>=3;
frame_parms->nb_prefix_samples0>>=1;
break;
case 6:
frame_parms->ofdm_symbol_size = 128;
frame_parms->log2_symbol_size = 7;
frame_parms->samples_per_tti = 1920;
frame_parms->first_carrier_offset = 92;
frame_parms->nb_prefix_samples>>=4;
frame_parms->nb_prefix_samples0>>=1;
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);
return(-1);
break;
}
// frame_parms->tdd_config=3;
return(0);
}
*/
int phy_init_top(LTE_DL_FRAME_PARMS *frame_parms)
{
// bzero((void *)PHY_vars,sizeof(PHY_VARS));
LOG_I(PHY,"[INIT] OFDM size : %d\n",NUMBER_OF_OFDM_CARRIERS);
LOG_I(PHY,"[INIT] FRAME_LENGTH_SAMPLES : %d\n",FRAME_LENGTH_SAMPLES);
LOG_I(PHY,"[INIT] NUMBER_OF_SYMBOLS_PER_FRAME : %d\n",NUMBER_OF_SYMBOLS_PER_FRAME);
LOG_I(PHY,"[INIT] Initializing FFT engine using %d point fft (%d, %p)\n",NUMBER_OF_OFDM_CARRIERS,LOG2_NUMBER_OF_OFDM_CARRIERS,rev );
#ifndef USER_MODE
init_signal_buffers(frame_parms);
#endif
// Initialize fft variables
init_fft(NUMBER_OF_OFDM_CARRIERS,LOG2_NUMBER_OF_OFDM_CARRIERS,rev); // TX/RX
init_fft(4*NUMBER_OF_OFDM_CARRIERS,2+LOG2_NUMBER_OF_OFDM_CARRIERS,rev_times4); // Synch
init_fft(NUMBER_OF_OFDM_CARRIERS/2,LOG2_NUMBER_OF_OFDM_CARRIERS-1,rev_half); // for interpolation of channel est
init_fft(8192,13,rev8192);
init_fft(4096,12,rev4096);
init_fft(2048,11,rev2048);
init_fft(1024,10,rev1024);
init_fft(512,9,rev512);
twiddle_fft = (short *)malloc16(4095*4*2);
twiddle_ifft = (short *)malloc16(4095*4*2);
twiddle_fft_times4 = (short*)malloc16(4095*4*2);
twiddle_ifft_times4 = (short*)malloc16(4095*4*2);
twiddle_fft_half = (short*)malloc16(4095*4*2);
twiddle_ifft_half = (short*)malloc16(4095*4*2);
LOG_I(PHY,"[INIT] twiddle_fft= %p, twiddle_ifft=%p, twiddle_fft_times4=%p,twiddle_ifft_times4=%p\n",
(void *)twiddle_fft,(void *)twiddle_ifft,(void *)twiddle_fft_times4,(void *)twiddle_ifft_times4);
switch (NUMBER_OF_OFDM_CARRIERS) {
case 64:
memcpy(twiddle_fft,&twiddle_fft64[0],63*4*2);
memcpy(twiddle_ifft,&twiddle_ifft64[0],63*4*2);
memcpy(twiddle_fft_times4,&twiddle_fft256[0],255*4*2);
memcpy(twiddle_ifft_times4,&twiddle_ifft256[0],255*4*2);
//memcpy(twiddle_fft_half,&twiddle_fft32[0],31*4*2);
//memcpy(twiddle_ifft_half,&twiddle_ifft32[0],31*4*2);
break;
case 128:
memcpy(twiddle_fft,&twiddle_fft128[0],127*4*2);
memcpy(twiddle_ifft,&twiddle_ifft128[0],127*4*2);
memcpy(twiddle_fft_times4,&twiddle_fft512[0],511*4*2);
memcpy(twiddle_ifft_times4,&twiddle_ifft512[0],511*4*2);
memcpy(twiddle_fft_half,&twiddle_fft64[0],63*4*2);
memcpy(twiddle_ifft_half,&twiddle_ifft64[0],63*4*2);
break;
case 256:
memcpy(twiddle_fft,&twiddle_fft256[0],255*4*2);
memcpy(twiddle_ifft,&twiddle_ifft256[0],255*4*2);
memcpy(twiddle_fft_times4,&twiddle_fft1024[0],1023*4*2);
memcpy(twiddle_ifft_times4,&twiddle_ifft1024[0],1023*4*2);
memcpy(twiddle_fft_half,&twiddle_fft128[0],127*4*2);
memcpy(twiddle_ifft_half,&twiddle_ifft128[0],127*4*2);
break;
case 512:
memcpy(twiddle_fft,&twiddle_fft512[0],511*4*2);
memcpy(twiddle_ifft,&twiddle_ifft512[0],511*4*2);
memcpy(twiddle_fft_times4,&twiddle_fft2048[0],2047*4*2);
memcpy(twiddle_ifft_times4,&twiddle_ifft2048[0],2047*4*2);
memcpy(twiddle_fft_half,&twiddle_fft256[0],255*4*2);
memcpy(twiddle_ifft_half,&twiddle_ifft256[0],255*4*2);
break;
case 1024:
memcpy(twiddle_fft,&twiddle_fft1024[0],1023*4*2);
memcpy(twiddle_ifft,&twiddle_ifft1024[0],1023*4*2);
memcpy(twiddle_fft_times4,&twiddle_fft4096[0],4095*4*2);
memcpy(twiddle_ifft_times4,&twiddle_ifft4096[0],4095*4*2);
memcpy(twiddle_fft_half,&twiddle_fft512[0],511*4*2);
memcpy(twiddle_ifft_half,&twiddle_ifft512[0],511*4*2);
break;
case 2048:
memcpy(twiddle_fft,&twiddle_fft2048[0],2047*4*2);
memcpy(twiddle_ifft,&twiddle_ifft2048[0],2047*4*2);
memcpy(twiddle_fft_times4,&twiddle_fft8192[0],8191*4*2);
memcpy(twiddle_ifft_times4,&twiddle_ifft8192[0],8191*4*2);
memcpy(twiddle_fft_half,&twiddle_fft1024[0],1023*4*2);
memcpy(twiddle_ifft_half,&twiddle_ifft1024[0],1023*4*2);
break;
default:
memcpy(twiddle_fft,&twiddle_fft64[0],63*4*2);
memcpy(twiddle_ifft,&twiddle_ifft64[0],63*4*2);
memcpy(twiddle_fft_times4,&twiddle_fft256[0],255*4*2);
memcpy(twiddle_ifft_times4,&twiddle_ifft256[0],255*4*2);
//memcpy(twiddle_fft_half,&twiddle_fft32[0],31*4*2);
//memcpy(twiddle_ifft_half,&twiddle_ifft32[0],31*4*2);
break;
}
frame_parms->twiddle_fft = twiddle_fft;
frame_parms->twiddle_ifft = twiddle_ifft;
frame_parms->rev = rev;
return(1);
}
void phy_cleanup(void)
{
#ifndef USER_MODE
unsigned int dummy_ptr;
unsigned char card_id,i;
#endif //USER_MODE
// stop PHY_thread
LOG_I(PHY,"[INIT] cleanup\n");
#ifndef USER_MODE
for (card_id=0; card_id<number_of_cards; card_id++) {
for (i=0; i<NB_ANTENNAS_RX; i++) {
if (pci_buffer[card_id][2*i]) {
#ifdef DEBUG_PHY
msg("[openair][PHY][INIT] pci_buffer card %d %d\n",card_id,2*i);
#endif
bigfree(pci_buffer[card_id][2*i],FRAME_LENGTH_BYTES+2*PAGE_SIZE);
// free_pages(pci_buffer[2*i],8);
#ifdef DEBUG_PHY
msg("[openair][PHY][INIT] Freed TX_DMA_BUFFER %d\n",i);
#endif
}
if (pci_buffer[card_id][1+(2*i)]) {
#ifdef DEBUG_PHY
msg("[openair][PHY][INIT] pci_buffer %d %d\n",card_id,1+(2*i));
#endif
dummy_ptr = virt_to_phys(pci_buffer[card_id][1+(2*i)]);
bigfree(pci_buffer[card_id][1+(2*i)],FRAME_LENGTH_BYTES+2*PAGE_SIZE);
// free_pages(pci_buffer[1+(2*i)],8);
#ifdef DEBUG_PHY
msg("[openair][PHY][INIT] Freed RX_DMA_BUFFER %d\n",i);
#endif
}
}
}
#else
// Do USER_MODE cleanup here
#endif // USER_MODE
msg("[openair][CLEANUP] Done!\n");
}
/* /*
+24 -10
View File
@@ -133,14 +133,28 @@ int lte_est_timing_advance(LTE_DL_FRAME_PARMS *frame_parms,
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) { for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
// do ifft of channel estimate // do ifft of channel estimate
fft((short*) &lte_eNb_srs->srs_ch_estimates[ind][aa][0], switch(frame_parms->N_RB_DL) {
(short*) lte_eNb_srs->srs_ch_estimates_time[ind][aa], case 6:
frame_parms->twiddle_ifft, dft128((int16_t*) &lte_eNb_srs->srs_ch_estimates[ind][aa][0],
frame_parms->rev, (int16_t*) lte_eNb_srs->srs_ch_estimates_time[ind][aa],
frame_parms->log2_symbol_size, 1);
frame_parms->log2_symbol_size/2, break;
0); case 25:
dft512((int16_t*) &lte_eNb_srs->srs_ch_estimates[ind][aa][0],
(int16_t*) lte_eNb_srs->srs_ch_estimates_time[ind][aa],
1);
break;
case 50:
dft1024((int16_t*) &lte_eNb_srs->srs_ch_estimates[ind][aa][0],
(int16_t*) lte_eNb_srs->srs_ch_estimates_time[ind][aa],
1);
break;
case 100:
dft2048((int16_t*) &lte_eNb_srs->srs_ch_estimates[ind][aa][0],
(int16_t*) lte_eNb_srs->srs_ch_estimates_time[ind][aa],
1);
break;
}
#ifdef USER_MODE #ifdef USER_MODE
#ifdef DEBUG_PHY #ifdef DEBUG_PHY
sprintf(fname,"srs_ch_estimates_time_%d%d.m",ind,aa); sprintf(fname,"srs_ch_estimates_time_%d%d.m",ind,aa);
@@ -156,8 +170,8 @@ int lte_est_timing_advance(LTE_DL_FRAME_PARMS *frame_parms,
temp = 0; temp = 0;
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) { for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
Re = ((int16_t*)lte_eNb_srs->srs_ch_estimates_time[ind][aa])[(i<<2)]; Re = ((int16_t*)lte_eNb_srs->srs_ch_estimates_time[ind][aa])[(i<<1)];
Im = ((int16_t*)lte_eNb_srs->srs_ch_estimates_time[ind][aa])[1+(i<<2)]; Im = ((int16_t*)lte_eNb_srs->srs_ch_estimates_time[ind][aa])[1+(i<<1)];
temp += (Re*Re/2) + (Im*Im/2); temp += (Re*Re/2) + (Im*Im/2);
} }
@@ -752,14 +752,36 @@ int lte_dl_mbsfn_channel_estimation(PHY_VARS_UE *phy_vars_ue,
// do ifft of channel estimate // do ifft of channel estimate
for (aa=0; aa<phy_vars_ue->lte_frame_parms.nb_antennas_rx*phy_vars_ue->lte_frame_parms.nb_antennas_tx; aa++) { for (aa=0; aa<phy_vars_ue->lte_frame_parms.nb_antennas_rx*phy_vars_ue->lte_frame_parms.nb_antennas_tx; aa++) {
if (phy_vars_ue->lte_ue_common_vars.dl_ch_estimates[eNB_offset][aa]) if (phy_vars_ue->lte_ue_common_vars.dl_ch_estimates[eNB_offset][aa]) {
fft((short*) &phy_vars_ue->lte_ue_common_vars.dl_ch_estimates[eNB_offset][aa][LTE_CE_OFFSET], switch (phy_vars_ue->lte_frame_parms.N_RB_DL) {
(short*) phy_vars_ue->lte_ue_common_vars.dl_ch_estimates_time[eNB_offset][aa], case 6:
phy_vars_ue->lte_frame_parms.twiddle_ifft, idft128((int16_t*) &phy_vars_ue->lte_ue_common_vars.dl_ch_estimates[eNB_offset][aa][LTE_CE_OFFSET],
phy_vars_ue->lte_frame_parms.rev, (int16_t*) phy_vars_ue->lte_ue_common_vars.dl_ch_estimates_time[eNB_offset][aa],
phy_vars_ue->lte_frame_parms.log2_symbol_size, 1);
phy_vars_ue->lte_frame_parms.log2_symbol_size/2, break;
0); case 25:
idft512((int16_t*) &phy_vars_ue->lte_ue_common_vars.dl_ch_estimates[eNB_offset][aa][LTE_CE_OFFSET],
(int16_t*) phy_vars_ue->lte_ue_common_vars.dl_ch_estimates_time[eNB_offset][aa],
1);
break;
case 50:
idft1024((int16_t*) &phy_vars_ue->lte_ue_common_vars.dl_ch_estimates[eNB_offset][aa][LTE_CE_OFFSET],
(int16_t*) phy_vars_ue->lte_ue_common_vars.dl_ch_estimates_time[eNB_offset][aa],
1);
break;
case 75:
idft1536((int16_t*) &phy_vars_ue->lte_ue_common_vars.dl_ch_estimates[eNB_offset][aa][LTE_CE_OFFSET],
(int16_t*) phy_vars_ue->lte_ue_common_vars.dl_ch_estimates_time[eNB_offset][aa]);
break;
case 100:
idft2048((int16_t*) &phy_vars_ue->lte_ue_common_vars.dl_ch_estimates[eNB_offset][aa][LTE_CE_OFFSET],
(int16_t*) phy_vars_ue->lte_ue_common_vars.dl_ch_estimates_time[eNB_offset][aa],
1);
break;
default:
break;
}
}
} }
return(0); return(0);
+97 -20
View File
@@ -156,17 +156,46 @@ int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *com
} }
} }
fft((short*)syncF_tmp, /// complex input switch (frame_parms->N_RB_DL) {
(short*)sync_tmp, /// complex output case 6:
idft128((short*)syncF_tmp, /// complex input
(short*)sync_tmp, /// complex output
1);
break;
case 25:
idft512((short*)syncF_tmp, /// complex input
(short*)sync_tmp, /// complex output
1);
break;
case 50:
idft1024((short*)syncF_tmp, /// complex input
(short*)sync_tmp, /// complex output
1);
break;
case 75:
idft1536((short*)syncF_tmp, /// complex input
(short*)sync_tmp); /// complex output
break;
case 100:
idft2048((short*)syncF_tmp, /// complex input
(short*)sync_tmp, /// complex output
1);
break;
default:
LOG_E(PHY,"Unsupported N_RB_DL %d\n",frame_parms->N_RB_DL);
break;
}
/*
frame_parms->twiddle_ifft, /// complex twiddle factors frame_parms->twiddle_ifft, /// complex twiddle factors
frame_parms->rev, /// bit reversed permutation vector frame_parms->rev, /// bit reversed permutation vector
frame_parms->log2_symbol_size,/// log2(FFT_SIZE) frame_parms->log2_symbol_size,/// log2(FFT_SIZE)
(frame_parms->log2_symbol_size/2), (frame_parms->log2_symbol_size/2),
0); /// 0 - input is in complex Q1.15 format, 1 - input is in complex redundant Q1.15 format) 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++) for (i=0; i<frame_parms->ofdm_symbol_size; i++)
((int32_t*)primary_synch0_time)[i] = sync_tmp[2*i]; ((int32_t*)primary_synch0_time)[i] = sync_tmp[i];
k=frame_parms->ofdm_symbol_size-36; k=frame_parms->ofdm_symbol_size-36;
@@ -181,16 +210,40 @@ int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *com
} }
} }
fft((short*)syncF_tmp, /// complex input switch (frame_parms->N_RB_DL) {
(short*)sync_tmp, /// complex output case 6:
frame_parms->twiddle_ifft, /// complex twiddle factors idft128((short*)syncF_tmp, /// complex input
frame_parms->rev, /// bit reversed permutation vector (short*)sync_tmp, /// complex output
frame_parms->log2_symbol_size,/// log2(FFT_SIZE) 1);
frame_parms->log2_symbol_size/2, break;
0) ; /// 0 - input is in complex Q1.15 format, 1 - input is in complex redundant Q1.15 format) case 25:
idft512((short*)syncF_tmp, /// complex input
(short*)sync_tmp, /// complex output
1);
break;
case 50:
idft1024((short*)syncF_tmp, /// complex input
(short*)sync_tmp, /// complex output
1);
break;
case 75:
idft1536((short*)syncF_tmp, /// complex input
(short*)sync_tmp /// complex output
);
break;
case 100:
idft2048((short*)syncF_tmp, /// complex input
(short*)sync_tmp, /// complex output
1);
break;
default:
LOG_E(PHY,"Unsupported N_RB_DL %d\n",frame_parms->N_RB_DL);
break;
}
for (i=0; i<frame_parms->ofdm_symbol_size; i++) for (i=0; i<frame_parms->ofdm_symbol_size; i++)
((int32_t*)primary_synch1_time)[i] = sync_tmp[2*i]; ((int32_t*)primary_synch1_time)[i] = sync_tmp[i];
k=frame_parms->ofdm_symbol_size-36; k=frame_parms->ofdm_symbol_size-36;
@@ -205,16 +258,40 @@ int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *com
} }
} }
fft((short*)syncF_tmp, /// complex input switch (frame_parms->N_RB_DL) {
(short*)sync_tmp, /// complex output case 6:
frame_parms->twiddle_ifft, /// complex twiddle factors idft128((short*)syncF_tmp, /// complex input
frame_parms->rev, /// bit reversed permutation vector (short*)sync_tmp, /// complex output
frame_parms->log2_symbol_size,/// log2(FFT_SIZE) 1);
frame_parms->log2_symbol_size/2, break;
0); /// 0 - input is in complex Q1.15 format, 1 - input is in complex redundant Q1.15 format) case 25:
idft512((short*)syncF_tmp, /// complex input
(short*)sync_tmp, /// complex output
1);
break;
case 50:
idft1024((short*)syncF_tmp, /// complex input
(short*)sync_tmp, /// complex output
1);
break;
case 75:
idft1536((short*)syncF_tmp, /// complex input
(short*)sync_tmp /// complex output
);
break;
case 100:
idft2048((short*)syncF_tmp, /// complex input
(short*)sync_tmp, /// complex output
1);
break;
default:
LOG_E(PHY,"Unsupported N_RB_DL %d\n",frame_parms->N_RB_DL);
break;
}
for (i=0; i<frame_parms->ofdm_symbol_size; i++) for (i=0; i<frame_parms->ofdm_symbol_size; i++)
((int32_t*)primary_synch2_time)[i] = sync_tmp[2*i]; ((int32_t*)primary_synch2_time)[i] = sync_tmp[i];
@@ -87,7 +87,7 @@ void lte_sync_timefreq(PHY_VARS_UE *ue,int band,unsigned int DL_freq)
while (1) { while (1) {
//compute frequency-domain representation of 6144-sample chunk //compute frequency-domain representation of 6144-sample chunk
fft6144((int16_t *)rxp, dft6144((int16_t *)rxp,
sp); sp);
@@ -245,35 +245,38 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *phy_vars_eNB,
//copy MIMO channel estimates to temporary buffer for EMOS //copy MIMO channel estimates to temporary buffer for EMOS
//memcpy(&ul_ch_estimates_0[aa][symbol_offset],&ul_ch_estimates[aa][symbol_offset],frame_parms->ofdm_symbol_size*sizeof(int32_t)*2); //memcpy(&ul_ch_estimates_0[aa][symbol_offset],&ul_ch_estimates[aa][symbol_offset],frame_parms->ofdm_symbol_size*sizeof(int32_t)*2);
memset(temp_in_ifft_0,0,frame_parms->ofdm_symbol_size*sizeof(int32_t)*2); memset(temp_in_ifft_0,0,frame_parms->ofdm_symbol_size*sizeof(int32_t));
// Convert to time domain for visualization // Convert to time domain for visualization
for(i=0; i<Msc_RS; i++) for(i=0; i<Msc_RS; i++)
((int32_t*)temp_in_ifft_0)[i] = ul_ch_estimates[aa][symbol_offset+i]; ((int32_t*)temp_in_ifft_0)[i] = ul_ch_estimates[aa][symbol_offset+i];
switch(frame_parms->N_RB_DL) {
case 6:
fft( (int16_t*) temp_in_ifft_0, dft128((int16_t*) temp_in_ifft_0,
(int16_t*) ul_ch_estimates_time[aa], (int16_t*) ul_ch_estimates_time[aa],
frame_parms->twiddle_ifft, 1);
frame_parms->rev, break;
(frame_parms->log2_symbol_size), case 25:
(frame_parms->log2_symbol_size)/2,
0);
/* dft512((int16_t*) temp_in_ifft_0,
// zero out second half of time domain channel estimate and transform back (-16 because of the cyclic pre-causal part of the channel estimate) (int16_t*) ul_ch_estimates_time[aa],
for(j=frame_parms->ofdm_symbol_size-16;j<frame_parms->ofdm_symbol_size*2-16;j++){ 1);
ul_ch_estimates_time[aa][j] = 0; break;
case 50:
dft1024((int16_t*) temp_in_ifft_0,
(int16_t*) ul_ch_estimates_time[aa],
1);
break;
case 100:
dft2048((int16_t*) temp_in_ifft_0,
(int16_t*) ul_ch_estimates_time[aa],
1);
break;
} }
fft( (int16_t*) ul_ch_estimates_time[aa],
(int16_t*) &ul_ch_estimates[aa][symbol_offset],
frame_parms->twiddle_fft,
frame_parms->rev,
(frame_parms->log2_symbol_size),
(frame_parms->log2_symbol_size)/2,
1);
*/
#ifdef DEBUG_CH #ifdef DEBUG_CH
if (aa==0) { if (aa==0) {
@@ -336,25 +339,40 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *phy_vars_eNB,
i++; i++;
} }
switch (frame_parms->N_RB_DL) {
fft((int16_t*) &temp_in_ifft_0[0], // Performing IFFT on Combined Channel Estimates case 6:
temp_out_ifft_0, idft128((int16_t*) &temp_in_ifft_0[0], // Performing IFFT on Combined Channel Estimates
frame_parms->twiddle_ifft, temp_out_ifft_0,
frame_parms->rev, 1);
(frame_parms->log2_symbol_size), idft128((int16_t*) &temp_in_ifft_1[0], // Performing IFFT on Combined Channel Estimates
(frame_parms->log2_symbol_size)/2, temp_out_ifft_1,
0); 1);
break;
fft((int16_t*) &temp_in_ifft_1[0], // Performing IFFT on Combined Channel Estimates case 25:
temp_out_ifft_1, idft512((int16_t*) &temp_in_ifft_0[0], // Performing IFFT on Combined Channel Estimates
frame_parms->twiddle_ifft, temp_out_ifft_0,
frame_parms->rev, 1);
(frame_parms->log2_symbol_size), idft512((int16_t*) &temp_in_ifft_1[0], // Performing IFFT on Combined Channel Estimates
(frame_parms->log2_symbol_size)/2, temp_out_ifft_1,
0); 1);
break;
case 50:
idft1024((int16_t*) &temp_in_ifft_0[0], // Performing IFFT on Combined Channel Estimates
temp_out_ifft_0,
1);
idft1024((int16_t*) &temp_in_ifft_1[0], // Performing IFFT on Combined Channel Estimates
temp_out_ifft_1,
1);
break;
case 100:
idft2048((int16_t*) &temp_in_ifft_0[0], // Performing IFFT on Combined Channel Estimates
temp_out_ifft_0,
1);
idft2048((int16_t*) &temp_in_ifft_1[0], // Performing IFFT on Combined Channel Estimates
temp_out_ifft_1,
1);
break;
}
// because the ifft is not power preserving, we should apply the factor sqrt(power_correction) here, but we rather apply power_correction here and nothing after the next fft // because the ifft is not power preserving, we should apply the factor sqrt(power_correction) here, but we rather apply power_correction here and nothing after the next fft
in_fft_ptr_0 = &temp_in_fft_0[0]; in_fft_ptr_0 = &temp_in_fft_0[0];
@@ -362,26 +380,44 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *phy_vars_eNB,
for(j=0; j<(1<<(frame_parms->log2_symbol_size))/12; j++) { for(j=0; j<(1<<(frame_parms->log2_symbol_size))/12; j++) {
if (j>19) { if (j>19) {
((int16_t*)in_fft_ptr_0)[-40+(2*j)] = ((int16_t*)temp_out_ifft_0)[-80+(4*j)]*rx_power_correction; ((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+(4*j+1)]*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;
((int16_t*)in_fft_ptr_1)[-40+(2*j)] = ((int16_t*)temp_out_ifft_1)[-80+(4*j)]*rx_power_correction; ((int16_t*)in_fft_ptr_1)[-40+(2*j)] = ((int16_t*)temp_out_ifft_1)[-80+(2*j)]*rx_power_correction;
((int16_t*)in_fft_ptr_1)[-40+(2*j)+1] = ((int16_t*)temp_out_ifft_1)[-80+(4*j)+1]*rx_power_correction; ((int16_t*)in_fft_ptr_1)[-40+(2*j)+1] = ((int16_t*)temp_out_ifft_1)[-80+(2*j)+1]*rx_power_correction;
} else { } else {
((int16_t*)in_fft_ptr_0)[2*(frame_parms->ofdm_symbol_size-20+j)] = ((int16_t*)temp_out_ifft_0)[4*(frame_parms->ofdm_symbol_size-20+j)]*rx_power_correction; ((int16_t*)in_fft_ptr_0)[2*(frame_parms->ofdm_symbol_size-20+j)] = ((int16_t*)temp_out_ifft_0)[2*(frame_parms->ofdm_symbol_size-20+j)]*rx_power_correction;
((int16_t*)in_fft_ptr_0)[2*(frame_parms->ofdm_symbol_size-20+j)+1] = ((int16_t*)temp_out_ifft_0)[4*(frame_parms->ofdm_symbol_size-20+j)+1]*rx_power_correction; ((int16_t*)in_fft_ptr_0)[2*(frame_parms->ofdm_symbol_size-20+j)+1] = ((int16_t*)temp_out_ifft_0)[2*(frame_parms->ofdm_symbol_size-20+j)+1]*rx_power_correction;
((int16_t*)in_fft_ptr_1)[2*(frame_parms->ofdm_symbol_size-20+j)] = ((int16_t*)temp_out_ifft_1)[4*(frame_parms->ofdm_symbol_size-20+j)]*rx_power_correction; ((int16_t*)in_fft_ptr_1)[2*(frame_parms->ofdm_symbol_size-20+j)] = ((int16_t*)temp_out_ifft_1)[2*(frame_parms->ofdm_symbol_size-20+j)]*rx_power_correction;
((int16_t*)in_fft_ptr_1)[2*(frame_parms->ofdm_symbol_size-20+j)+1] = ((int16_t*)temp_out_ifft_1)[4*(frame_parms->ofdm_symbol_size-20+j)+1]*rx_power_correction; ((int16_t*)in_fft_ptr_1)[2*(frame_parms->ofdm_symbol_size-20+j)+1] = ((int16_t*)temp_out_ifft_1)[2*(frame_parms->ofdm_symbol_size-20+j)+1]*rx_power_correction;
} }
} }
switch (frame_parms->N_RB_DL) {
fft((int16_t*) &temp_in_fft_0[0], // Performing FFT to obtain the Channel Estimates for UE0 to eNB1 case 6:
temp_out_fft_0, dft128((int16_t*) &temp_in_fft_0[0],
frame_parms->twiddle_fft, // Performing FFT to obtain the Channel Estimates for UE0 to eNB1
frame_parms->rev, temp_out_fft_0,
frame_parms->log2_symbol_size, 1);
frame_parms->log2_symbol_size>>1, break;
0); case 25:
dft512((int16_t*) &temp_in_fft_0[0],
// Performing FFT to obtain the Channel Estimates for UE0 to eNB1
temp_out_fft_0,
1);
break;
case 50:
dft1024((int16_t*) &temp_in_fft_0[0],
// Performing FFT to obtain the Channel Estimates for UE0 to eNB1
temp_out_fft_0,
1);
break;
case 100:
dft2048((int16_t*) &temp_in_fft_0[0],
// Performing FFT to obtain the Channel Estimates for UE0 to eNB1
temp_out_fft_0,
1);
break;
}
out_fft_ptr_0 = &ul_ch_estimates_0[aa][symbol_offset]; // CHANNEL ESTIMATES FOR UE0 TO eNB1 out_fft_ptr_0 = &ul_ch_estimates_0[aa][symbol_offset]; // CHANNEL ESTIMATES FOR UE0 TO eNB1
temp_out_fft_0_ptr = (int32_t*) temp_out_fft_0; temp_out_fft_0_ptr = (int32_t*) temp_out_fft_0;
@@ -389,17 +425,31 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *phy_vars_eNB,
i=0; i=0;
for(j=0; j<frame_parms->N_RB_UL*12; j++) { for(j=0; j<frame_parms->N_RB_UL*12; j++) {
out_fft_ptr_0[i] = temp_out_fft_0_ptr[2*j]; out_fft_ptr_0[i] = temp_out_fft_0_ptr[j];
i++; i++;
} }
switch (frame_parms->N_RB_DL) {
fft((int16_t*) &temp_in_fft_1[0], // Performing FFT to obtain the Channel Estimates for UE1 to eNB1 case 6:
temp_out_fft_1, dft128((int16_t*) &temp_in_fft_1[0], // Performing FFT to obtain the Channel Estimates for UE1 to eNB1
frame_parms->twiddle_fft, temp_out_fft_1,
frame_parms->rev, 1);
frame_parms->log2_symbol_size, break;
frame_parms->log2_symbol_size>>1, case 25:
0); dft512((int16_t*) &temp_in_fft_1[0], // Performing FFT to obtain the Channel Estimates for UE1 to eNB1
temp_out_fft_1,
1);
break;
case 50:
dft1024((int16_t*) &temp_in_fft_1[0], // Performing FFT to obtain the Channel Estimates for UE1 to eNB1
temp_out_fft_1,
1);
break;
case 100:
dft2048((int16_t*) &temp_in_fft_1[0], // Performing FFT to obtain the Channel Estimates for UE1 to eNB1
temp_out_fft_1,
1);
break;
}
out_fft_ptr_1 = &ul_ch_estimates_1[aa][symbol_offset]; // CHANNEL ESTIMATES FOR UE1 TO eNB1 out_fft_ptr_1 = &ul_ch_estimates_1[aa][symbol_offset]; // CHANNEL ESTIMATES FOR UE1 TO eNB1
temp_out_fft_1_ptr = (int32_t*) temp_out_fft_1; temp_out_fft_1_ptr = (int32_t*) temp_out_fft_1;
@@ -407,7 +457,7 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *phy_vars_eNB,
i=0; i=0;
for(j=0; j<frame_parms->N_RB_UL*12; j++) { for(j=0; j<frame_parms->N_RB_UL*12; j++) {
out_fft_ptr_1[i] = temp_out_fft_1_ptr[2*j]; out_fft_ptr_1[i] = temp_out_fft_1_ptr[j];
i++; i++;
} }
@@ -550,33 +600,9 @@ int32_t lte_ul_channel_estimation(PHY_VARS_eNB *phy_vars_eNB,
multadd_complex_vector_real_scalar((int16_t*) ul_ch2_1,SCALE,(int16_t*) ul_ch2_1,1,Msc_RS); multadd_complex_vector_real_scalar((int16_t*) ul_ch2_1,SCALE,(int16_t*) ul_ch2_1,1,Msc_RS);
} }
//write_output("drs_est.m","drsest",ul_ch_estimates[0],300*12,1,1);
/*if(cooperation_flag == 2)// For Distributed Alamouti
{
write_output("drs_est.m","drsest",ul_ch_estimates[0],300*12,1,1);
write_output("drs_est0.m","drsest0",ul_ch_estimates_0[0],300*12,1,1);
write_output("drs_est1.m","drsest1",ul_ch_estimates_1[0],300*12,1,1);
}*/
} //if (Ns&1) } //if (Ns&1)
/*
memset(temp_in_ifft_0,0,frame_parms->ofdm_symbol_size*sizeof(int32_t)*2);
// Convert to time domain for visualization
for(i=0;i<Msc_RS;i++)
((int32_t*)temp_in_ifft_0)[i] = ul_ch_estimates[aa][symbol_offset+i];
fft( (int16_t*) temp_in_ifft_0,
(Ns%2) ? ((int16_t*) ul_ch_estimates_time[aa]) : ((int16_t*) &ul_ch_estimates_time[aa][2*frame_parms->ofdm_symbol_size]),
frame_parms->twiddle_ifft,
frame_parms->rev,
(frame_parms->log2_symbol_size),
(frame_parms->log2_symbol_size)/2,
0);
*/
} //for(aa=... } //for(aa=...
} //if(l==... } //if(l==...
+53 -61
View File
@@ -840,19 +840,17 @@ int32_t generate_prach( PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id, uint8_t subfra
break; break;
} }
prach2 = prach+(Ncp<<1); prach2 = prach+(Ncp<<1);
// do IDFT // do IDFT
switch (phy_vars_ue->lte_frame_parms.N_RB_UL) { switch (phy_vars_ue->lte_frame_parms.N_RB_UL) {
case 6: case 6:
if (prach_fmt == 4) { if (prach_fmt == 4) {
fft(prachF,prach2,twiddle_ifft256,rev256,8,4,0); idft256(prachF,prach2,1);
//TODO: account for repeated format in fft output
memmove( prach, prach+512, Ncp<<2 ); memmove( prach, prach+512, Ncp<<2 );
prach_len = 256+Ncp; prach_len = 256+Ncp;
} else { } else {
ifft1536(prachF,prach2); idft1536(prachF,prach2);
memmove( prach, prach+3072, Ncp<<2 ); memmove( prach, prach+3072, Ncp<<2 );
prach_len = 1536+Ncp; prach_len = 1536+Ncp;
@@ -866,12 +864,12 @@ int32_t generate_prach( PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id, uint8_t subfra
case 15: case 15:
if (prach_fmt == 4) { if (prach_fmt == 4) {
fft(prachF,prach2,twiddle_ifft512,rev512,9,4,0); idft512(prachF,prach2,1);
//TODO: account for repeated format in fft output //TODO: account for repeated format in dft output
memmove( prach, prach+1024, Ncp<<2 ); memmove( prach, prach+1024, Ncp<<2 );
prach_len = 512+Ncp; prach_len = 512+Ncp;
} else { } else {
ifft3072(prachF,prach2); idft3072(prachF,prach2);
memmove( prach, prach+6144, Ncp<<2 ); memmove( prach, prach+6144, Ncp<<2 );
prach_len = 3072+Ncp; prach_len = 3072+Ncp;
@@ -886,12 +884,11 @@ int32_t generate_prach( PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id, uint8_t subfra
case 25: case 25:
default: default:
if (prach_fmt == 4) { if (prach_fmt == 4) {
fft(prachF,prach2,twiddle_ifft1024,rev1024,10,5,0); idft1024(prachF,prach2,1);
//TODO: account for repeated format in fft output
memmove( prach, prach+2048, Ncp<<2 ); memmove( prach, prach+2048, Ncp<<2 );
prach_len = 1024+Ncp; prach_len = 1024+Ncp;
} else { } else {
ifft6144(prachF,prach2); idft6144(prachF,prach2);
/*for (i=0;i<6144*2;i++) /*for (i=0;i<6144*2;i++)
prach2[i]<<=1;*/ prach2[i]<<=1;*/
memmove( prach, prach+12288, Ncp<<2 ); memmove( prach, prach+12288, Ncp<<2 );
@@ -907,12 +904,11 @@ int32_t generate_prach( PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id, uint8_t subfra
case 50: case 50:
if (prach_fmt == 4) { if (prach_fmt == 4) {
fft(prachF,prach2,twiddle_ifft2048,rev2048,11,5,0); idft2048(prachF,prach2,1);
//TODO: account for repeated format in fft output
memmove( prach, prach+4096, Ncp<<2 ); memmove( prach, prach+4096, Ncp<<2 );
prach_len = 2048+Ncp; prach_len = 2048+Ncp;
} else { } else {
ifft12288(prachF,prach2); idft12288(prachF,prach2);
memmove( prach, prach+24576, Ncp<<2 ); memmove( prach, prach+24576, Ncp<<2 );
prach_len = 12288+Ncp; prach_len = 12288+Ncp;
@@ -926,12 +922,12 @@ int32_t generate_prach( PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id, uint8_t subfra
case 75: case 75:
if (prach_fmt == 4) { if (prach_fmt == 4) {
ifft3072(prachF,prach2); idft3072(prachF,prach2);
//TODO: account for repeated format in fft output //TODO: account for repeated format in dft output
memmove( prach, prach+6144, Ncp<<2 ); memmove( prach, prach+6144, Ncp<<2 );
prach_len = 3072+Ncp; prach_len = 3072+Ncp;
} else { } else {
ifft18432(prachF,prach2); idft18432(prachF,prach2);
memmove( prach, prach+36864, Ncp<<2 ); memmove( prach, prach+36864, Ncp<<2 );
prach_len = 18432+Ncp; prach_len = 18432+Ncp;
@@ -945,12 +941,11 @@ int32_t generate_prach( PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id, uint8_t subfra
case 100: case 100:
if (prach_fmt == 4) { if (prach_fmt == 4) {
fft(prachF,prach2,twiddle_ifft4096,rev4096,12,6,0); idft4096(prachF,prach2,1);
//TODO: account for repeated format in fft output
memmove( prach, prach+8192, Ncp<<2 ); memmove( prach, prach+8192, Ncp<<2 );
prach_len = 4096+Ncp; prach_len = 4096+Ncp;
} else { } else {
ifft24576(prachF,prach2); idft24576(prachF,prach2);
memmove( prach, prach+49152, Ncp<<2 ); memmove( prach, prach+49152, Ncp<<2 );
prach_len = 24576+Ncp; prach_len = 24576+Ncp;
@@ -966,20 +961,11 @@ int32_t generate_prach( PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id, uint8_t subfra
//LOG_D(PHY,"prach_len=%d\n",prach_len); //LOG_D(PHY,"prach_len=%d\n",prach_len);
if (prach_fmt==4) { if (prach_fmt==4) {
//TODO: account for repeated format in fft output
LOG_E( PHY, "prach_fmt4 not fully implemented" ); LOG_E( PHY, "prach_fmt4 not fully implemented" );
mac_xface->macphy_exit("prach_fmt4 not fully implemented"); mac_xface->macphy_exit("prach_fmt4 not fully implemented");
return 0; // not reached return 0; // not reached
} else { } else {
#ifdef BIT8_TX #if defined(EXMIMO) || defined(OAI_USRP)
for (i=0; i<prach_len; i++) {
((int8_t*)(&phy_vars_ue->lte_ue_common_vars.txdata[aa][prach_start]))[2*i] = (int8_t)(prach[2*i]);
((int8_t*)(&phy_vars_ue->lte_ue_common_vars.txdata[aa][prach_start]))[2*i+1] = (int8_t)(prach[2*i+1]);
}
#else
#ifdef EXMIMO
int j; int j;
int overflow = prach_start + prach_len - LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*phy_vars_ue->lte_frame_parms.samples_per_tti; int overflow = prach_start + prach_len - LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*phy_vars_ue->lte_frame_parms.samples_per_tti;
LOG_D( PHY, "prach_start=%d, overflow=%d\n", prach_start, overflow ); LOG_D( PHY, "prach_start=%d, overflow=%d\n", prach_start, overflow );
@@ -1001,17 +987,22 @@ int32_t generate_prach( PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id, uint8_t subfra
((int16_t*)(&phy_vars_ue->lte_ue_common_vars.txdata[0][prach_start]))[2*i+1] = prach[2*i+1]; ((int16_t*)(&phy_vars_ue->lte_ue_common_vars.txdata[0][prach_start]))[2*i+1] = prach[2*i+1];
} }
#endif
#endif #endif
} }
#ifdef PRACH_DEBUG
write_output("prach_txF0.m","prachtxF0",prachF,prach_len-Ncp,1,1);
write_output("prach_tx0.m","prachtx0",prach+(Ncp<<1),prach_len-Ncp,1,1);
#endif
return signal_energy( (int*)prach, 256 ); return signal_energy( (int*)prach, 256 );
} }
__m128i mmtmpX0,mmtmpX1,mmtmpX2,mmtmpX3; __m128i mmtmpX0,mmtmpX1,mmtmpX2,mmtmpX3;
int16_t prach_ifft[4][1024*4]; int16_t prach_ifft[4][1024*2];
void rx_prach(PHY_VARS_eNB *phy_vars_eNB,uint8_t subframe,uint16_t *preamble_energy_list, uint16_t *preamble_delay_list, uint16_t Nf, uint8_t tdd_mapindex) void rx_prach(PHY_VARS_eNB *phy_vars_eNB,uint8_t subframe,uint16_t *preamble_energy_list, uint16_t *preamble_delay_list, uint16_t Nf, uint8_t tdd_mapindex)
@@ -1288,24 +1279,24 @@ void rx_prach(PHY_VARS_eNB *phy_vars_eNB,uint8_t subframe,uint16_t *preamble_ene
switch (phy_vars_eNB->lte_frame_parms.N_RB_UL) { switch (phy_vars_eNB->lte_frame_parms.N_RB_UL) {
case 6: case 6:
if (prach_fmt == 4) { if (prach_fmt == 4) {
fft(prach2,rxsigF[aa],twiddle_fft256,rev256,8,4,0); dft256(prach2,rxsigF[aa],1);
} else { } else {
fft1536(prach2,rxsigF[aa]); dft1536(prach2,rxsigF[aa]);
if (prach_fmt>1) if (prach_fmt>1)
fft1536(prach2+3072,rxsigF[aa]+3072); dft1536(prach2+3072,rxsigF[aa]+3072);
} }
break; break;
case 15: case 15:
if (prach_fmt == 4) { if (prach_fmt == 4) {
fft(prach2,rxsigF[aa],twiddle_fft512,rev512,9,4,0); dft256(prach2,rxsigF[aa],1);
} else { } else {
fft3072(prach2,rxsigF[aa]); dft3072(prach2,rxsigF[aa]);
if (prach_fmt>1) if (prach_fmt>1)
fft3072(prach2+6144,rxsigF[aa]+6144); dft3072(prach2+6144,rxsigF[aa]+6144);
} }
break; break;
@@ -1313,13 +1304,13 @@ void rx_prach(PHY_VARS_eNB *phy_vars_eNB,uint8_t subframe,uint16_t *preamble_ene
case 25: case 25:
default: default:
if (prach_fmt == 4) { if (prach_fmt == 4) {
fft(prach2,rxsigF[aa],twiddle_fft1024,rev1024,10,5,0); dft1024(prach2,rxsigF[aa],1);
fft_size = 1024; fft_size = 1024;
} else { } else {
fft6144(prach2,rxsigF[aa]); dft6144(prach2,rxsigF[aa]);
if (prach_fmt>1) if (prach_fmt>1)
fft6144(prach2+12288,rxsigF[aa]+12288); dft6144(prach2+12288,rxsigF[aa]+12288);
fft_size = 6144; fft_size = 6144;
} }
@@ -1328,48 +1319,47 @@ void rx_prach(PHY_VARS_eNB *phy_vars_eNB,uint8_t subframe,uint16_t *preamble_ene
case 50: case 50:
if (prach_fmt == 4) { if (prach_fmt == 4) {
fft(prach2,rxsigF[aa],twiddle_fft2048,rev2048,11,5,0); dft2048(prach2,rxsigF[aa],1);
} else { } else {
fft12288(prach2,rxsigF[aa]); dft12288(prach2,rxsigF[aa]);
if (prach_fmt>1) if (prach_fmt>1)
fft12288(prach2+24576,rxsigF[aa]+24576); dft12288(prach2+24576,rxsigF[aa]+24576);
} }
break; break;
case 75: case 75:
if (prach_fmt == 4) { if (prach_fmt == 4) {
fft3072(prach2,rxsigF[aa]); dft3072(prach2,rxsigF[aa]);
} else { } else {
fft18432(prach2,rxsigF[aa]); dft18432(prach2,rxsigF[aa]);
if (prach_fmt>1) if (prach_fmt>1)
fft18432(prach2+36864,rxsigF[aa]+36864); dft18432(prach2+36864,rxsigF[aa]+36864);
} }
break; break;
case 100: case 100:
if (prach_fmt == 4) { if (prach_fmt == 4) {
fft(prach2,rxsigF[aa],twiddle_fft4096,rev4096,12,6,0); dft4096(prach2,rxsigF[aa],1);
} else { } else {
fft24576(prach2,rxsigF[aa]); dft24576(prach2,rxsigF[aa]);
if (prach_fmt>1) if (prach_fmt>1)
fft24576(prach2+49152,rxsigF[aa]+49152); dft24576(prach2+49152,rxsigF[aa]+49152);
} }
break; break;
} }
memset( prachF, 0, sizeof(int16_t)*2*1024 ); memset( prachF, 0, sizeof(int16_t)*2*1024 );
#ifdef PRACH_DEBUG
write_output("prach_rx0.m","prach_rx0",prach[0],6144+792,1,1);
#endif
// write_output("prach_rx0.m","prach_rx0",prach[0],6144+792,1,1);
// write_output("prach_rx1.m","prach_rx1",prach[1],6144+792,1,1); // write_output("prach_rx1.m","prach_rx1",prach[1],6144+792,1,1);
//write_output("prach_rxF0.m","prach_rxF0",rxsigF[0],24576,1,1); // write_output("prach_rxF0.m","prach_rxF0",rxsigF[0],24576,1,1);
// write_output("prach_rxF1.m","prach_rxF1",rxsigF[1],6144,1,1); // write_output("prach_rxF1.m","prach_rxF1",rxsigF[1],6144,1,1);
// Do componentwise product with Xu* // Do componentwise product with Xu*
@@ -1401,18 +1391,20 @@ void rx_prach(PHY_VARS_eNB *phy_vars_eNB,uint8_t subframe,uint16_t *preamble_ene
// Now do IFFT of size 1024 (N_ZC=839) or 256 (N_ZC=139) // Now do IFFT of size 1024 (N_ZC=839) or 256 (N_ZC=139)
if (N_ZC == 839) { if (N_ZC == 839) {
log2_ifft_size = 10; log2_ifft_size = 10;
fft(prachF,prach_ifft[aa],twiddle_ifft1024,rev1024,10,10,0); idft1024(prachF,prach_ifft[aa],1);
} else { } else {
fft(prachF,prach_ifft[aa],twiddle_ifft256,rev256,8,8,0); idft256(prachF,prach_ifft[aa],1);
log2_ifft_size = 8; log2_ifft_size = 8;
} }
#ifdef PRACH_DEBUG
// write_output("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1); write_output("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1);
#endif
// write_output("prach_rxF_comp1.m","prach_rxF_comp1",prachF,1024,1,1); // write_output("prach_rxF_comp1.m","prach_rxF_comp1",prachF,1024,1,1);
}// antennas_rx }// antennas_rx
#ifdef PRACH_DEBUG
// write_output("prach_ifft0.m","prach_t0",prach_ifft[0],2048,1,1); write_output("prach_ifft0.m","prach_t0",prach_ifft[0],2048,1,1);
#endif
// write_output("prach_ifft1.m","prach_t1",prach_ifft[1],2048,1,1); // write_output("prach_ifft1.m","prach_t1",prach_ifft[1],2048,1,1);
} // new dft } // new dft
@@ -1425,7 +1417,7 @@ void rx_prach(PHY_VARS_eNB *phy_vars_eNB,uint8_t subframe,uint16_t *preamble_ene
lev = 0; lev = 0;
for (aa=0; aa<nb_ant_rx; aa++) { for (aa=0; aa<nb_ant_rx; aa++) {
lev += (int32_t)prach_ifft[aa][(preamble_shift2+i)<<2]*prach_ifft[aa][(preamble_shift2+i)<<2] + (int32_t)prach_ifft[aa][1+((preamble_shift2+i)<<2)]*prach_ifft[aa][1+((preamble_shift2+i)<<2)]; lev += (int32_t)prach_ifft[aa][(preamble_shift2+i)<<1]*prach_ifft[aa][(preamble_shift2+i)<<1] + (int32_t)prach_ifft[aa][1+((preamble_shift2+i)<<1)]*prach_ifft[aa][1+((preamble_shift2+i)<<1)];
} }
levdB = dB_fixed_times10(lev); levdB = dB_fixed_times10(lev);
+2 -2
View File
@@ -42,8 +42,8 @@
#include "LAYER2/MAC/extern.h" #include "LAYER2/MAC/extern.h"
//uint8_t ncs_cell[20][7]; //uint8_t ncs_cell[20][7];
//#define DEBUG_PUCCH_TX #define DEBUG_PUCCH_TX
//#define DEBUG_PUCCH_RX #define DEBUG_PUCCH_RX
int16_t cfo_pucch_np[24*7] = {20787,-25330,27244,-18205,31356,-9512,32767,0,31356,9511,27244,18204,20787,25329, int16_t cfo_pucch_np[24*7] = {20787,-25330,27244,-18205,31356,-9512,32767,0,31356,9511,27244,18204,20787,25329,
27244,-18205,30272,-12540,32137,-6393,32767,0,32137,6392,30272,12539,27244,18204, 27244,-18205,30272,-12540,32137,-6393,32767,0,32137,6392,30272,12539,27244,18204,
+1 -5
View File
@@ -34,7 +34,7 @@
*/ */
/** /**
\fn void PHY_ofdm_mod(int *input,int *output,unsigned char log2fftsize,unsigned char nb_symbols,unsigned short nb_prefix_samples,short *twiddle_ifft,unsigned short *rev,Extension_t etype) \fn void PHY_ofdm_mod(int *input,int *output,unsigned char log2fftsize,unsigned char nb_symbols,unsigned short nb_prefix_samples,Extension_t etype)
This function performs OFDM modulation with cyclic extension or zero-padding. 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 input The sequence input samples in the frequency-domain. This is a concatenation of the input symbols in SIMD redundant format
@@ -42,8 +42,6 @@ This function performs OFDM modulation with cyclic extension or zero-padding.
@param log2fftsize Base-2 logarithm of the OFDM symbol size (\f$N_d\f$) @param log2fftsize Base-2 logarithm of the OFDM symbol size (\f$N_d\f$)
@param nb_symbols The number of OFDM symbols in the block @param nb_symbols The number of OFDM symbols in the block
@param nb_prefix_samples The number of prefix/suffix/zero samples @param nb_prefix_samples The number of prefix/suffix/zero samples
@param twiddle_ifft Pointer to the ifft twiddle factors
@param rev Pointer to the bit-reversal permutation
@param etype Type of extension (CYCLIC_PREFIX,CYCLIC_SUFFIX,ZEROS) @param etype Type of extension (CYCLIC_PREFIX,CYCLIC_SUFFIX,ZEROS)
*/ */
@@ -52,8 +50,6 @@ void PHY_ofdm_mod(int *input,
unsigned char log2fftsize, unsigned char log2fftsize,
unsigned char nb_symbols, unsigned char nb_symbols,
unsigned short nb_prefix_samples, unsigned short nb_prefix_samples,
short *twiddle_ifft,
unsigned short *rev,
Extension_t etype Extension_t etype
); );
-12
View File
@@ -66,8 +66,6 @@ void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRA
frame_parms->log2_symbol_size, // log2_fft_size frame_parms->log2_symbol_size, // log2_fft_size
1, // number of symbols 1, // number of symbols
frame_parms->nb_prefix_samples0, // number of prefix samples frame_parms->nb_prefix_samples0, // number of prefix samples
frame_parms->twiddle_ifft, // IFFT twiddle factors
frame_parms->rev, // bit-reversal permutation
CYCLIC_PREFIX); CYCLIC_PREFIX);
#ifdef DEBUG_OFDM_MOD #ifdef DEBUG_OFDM_MOD
printf("slot i %d (txdata offset %d)\n",i,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES0+(i*frame_parms->samples_per_tti>>1)); printf("slot i %d (txdata offset %d)\n",i,OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES0+(i*frame_parms->samples_per_tti>>1));
@@ -78,8 +76,6 @@ void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRA
frame_parms->log2_symbol_size, // log2_fft_size frame_parms->log2_symbol_size, // log2_fft_size
(short_offset==1) ? 1 :(frame_parms->symbols_per_tti>>1)-1,//6, // number of symbols (short_offset==1) ? 1 :(frame_parms->symbols_per_tti>>1)-1,//6, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples frame_parms->nb_prefix_samples, // number of prefix samples
frame_parms->twiddle_ifft, // IFFT twiddle factors
frame_parms->rev, // bit-reversal permutation
CYCLIC_PREFIX); CYCLIC_PREFIX);
@@ -91,8 +87,6 @@ void PHY_ofdm_mod(int *input, /// pointer to complex input
unsigned char log2fftsize, /// log2(FFT_SIZE) unsigned char log2fftsize, /// log2(FFT_SIZE)
unsigned char nb_symbols, /// number of OFDM symbols unsigned char nb_symbols, /// number of OFDM symbols
unsigned short nb_prefix_samples, /// cyclic prefix length unsigned short nb_prefix_samples, /// cyclic prefix length
short *twiddle_ifft, /// pointer to precomputed twiddle table
unsigned short *rev, /// pointer to bit-reversal table
Extension_t etype /// type of extension Extension_t etype /// type of extension
) )
{ {
@@ -253,8 +247,6 @@ void do_OFDM_mod(mod_sym_t **txdataF, int32_t **txdata, uint32_t frame,uint16_t
frame_parms->log2_symbol_size, // log2_fft_size frame_parms->log2_symbol_size, // log2_fft_size
12, // number of symbols 12, // number of symbols
frame_parms->ofdm_symbol_size>>2, // number of prefix samples frame_parms->ofdm_symbol_size>>2, // number of prefix samples
frame_parms->twiddle_ifft, // IFFT twiddle factors
frame_parms->rev, // bit-reversal permutation
CYCLIC_PREFIX); CYCLIC_PREFIX);
if (frame_parms->Ncp == EXTENDED) if (frame_parms->Ncp == EXTENDED)
@@ -263,8 +255,6 @@ void do_OFDM_mod(mod_sym_t **txdataF, int32_t **txdata, uint32_t frame,uint16_t
frame_parms->log2_symbol_size, // log2_fft_size frame_parms->log2_symbol_size, // log2_fft_size
2, // number of symbols 2, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples frame_parms->nb_prefix_samples, // number of prefix samples
frame_parms->twiddle_ifft, // IFFT twiddle factors
frame_parms->rev, // bit-reversal permutation
CYCLIC_PREFIX); CYCLIC_PREFIX);
else { else {
LOG_D(PHY,"Frame %d, subframe %d: Doing PDCCH modulation\n",frame,next_slot>>1); LOG_D(PHY,"Frame %d, subframe %d: Doing PDCCH modulation\n",frame,next_slot>>1);
@@ -281,8 +271,6 @@ void do_OFDM_mod(mod_sym_t **txdataF, int32_t **txdata, uint32_t frame,uint16_t
frame_parms->log2_symbol_size, // log2_fft_size frame_parms->log2_symbol_size, // log2_fft_size
6, // number of symbols 6, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples frame_parms->nb_prefix_samples, // number of prefix samples
frame_parms->twiddle_ifft, // IFFT twiddle factors
frame_parms->rev, // bit-reversal permutation
CYCLIC_PREFIX); CYCLIC_PREFIX);
else { else {
normal_prefix_mod(&txdataF[aa][slot_offset_F], normal_prefix_mod(&txdataF[aa][slot_offset_F],
-30
View File
@@ -124,18 +124,6 @@ int slot_fep_mbsfn(PHY_VARS_UE *phy_vars_ue,
SOFFSET) % frame_length_samples], SOFFSET) % frame_length_samples],
(int16_t *)&ue_common_vars->rxdataF[aa][frame_parms->ofdm_symbol_size*l],1); (int16_t *)&ue_common_vars->rxdataF[aa][frame_parms->ofdm_symbol_size*l],1);
stop_meas(&phy_vars_ue->rx_dft_stats); stop_meas(&phy_vars_ue->rx_dft_stats);
/*
fft((short *)&ue_common_vars->rxdata[aa][sample_offset +
nb_prefix_samples0 +
subframe_offset -
SOFFSET],
(short*)&ue_common_vars->rxdataF[aa][2*frame_parms->ofdm_symbol_size*l],
frame_parms->twiddle_fft,
frame_parms->rev,
frame_parms->log2_symbol_size,
frame_parms->log2_symbol_size>>1,
0);
*/
} else { } else {
if ((sample_offset + if ((sample_offset +
(frame_parms->ofdm_symbol_size+nb_prefix_samples0+nb_prefix_samples) + (frame_parms->ofdm_symbol_size+nb_prefix_samples0+nb_prefix_samples) +
@@ -154,26 +142,8 @@ int slot_fep_mbsfn(PHY_VARS_UE *phy_vars_ue,
SOFFSET) % frame_length_samples], SOFFSET) % frame_length_samples],
(int16_t *)&ue_common_vars->rxdataF[aa][frame_parms->ofdm_symbol_size*l],1); (int16_t *)&ue_common_vars->rxdataF[aa][frame_parms->ofdm_symbol_size*l],1);
stop_meas(&phy_vars_ue->rx_dft_stats); stop_meas(&phy_vars_ue->rx_dft_stats);
/*
fft((short *)&ue_common_vars->rxdata[aa][sample_offset +
(frame_parms->ofdm_symbol_size+nb_prefix_samples0+nb_prefix_samples) +
(frame_parms->ofdm_symbol_size+nb_prefix_samples)*(l-1) +
subframe_offset-
SOFFSET],
(short*)&ue_common_vars->rxdataF[aa][2*frame_parms->ofdm_symbol_size*l],
frame_parms->twiddle_fft,
frame_parms->rev,
frame_parms->log2_symbol_size,
frame_parms->log2_symbol_size>>1,
0);
*/
} }
/*
memcpy(&ue_common_vars->rxdataF2[aa][2*subframe_offset_F+2*frame_parms->ofdm_symbol_size*l],
&ue_common_vars->rxdataF[aa][2*frame_parms->ofdm_symbol_size*l],
2*frame_parms->ofdm_symbol_size*sizeof(int));
*/
} }
//if ((l==0) || (l==(4-frame_parms->Ncp))) { //if ((l==0) || (l==(4-frame_parms->Ncp))) {
+18 -13
View File
@@ -304,7 +304,7 @@ This function performs optimized fixed-point radix-2 FFT/IFFT.
@param scale Total number of shifts (should be log2size/2 for normalized FFT) @param scale Total number of shifts (should be log2size/2 for normalized FFT)
@param input_fmt (0 - input is in complex Q1.15 format, 1 - input is in complex redundant Q1.15 format) @param input_fmt (0 - input is in complex Q1.15 format, 1 - input is in complex redundant Q1.15 format)
*/ */
void fft(int16_t *x, /*void fft(int16_t *x,
int16_t *y, int16_t *y,
int16_t *twiddle, int16_t *twiddle,
uint16_t *rev, uint16_t *rev,
@@ -312,30 +312,31 @@ void fft(int16_t *x,
uint8_t scale, uint8_t scale,
uint8_t input_fmt uint8_t input_fmt
); );
*/
void ifft1536(int16_t *sigF,int16_t *sig); void idft1536(int16_t *sigF,int16_t *sig);
void ifft6144(int16_t *sigF,int16_t *sig); void idft6144(int16_t *sigF,int16_t *sig);
void ifft12288(int16_t *sigF,int16_t *sig); void idft12288(int16_t *sigF,int16_t *sig);
void ifft18432(int16_t *sigF,int16_t *sig); void idft18432(int16_t *sigF,int16_t *sig);
void ifft3072(int16_t *sigF,int16_t *sig); void idft3072(int16_t *sigF,int16_t *sig);
void ifft24576(int16_t *sigF,int16_t *sig); void idft24576(int16_t *sigF,int16_t *sig);
void fft1536(int16_t *sigF,int16_t *sig); void dft1536(int16_t *sigF,int16_t *sig);
void fft6144(int16_t *sigF,int16_t *sig); void dft6144(int16_t *sigF,int16_t *sig);
void fft12288(int16_t *sigF,int16_t *sig); void dft12288(int16_t *sigF,int16_t *sig);
void fft18432(int16_t *sigF,int16_t *sig); void dft18432(int16_t *sigF,int16_t *sig);
void fft3072(int16_t *sigF,int16_t *sig); void dft3072(int16_t *sigF,int16_t *sig);
void fft24576(int16_t *sigF,int16_t *sig); void dft24576(int16_t *sigF,int16_t *sig);
/*!\fn int rotate_cpx_vector(int16_t *x,int16_t *alpha,int16_t *y,uint32_t N,uint16_t output_shift, uint8_t format) /*!\fn int rotate_cpx_vector(int16_t *x,int16_t *alpha,int16_t *y,uint32_t N,uint16_t output_shift, uint8_t format)
@@ -594,12 +595,16 @@ void dft256(int16_t *x,int16_t *y,int scale);
void dft512(int16_t *x,int16_t *y,int scale); void dft512(int16_t *x,int16_t *y,int scale);
void dft1024(int16_t *x,int16_t *y,int scale); void dft1024(int16_t *x,int16_t *y,int scale);
void dft2048(int16_t *x,int16_t *y,int scale); void dft2048(int16_t *x,int16_t *y,int scale);
void dft4096(int16_t *x,int16_t *y,int scale);
void dft8192(int16_t *x,int16_t *y,int scale);
void idft64(int16_t *x,int16_t *y,int scale); void idft64(int16_t *x,int16_t *y,int scale);
void idft128(int16_t *x,int16_t *y,int scale); void idft128(int16_t *x,int16_t *y,int scale);
void idft256(int16_t *x,int16_t *y,int scale); void idft256(int16_t *x,int16_t *y,int scale);
void idft512(int16_t *x,int16_t *y,int scale); void idft512(int16_t *x,int16_t *y,int scale);
void idft1024(int16_t *x,int16_t *y,int scale); void idft1024(int16_t *x,int16_t *y,int scale);
void idft2048(int16_t *x,int16_t *y,int scale); void idft2048(int16_t *x,int16_t *y,int scale);
void idft4096(int16_t *x,int16_t *y,int scale);
void idft8192(int16_t *x,int16_t *y,int scale);
/** @} */ /** @} */
-465
View File
@@ -1,465 +0,0 @@
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
#include "defs.h"
#ifndef EXPRESSMIMO_TARGET
/*! \brief
// FFT base 2 in fixed point
// Alessandro Nordio, 03/2001
// Modified for Intel Free Compiler : R. Knopp, 06.04
*/
// OPTIMIZATION OPTIONS ICC COMPILER : -o3 -tpp7 -xW -parallel
// -o3 : loop transformations and data prefetching
// -tpp7 : enables optimal instruction scheduling and cache management for the pentium 4 processor
// -axW : generates specialized code for the pentium 4 processor while also generating generic IA-32 code
// -xW : generates code to run exclusively on the pentium 4 processor
// -ip : single file optimization
// -parallel : the compiler can detect loop which may benefit from multi-thread execution
// This version is optimized for MMX. (Version 4.0)
// x contains N = 2^log2size complex elements in the format | Re0 Im0 Re1 Im1 | Re2 Im2 Re3 Im3 |...
// So first we do reverse bit ordering and duplication (| Re0 Im0 Re1 Im1 | -> | Re0 Im0 Re0 Im0 || Re1 Im1 Re1 Im1 |)
// then we run the FFT stages starting from the 1st
//
//
// y - output vector of size N = 2^log2size mmx_t element packed in the format
// Output format: [Re0,Im0,Re0,Im0, Re1,Im1,Re1,Im1, ....., Re(N-1),Im(N-1),Re(N-1),Im(N-1)]
//
// twiddle - twiddle factors are precomputed and are in the format
// Twiddle format [Re0,-Im0,Im0,-Re0|Re1,-Im1,Im1,-Re1|,.....]
// Each element of twiddle is a mmx_t union (64 bit) that contains |Re,-Im,Im,Re|
// of a certain twidde factor.
// This way of storing the twiddles is useful to increase the performance of the FFT
// The twiddle vector is logically divided into 'log2size' consecutive parts:
// (e.g. log2size=11 for a 2048 point fft)
// The i-th part contains n_i=2^i elements, for i=0..log2size-1
// The elements of the i-th part are round(A*exp(-j*2*pi*n/(2^(i+1)))) for n=0..n_i
// where A is a power-of-two constant integer. We assume A=2^15.
// (Since A=2^15 then in the butterflies we shift the output of the mpy by 14 (see below))
// The elements of the twiddle are precomputed using a matlab file 'twiddle_mmx.m' and
// stored in a binary file in little endian format.
// The overall twiddle vector contains 2^log2size -1 complex elements
// The i-th part of the twiddle vector is used during the i-th stage of the FFT
// In this version the first stage of the FFT is simplified and has been taken out of the loop.
//
// rev - reverse buffer. Contains the reverse indexes (N indexes)
//
// log2size - is the logarithm in base 2 of the size of the FFT.
// ** WARNING log2size>=2 **
//
#include "PHY/sse_intrin.h"
/// Function ReverseBits()
/// computes bit reversed permutation vector
uint16_t ReverseBits(uint16_t index,
uint16_t NumBits)
{
// This routine reverse bit orders the bits of the argument 'index'
// It assumes the index has NumBits bits.
unsigned i, rev;
for ( i=rev=0; i < NumBits; i++ ) {
rev = (rev << 1) | (index & 1);
index >>= 1;
}
return rev;
}
void init_fft(uint16_t size, uint8_t logsize,uint16_t *local_rev)
{
int i;
//msg("[openair][FFT][INIT] Using %d point fft (%d, %p)\n",size,logsize,local_rev );
for(i=0; i<size; i++) {
local_rev[i] = ReverseBits(i,logsize); // 8 if SAMPLES_PERCHIP=2, 9 if SAMPLES_PER_CHIP = 4
}
}
#define SHIFT 14 // Shift of twiddle amplitude
void fft(int16_t *x, /// complex input
int16_t *y, /// complex output
int16_t *twiddle, /// complex twiddle factors
uint16_t *rev, /// bit reversed permutation vector
uint8_t log2size, /// log2(FFT_SIZE)
uint8_t scale,
uint8_t input_fmt) /// 0 means 64-bit complex interleaved format else complex-multiply ready repeated format
{
int i,j,k; // counters
int bs; // block_size
int n_b; // numer of blocks
uint16_t index; // reverse index
uint8_t scale2=1;//scale;
uint16_t *revl=rev;
register __m64 mm0,mm1,mm2;//mm3,mm4,mm5,mm6,mm7;
__m64 *x_pt = (__m64 *)x,*y_pt = (__m64 *)y,*tw_pt=(__m64 *)twiddle; // output data pointer and twiddle pointer
uint32_t size = 1<<log2size; // size of the FFT
// FFT does not shift the result
// Here we do reverse bit ordering and duplication and then we start from the FIRST stage of the FFT.
// msg("fft: x %x, y %x, twiddle %x,rev %x, format %d, log2size %d, scale %d\n",
// x,y,twiddle,rev,input_fmt,log2size,scale);
// for (i=0;i<10;i++)
// printf("%d ",rev[i]);
// printf("\n");
if (input_fmt == 0)
for(i=0; i<(size>>1); i++) { // reverse 2 complex samples at a time => does the loop size>>1 times
mm0 = x_pt[i];
mm1 = mm0;
mm2 = mm0;
mm1 = _m_punpckldq(mm1,mm0);
mm2 = _m_punpckhdq(mm2,mm0);
index = revl[0]; // get the output index (reverse bit ordering index)
// printf("%x\n",index);
y_pt[index] = mm1;
// printk("fft: rev0 = %d\n",index);
// printf("%x\n",index);
index = revl[1]; // get the output index (reverse bit ordering index)
y_pt[index] = mm2;
revl+=2;
// printk("fft: rev1 = %d\n",index);
// increase reverse buffer pointer
}
else
for(i=0; i<size; i++) // reverse 2 complex samples at a time => does the loop size>>1 times
y_pt[rev[i]] = x_pt[i];
//return;
// *** FIRST FFT STAGE ***
// Now the input data is stored in y in reverse bit order in the format |x_i 0 x_i 0| (Re Im Re Im)
// SECOND STEP: does the radix-2 FFT itself
// - First stage of the FFT
// In the first stage we do not use twiddle factors since the twiddle is (1,0)
// so we avoid multiplications and shifts
// This loop is unrolled by a factor 2 ->(n_b>>1)
// So here we implicitly assume size>=4
// For each loop it computes two butterflies
// butterfly input : 4 cpx elements : x0, x1, x2, x3
// butterfly output: 4 cpx elements : X0, X1, X2, X3
// twiddles associated with the butterflies: w0 and w1
// X0 = x0+w0*x1 = x0+x1
// X1 = x0-w0*x1 = x0-x1
// X2 = x2+w1*x3 = x2+x3
// X3 = x2-w1*x3 = x2-x3
// For the first stage w0 = w1 = [1 0 0 1] (see twiddle format)
// msg("[PHY_fft_intel_mmx] : Stage 1\n");
y_pt = (__m64 *)&y[0];
//1 butterfly = 2 inputs
for(i=0; i<(size>>1); i++) {
/*
msg("[PHY_fft_intel_mmx: y_pt = %p\n",y_pt);
msg("[PHY_fft_intel_mmx] : y[0] = (%d %d %d %d) y[1] = (%d %d %d %d)\n",
((int16_t *)(&y_pt[0]))[0],
((int16_t *)(&y_pt[0]))[1],
((int16_t *)(&y_pt[0]))[2],
((int16_t *)(&y_pt[0]))[3],
((int16_t *)(&y_pt[1]))[0],
((int16_t *)(&y_pt[1]))[1],
((int16_t *)(&y_pt[1]))[2],
((int16_t *)(&y_pt[1]))[3]);
*/
mm0 = _mm_adds_pi16(y_pt[0],y_pt[1]);//top of butterfly
mm1 = _mm_subs_pi16(y_pt[0],y_pt[1]);//bottom of butterfly
//shift four 16-bit values right by 1 while shifting in the sign bit <=> PSRAWI and store the result for next stage
y_pt[0] = mm0; //_mm_srai_pi16(mm0,1);
y_pt[1] = mm1; //_mm_srai_pi16(mm1,1);
y_pt += 2;
}
// - Stages from 2 to log2size-1
tw_pt++; // for the 2nd stage we start with twiddle[4]
bs =2; // the blocksize is two
n_b =size>>2; // half n_b
for(i=1; i<(log2size>>1); i++) {
y_pt = (__m64 *)&y[0];
for(k=0; k<n_b; k++) {
// bs is greater than or equal to 2 so I can unroll a bit the inner loop
// so that every loop computes two butterflies
// bs is greater than or equal to 2 so I can unroll a bit the inner loop
// For each loop it computes two butterflies
// butterfly input : 4 cpx elements : x0, x1, x2, x3
// butterfly output: 4 cpx elements : X0, X1, X2, X3
// twiddles associated with the butterflies: w0 and w1
// X0 = x0+w0*x1
// X1 = x0-w0*x1
// X2 = x2+w1*x3
// X3 = x2-w1*x3
for(j=0; j<bs; j+=2) {
mm0 = _mm_madd_pi16(tw_pt[0],y_pt[bs]);//PMADDWD
mm0 = _mm_srai_pi32(mm0,SHIFT);//PSRAD, divide the 32-bit result of multiplication by 2^15 while shifting in the sign bit
mm0 = _mm_packs_pi32(mm0,mm0);//PACKSSWD pack with signed saturation to restore the result in format |Re Im Re Im|
y_pt[bs] = _mm_subs_pi16(y_pt[0],mm0);//PSUBSW
y_pt[0] = _mm_adds_pi16(y_pt[0],mm0);//PADDSW
mm0 = _mm_madd_pi16(tw_pt[1],y_pt[bs+1]);//PMADDWD
mm0 = _mm_srai_pi32(mm0,SHIFT);//PSRAD, divide the 32-bit result of multiplication by 2^15 while shifting in the sign bit
mm0 = _mm_packs_pi32(mm0,mm0);//PACKSSWD pack with signed saturation to restore the result in format |Re Im Re Im|
y_pt[bs+1] = _mm_subs_pi16(y_pt[1],mm0);//PSUBSW
y_pt[1] = _mm_adds_pi16(y_pt[1],mm0);//PADDSW
y_pt += 2;
tw_pt += 2;
}
tw_pt -=bs; // twiddle pointer now points to the first twiddle of this stage
y_pt +=bs; // jump to next block
}
tw_pt+=bs; // jump to the first twiddle of the next stage
bs <<=1; // double bs
n_b >>=1; // half n_b
}
// last stage we shift by scale (for a normalized fft, log2size/2)
for(i=(log2size>>1); i<log2size; i++) {
y_pt = (__m64 *)&y[0];
for(k=0; k<n_b; k++) {
// bs is greater than or equal to 2 so I can unroll a bit the inner loop
// so that every loop computes two butterflies
// bs is greater than or equal to 2 so I can unroll a bit the inner loop
// For each loop it computes two butterflies
// butterfly input : 4 cpx elements : x0, x1, x2, x3
// butterfly output: 4 cpx elements : X0, X1, X2, X3
// twiddles associated with the butterflies: w0 and w1
// X0 = x0+w0*x1
// X1 = x0-w0*x1
// X2 = x2+w1*x3
// X3 = x2-w1*x3
for(j=0; j<bs; j+=2) {
mm0 = _mm_madd_pi16(tw_pt[0],y_pt[bs]);//PMADDWD
mm0 = _mm_srai_pi32(mm0,SHIFT);//PSRAD, divide the 32-bit result of multiplication by 2^15 while shifting in the sign bit
mm0 = _mm_packs_pi32(mm0,mm0);//PACKSSWD pack with signed saturation to restore the result in format |Re Im Re Im|
mm1 = _mm_adds_pi16(y_pt[0],mm0);//PADDSW
mm2 = _mm_subs_pi16(y_pt[0],mm0);//PSUBSW
//shift four 16-bit values right by 1 while shifting in the sign bit <=> PSRAWI and store the result for next stage
y_pt[0] = _mm_srai_pi16(mm1,scale2);
y_pt[bs] = _mm_srai_pi16(mm2,scale2);
mm0 = _mm_madd_pi16(tw_pt[1],y_pt[bs+1]);//PMADDWD
mm0 = _mm_srai_pi32(mm0,SHIFT);//PSRAD, divide the 32-bit result of multiplication by 2^15 while shifting in the sign bit
mm0 = _mm_packs_pi32(mm0,mm0);//PACKSSWD pack with signed saturation to restore the result in format |Re Im Re Im|
mm1 = _mm_adds_pi16(y_pt[1],mm0);//PADDSW
mm2 = _mm_subs_pi16(y_pt[1],mm0);//PSUBSW
//shift four 16-bit values right by 1 while shifting in the sign bit <=> PSRAWI and store the result for next stage
y_pt[1] = _mm_srai_pi16(mm1,scale2);
y_pt[bs+1] = _mm_srai_pi16(mm2,scale2);
y_pt += 2;
tw_pt += 2;
}
tw_pt -=bs; // twiddle pointer now points to the first twiddle of this stage
y_pt +=bs; // jump to next block
}
tw_pt+=bs; // jump to the first twiddle of the next stage
bs <<=1; // double bs
n_b >>=1; // half n_b
}
_mm_empty();
_m_empty();
}
#else //EXPRESSMIMO_TARGET
void init_fft(uint16_t size, uint8_t logsize,uint16_t *local_rev)
{
return;
}
void fft(int16_t *x, /// complex input
int16_t *y, /// complex output
int16_t *twiddle, /// complex twiddle factors
uint16_t *rev, /// bit reversed permutation vector
uint8_t log2size, /// log2(FFT_SIZE)
uint8_t scale,
uint8_t input_fmt) /// 0 means 64-bit complex interleaved format else complex-multiply ready repeated format
{
}
#endif //EXPRESSMIMO_TARGET
#ifdef MAIN
#include "twiddle256.h"
uint32_t s0, s1, s2, b;
inline void pset_taus_seed(uint32_t off)
{
s0 = (uint32_t)0x1e23d852 + (off<<4);
s1 = (uint32_t)0x81f38a1c + (off<<4);
s2 = (uint32_t)0xfe1a133e + (off<<4);
}
inline uint32_t ptaus()
{
b = (((s0 << 13) ^ s0) >> 19);
s0 = (((s0 & 0xFFFFFFFE) << 12)^ b);
b = (((s1 << 2) ^ s1) >> 25);
s1 = (((s1 & 0xFFFFFFF8) << 4)^ b);
b = (((s2 << 3) ^ s2) >> 11);
s2 = (((s2 & 0xFFFFFFF0) << 17)^ b);
return s0 ^ s1 ^ s2;
}
main()
{
int16_t local_rev[256];
int i;
int input[512],output[512];
init_fft(256,8,local_rev);
pset_taus_seed(3);
for (i=0; i<256; i++) {
input[i] = (((ptaus()>>5)&0xffff0000) | ((ptaus()>>21)&0x0000ffff);
}
fft(input,
output,
twiddle_fft256, /// complex twiddle factors
local_rev, /// bit reversed permutation vector
8,
4,
0);
/*
fft(input,
output,
twiddle_fft256, /// complex twiddle factors
local_rev, /// bit reversed permutation vector
8,
4,
0);
*/
printf("input = [");
for (i=0; i<256; i++)
printf("%d+sqrt(-1)*(%d)\n",((int16_t*)input)[2*i],((int16_t*)input)[1+(2*i)]);
printf("];\n");
printf("output = [");
for (i=0; i<256; i++)
printf("%d+sqrt(-1)*(%d)\n",((int16_t*)output)[4*i],((int16_t*)output)[1+(4*i)]);
printf("];\n");
}
#endif //MAIN
-287
View File
@@ -1,287 +0,0 @@
k=0;
for i=0:5,
for n=0:(2^i)-1,
twiddleFFT_64(1+(4*k)) = round(16384*cos(2*pi*n/(2^(i+1))));
twiddleIFFT_64(1+(4*k)) = twiddleFFT_64(1+(4*k));
twiddleFFT_64(2+(4*k)) = round(16384*sin(2*pi*n/(2^(i+1))));
twiddleIFFT_64(2+(4*k)) = -twiddleFFT_64(2+(4*k));
twiddleFFT_64(3+(4*k)) = -twiddleFFT_64(2+(4*k));
twiddleIFFT_64(3+(4*k)) = twiddleFFT_64(2+(4*k));
twiddleFFT_64(4+(4*k)) = twiddleFFT_64(1+(4*k));
twiddleIFFT_64(4+(4*k)) = twiddleFFT_64(1+(4*k));
k=k+1;
end
end
[fid, msg] = fopen("twiddle64.h","w","ieee-le");
fprintf(fid,"short twiddle_fft64[63*4] = {");
fprintf(fid,"%d,%d,%d,%d,\n",twiddleFFT_64(1:248));
fprintf(fid,"%d,%d,%d,%d};\n\n",twiddleFFT_64(249:252));
fprintf(fid,"short twiddle_ifft64[63*4] = {");
fprintf(fid,"%d,%d,%d,%d,\n",twiddleIFFT_64(1:248));
fprintf(fid,"%d,%d,%d,%d};\n\n",twiddleIFFT_64(249:252));
fclose(fid);
k=0;
for i=0:6,
for n=0:(2^i)-1,
twiddleFFT_128(1+(4*k)) = round(16384*cos(2*pi*n/(2^(i+1))));
twiddleIFFT_128(1+(4*k)) = twiddleFFT_128(1+(4*k));
twiddleFFT_128(2+(4*k)) = round(16384*sin(2*pi*n/(2^(i+1))));
twiddleIFFT_128(2+(4*k)) = -twiddleFFT_128(2+(4*k));
twiddleFFT_128(3+(4*k)) = -twiddleFFT_128(2+(4*k));
twiddleIFFT_128(3+(4*k)) = twiddleFFT_128(2+(4*k));
twiddleFFT_128(4+(4*k)) = twiddleFFT_128(1+(4*k));
twiddleIFFT_128(4+(4*k)) = twiddleFFT_128(1+(4*k));
k=k+1;
end
end
[fid, msg] = fopen("twiddle128.h","w","ieee-le");
fprintf(fid,"short twiddle_fft128[127*4] = {");
fprintf(fid,"%d,%d,%d,%d,\n",twiddleFFT_128(1:504));
fprintf(fid,"%d,%d,%d,%d};\n\n",twiddleFFT_128(505:508));
fprintf(fid,"short twiddle_ifft128[127*4] = {");
fprintf(fid,"%d,%d,%d,%d,\n",twiddleIFFT_128(1:504));
fprintf(fid,"%d,%d,%d,%d};\n\n",twiddleIFFT_128(505:508));
fclose(fid);
k=0;
for i=0:7,
for n=0:(2^i)-1,
twiddleFFT_256(1+(4*k)) = round(16384*cos(2*pi*n/(2^(i+1))));
twiddleIFFT_256(1+(4*k)) = twiddleFFT_256(1+(4*k));
twiddleFFT_256(2+(4*k)) = round(16384*sin(2*pi*n/(2^(i+1))));
twiddleIFFT_256(2+(4*k)) = -twiddleFFT_256(2+(4*k));
twiddleFFT_256(3+(4*k)) = -twiddleFFT_256(2+(4*k));
twiddleIFFT_256(3+(4*k)) = twiddleFFT_256(2+(4*k));
twiddleFFT_256(4+(4*k)) = twiddleFFT_256(1+(4*k));
twiddleIFFT_256(4+(4*k)) = twiddleFFT_256(1+(4*k));
k=k+1;
end
end
[fid, msg] = fopen("twiddle256.h","w","ieee-le");
fprintf(fid,"short twiddle_fft256[255*4] = {");
fprintf(fid,"%d,%d,%d,%d,\n",twiddleFFT_256(1:1016));
fprintf(fid,"%d,%d,%d,%d};\n\n",twiddleFFT_256(1017:1020));
fprintf(fid,"short twiddle_ifft256[255*4] = {");
fprintf(fid,"%d,%d,%d,%d,\n",twiddleIFFT_256(1:1016));
fprintf(fid,"%d,%d,%d,%d};\n\n",twiddleIFFT_256(1017:1020));
fclose(fid)
k=0;
for i=0:8,
for n=0:(2^i)-1,
twiddleFFT_512(1+(4*k)) = round(16384*cos(2*pi*n/(2^(i+1))));
twiddleIFFT_512(1+(4*k)) = twiddleFFT_512(1+(4*k));
twiddleFFT_512(2+(4*k)) = round(16384*sin(2*pi*n/(2^(i+1))));
twiddleIFFT_512(2+(4*k)) = -twiddleFFT_512(2+(4*k));
twiddleFFT_512(3+(4*k)) = -twiddleFFT_512(2+(4*k));
twiddleIFFT_512(3+(4*k)) = twiddleFFT_512(2+(4*k));
twiddleFFT_512(4+(4*k)) = twiddleFFT_512(1+(4*k));
twiddleIFFT_512(4+(4*k)) = twiddleFFT_512(1+(4*k));
k=k+1;
end
end
[fid, msg] = fopen("twiddle512.h","w","ieee-le");
fprintf(fid,"short twiddle_fft512[511*4] = {");
fprintf(fid,"%d,%d,%d,%d,\n",twiddleFFT_512(1:2040));
fprintf(fid,"%d,%d,%d,%d};\n\n",twiddleFFT_512(2041:2044));
fprintf(fid,"short twiddle_ifft512[511*4] = {");
fprintf(fid,"%d,%d,%d,%d,\n",twiddleIFFT_512(1:2040));
fprintf(fid,"%d,%d,%d,%d};\n\n",twiddleIFFT_512(2041:2044));
fclose(fid)
k=0;
for i=0:9,
for n=0:(2^i)-1,
twiddleFFT_1024(1+(4*k)) = fix(16384*cos(2*pi*n/(2^(i+1))));
twiddleIFFT_1024(1+(4*k)) = twiddleFFT_1024(1+(4*k));
twiddleFFT_1024(2+(4*k)) = fix(16384*sin(2*pi*n/(2^(i+1))));
twiddleIFFT_1024(2+(4*k)) = -twiddleFFT_1024(2+(4*k));
twiddleFFT_1024(3+(4*k)) = -twiddleFFT_1024(2+(4*k));
twiddleIFFT_1024(3+(4*k)) = twiddleFFT_1024(2+(4*k));
twiddleFFT_1024(4+(4*k)) = twiddleFFT_1024(1+(4*k));
twiddleIFFT_1024(4+(4*k)) = twiddleFFT_1024(1+(4*k));
k=k+1;
end
end
[fid, msg] = fopen("twiddle1024.h","w","ieee-le");
fprintf(fid,"short twiddle_fft1024[1023*4] = {");
fprintf(fid,"%d,%d,%d,%d,\n",twiddleFFT_1024(1:4088));
fprintf(fid,"%d,%d,%d,%d};\n\n",twiddleFFT_1024(4089:4092));
fprintf(fid,"short twiddle_ifft1024[1023*4] = {");
fprintf(fid,"%d,%d,%d,%d,\n",twiddleIFFT_1024(1:4088));
fprintf(fid,"%d,%d,%d,%d};\n\n",twiddleIFFT_1024(4089:4092));
%fprintf(fid,"unsigned short rev1024[1024];\n")
fclose(fid)
k=0;
for i=0:10,
for n=0:(2^i)-1,
twiddleFFT_2048(1+(4*k)) = fix(16384*cos(2*pi*n/(2^(i+1))));
twiddleIFFT_2048(1+(4*k)) = twiddleFFT_2048(1+(4*k));
twiddleFFT_2048(2+(4*k)) = fix(16384*sin(2*pi*n/(2^(i+1))));
twiddleIFFT_2048(2+(4*k)) = -twiddleFFT_2048(2+(4*k));
twiddleFFT_2048(3+(4*k)) = -twiddleFFT_2048(2+(4*k));
twiddleIFFT_2048(3+(4*k)) = twiddleFFT_2048(2+(4*k));
twiddleFFT_2048(4+(4*k)) = twiddleFFT_2048(1+(4*k));
twiddleIFFT_2048(4+(4*k)) = twiddleFFT_2048(1+(4*k));
k=k+1;
end
end
[fid, msg] = fopen("twiddle2048.h","w","ieee-le");
fprintf(fid,"short twiddle_fft2048[2047*4] = {");
fprintf(fid,"%d,%d,%d,%d,\n",twiddleFFT_2048(1:8184));
fprintf(fid,"%d,%d,%d,%d};\n\n",twiddleFFT_2048(8185:8188));
fprintf(fid,"short twiddle_ifft2048[2047*4] = {");
fprintf(fid,"%d,%d,%d,%d,\n",twiddleIFFT_2048(1:8184));
fprintf(fid,"%d,%d,%d,%d};\n\n",twiddleIFFT_2048(8185:8188));
fclose(fid)
k=0;
for i=0:11,
for n=0:(2^i)-1,
twiddleFFT_4096(1+(4*k)) = fix(16384*cos(2*pi*n/(2^(i+1))));
twiddleIFFT_4096(1+(4*k)) = twiddleFFT_4096(1+(4*k));
twiddleFFT_4096(2+(4*k)) = fix(16384*sin(2*pi*n/(2^(i+1))));
twiddleIFFT_4096(2+(4*k)) = -twiddleFFT_4096(2+(4*k));
twiddleFFT_4096(3+(4*k)) = -twiddleFFT_4096(2+(4*k));
twiddleIFFT_4096(3+(4*k)) = twiddleFFT_4096(2+(4*k));
twiddleFFT_4096(4+(4*k)) = twiddleFFT_4096(1+(4*k));
twiddleIFFT_4096(4+(4*k)) = twiddleFFT_4096(1+(4*k));
k=k+1;
end
end
[fid, msg] = fopen("twiddle4096.h","w","ieee-le");
fprintf(fid,"short twiddle_fft4096[4095*4] = {");
fprintf(fid,"%d,%d,%d,%d,\n",twiddleFFT_4096(1:16376));
fprintf(fid,"%d,%d,%d,%d};\n\n",twiddleFFT_4096(16377:16380));
fprintf(fid,"short twiddle_ifft4096[4095*4] = {");
fprintf(fid,"%d,%d,%d,%d,\n",twiddleIFFT_4096(1:16376));
fprintf(fid,"%d,%d,%d,%d};\n\n",twiddleIFFT_4096(16377:16380));
%fprintf(fid,"unsigned short rev4096[4096];\n")
fclose(fid)
k=0;
for i=0:12,
for n=0:(2^i)-1,
twiddleFFT_8192(1+(4*k)) = fix(16384*cos(2*pi*n/(2^(i+1))));
twiddleIFFT_8192(1+(4*k)) = twiddleFFT_8192(1+(4*k));
twiddleFFT_8192(2+(4*k)) = fix(16384*sin(2*pi*n/(2^(i+1))));
twiddleIFFT_8192(2+(4*k)) = -twiddleFFT_8192(2+(4*k));
twiddleFFT_8192(3+(4*k)) = -twiddleFFT_8192(2+(4*k));
twiddleIFFT_8192(3+(4*k)) = twiddleFFT_8192(2+(4*k));
twiddleFFT_8192(4+(4*k)) = twiddleFFT_8192(1+(4*k));
twiddleIFFT_8192(4+(4*k)) = twiddleFFT_8192(1+(4*k));
k=k+1;
end
end
[fid, msg] = fopen("twiddle8192.h","w","ieee-le");
fprintf(fid,"short twiddle_fft8192[8191*4] = {");
fprintf(fid,"%d,%d,%d,%d,\n",twiddleFFT_8192(1:16376));
fprintf(fid,"%d,%d,%d,%d};\n\n",twiddleFFT_8192(16377:16380));
fprintf(fid,"short twiddle_ifft8192[8191*4] = {");
fprintf(fid,"%d,%d,%d,%d,\n",twiddleIFFT_8192(1:16376));
fprintf(fid,"%d,%d,%d,%d};\n\n",twiddleIFFT_8192(16377:16380));
%fprintf(fid,"unsigned short rev8192[8192];\n")
fclose(fid)
File diff suppressed because one or more lines are too long
-498
View File
@@ -1,498 +0,0 @@
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
/*!\brief Phase error compensation*/
///
/// Accomplishes the phase error compensation for CHBCH and SCH channels
///
#ifndef USER_MODE
#define __NO_VERSION__
//#include "from_grlib_softregs.h"
#else
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#endif
#include "PHY/defs.h"
#include "PHY/extern.h"
#include "SCHED/extern.h"
#include "defs.h"
#include "extern.h"
#include "PHY/sse_intrin.h"
#ifndef USER_MODE
#define openair_get_mbox() (*(unsigned int *)mbox)
#endif //USER_MODE
static __m64 perror64 __attribute__ ((aligned(16)));
static __m64 Rsymb_conj64 __attribute__ ((aligned(16)));
int phy_phase_compensation_top (unsigned int pilot_type, unsigned int initial_pilot,
unsigned int last_pilot, int ignore_prefix)
{
#ifdef PC_TARGET
// i - pilot index
// i2 - I have no idea
// aa - receive antenna index
unsigned short i, i2, aa;
// Temporary buffer or similar
int *input;
// Our SCH indices
unsigned int pilot_offset, sch_index;
unsigned char frequency_reuse_ind = 1;
unsigned char log2_avg,log2_perror_amp;
struct complex16 perror, *Rchsch, *Rsymb, *Rsch;
__m64 *Rchsch64, *Rsch64;
register __m64 mm0, mm1;
int ind, ind64;
int chr, chi;
int rx_energy[NB_ANTENNAS_RX];
unsigned char *chbch_pdu;
unsigned int chbch_size;
unsigned int time_in, time_out;
unsigned int number_of_pilots = last_pilot - initial_pilot;
#ifdef USER_MODE
char fname[40], vname[40];
#endif //USER_MODE
#ifdef DEBUG_PHY
msg ("[openair][PHY][CODING] Correction of phase error\n");
#endif // DEBUG_PHY
for (aa = 0; aa < NB_ANTENNAS_RX; aa++) {
// Lets check to see if the phase compensation is done over the CHBCH or SCH
if (pilot_type == 0) { // Were working with the CHBCH
for (i = 0; i < NUMBER_OF_CHBCH_SYMBOLS; i++) {
// Review this code... It is NOT WORKING!!!
#ifndef USER_MODE
if (openair_daq_vars.mode == openair_NOT_SYNCHED) {
input = &PHY_vars->rx_vars[aa].
RX_DMA_BUFFER[(PHY_vars->rx_vars[0].offset +
((i +
SYMBOL_OFFSET_CHBCH) <<
LOG2_NUMBER_OF_OFDM_CARRIERS) + (i +
1 +
SYMBOL_OFFSET_CHBCH)
* CYCLIC_PREFIX_LENGTH) %
FRAME_LENGTH_SAMPLES];
} else {
#ifdef HW_PREFIX_REMOVAL
input = &PHY_vars->rx_vars[aa].
RX_DMA_BUFFER[((i +
SYMBOL_OFFSET_CHBCH) <<
LOG2_NUMBER_OF_OFDM_CARRIERS)];
#else
input = &PHY_vars->rx_vars[aa].
RX_DMA_BUFFER[((i +
SYMBOL_OFFSET_CHBCH) <<
LOG2_NUMBER_OF_OFDM_CARRIERS) + (i +
SYMBOL_OFFSET_CHBCH
+
1) *
CYCLIC_PREFIX_LENGTH];
#endif //HW_PREFIX_REMOVAL
}
#else //USER_MODE
input = &PHY_vars->rx_vars[aa].
RX_DMA_BUFFER[(PHY_vars->rx_vars[0].offset +
((i +
SYMBOL_OFFSET_CHBCH) <<
LOG2_NUMBER_OF_OFDM_CARRIERS) + (i + 1 +
SYMBOL_OFFSET_CHBCH)
* CYCLIC_PREFIX_LENGTH) %
FRAME_LENGTH_SAMPLES];
#endif //USER_MODE
// msg("[openair][PHY][CHBCH %d] frame %d: Decoding -> FFT %d\n",frequency_reuse_ind,frame,i);
// dump_chbch_pilots (0);
fft ((short *) &input[0],
(short *) &PHY_vars->chbch_data[frequency_reuse_ind].
rx_sig_f[aa][i << (1 + LOG2_NUMBER_OF_OFDM_CARRIERS)],
(short *) twiddle_fft, rev, LOG2_NUMBER_OF_OFDM_CARRIERS, 3,
0);
// Phase error compensation
// dump_chbch_pilots (0);
if (NUMBER_OF_CHBCH_PILOTS) {
perror.r = 0;
perror.i = 0;
Rchsch = (struct complex16 *) &PHY_vars->
chsch_data[frequency_reuse_ind].rx_sig_f[aa][0];
Rsymb = (struct complex16 *) &PHY_vars->
chbch_data[frequency_reuse_ind].
rx_sig_f[aa][i <<
(1 + LOG2_NUMBER_OF_OFDM_CARRIERS)];
Rchsch64 =
(__m64 *) & PHY_vars->
chsch_data[frequency_reuse_ind].rx_sig_f[aa][0];
// inner product of received CHSCH in pilot positions and received symbol
mm1 = _m_pxor (mm1, mm1);
for (i2 = 0; i2 < NUMBER_OF_CHBCH_PILOTS; i2++) {
ind = PHY_vars->chbch_data[frequency_reuse_ind].
pilot_indices[i2] << 1;
ind64 = PHY_vars->chbch_data[frequency_reuse_ind].
pilot_indices[i2];
#ifdef DEBUG_PHY
#ifdef USER_MODE
msg ("[OPENAIR][PHY][CHBCH DEMOD]Ant %d symbol %d (%p), pilot %d (%d): RX p (%d,%d), RX s (%d,%d)\n", aa, i, Rsymb, i2, ind64, Rchsch[ind].r, Rchsch[ind].i, Rsymb[ind].r, Rsymb[ind].i);
#endif /* USER_MODE */
#endif /* DEBUG_PHY */
// perror.r += ( ((Rchsch[ind].r*Rsymb[ind].r)>>PERROR_SHIFT) + ((Rchsch[ind].i*Rsymb[ind].i)>>PERROR_SHIFT) );
// perror.i += ( ((Rchsch[ind].i*Rsymb[ind].r)>>PERROR_SHIFT) - ((Rchsch[ind].r*Rsymb[ind].i)>>PERROR_SHIFT) );
// MMX version
((short *) &Rsymb_conj64)[0] = Rsymb[ind].r;
((short *) &Rsymb_conj64)[1] = Rsymb[ind].i;
((short *) &Rsymb_conj64)[2] = -Rsymb[ind].i;
((short *) &Rsymb_conj64)[3] = Rsymb[ind].r;
mm0 = _mm_madd_pi16 (Rchsch64[ind64], Rsymb_conj64);
mm1 = _mm_add_pi32 (mm0, mm1);
}
perror64 =
_mm_srai_pi32 (mm1,
PERROR_SHIFT +
LOG2_NUMBER_OF_CHBCH_PILOTS);
perror.r = ((short *) &perror64)[0];
perror.i = ((short *) &perror64)[2];
// base shift for rotation on amplitude first OFDM symbol only (might be better to compute the max over the CHBCH
if ((aa == 0) && (i == 0)) {
log2_perror_amp =
log2_approx ((unsigned int) ((int) perror.
r * perror.r +
(int) perror.
i *
perror.
i)) >> 1;
}
// Apply rotation
rotate_cpx_vector ((short *) Rsymb, (short *) &perror,
(short *) Rsymb, NUMBER_OF_OFDM_CARRIERS,
log2_perror_amp, 0);
#ifdef DEBUG_PHY
#ifdef USER_MODE
msg ("[OPENAIR][PHY][CHBCH DEMOD] Ant %d : symbol %d, perror = (%d,%d) , approx amp %d\n", aa, i, perror.r, perror.i, log2_perror_amp);
#endif //USER_MODE
#endif //DEBUG_PHY
}
}
} else { // Were working with the SCH
// Foreach PILOT SCH
for (pilot_offset = initial_pilot; pilot_offset <= last_pilot; pilot_offset++) {
// Set the absolute pilot index wrt the frame:
sch_index = EMOS_SCH_INDEX;
for (i = 0; i < NUMBER_OF_SCH_SYMBOLS; i++) {
if (ignore_prefix == 1) {
input = &PHY_vars->rx_vars[aa].RX_DMA_BUFFER[(i + pilot_offset) << (LOG2_NUMBER_OF_OFDM_CARRIERS)];
} else {
input = &PHY_vars->rx_vars[aa].RX_DMA_BUFFER[((i + pilot_offset) << (LOG2_NUMBER_OF_OFDM_CARRIERS)) + (i + 1 + pilot_offset) *
CYCLIC_PREFIX_LENGTH];
}
fft ((short *) &input[0],
(short *) &PHY_vars->sch_data[sch_index].rx_sig_f[aa][i << (1 + LOG2_NUMBER_OF_OFDM_CARRIERS)],
(short *) twiddle_fft, rev,
LOG2_NUMBER_OF_OFDM_CARRIERS, 3, 0);
perror.r = 0;
perror.i = 0;
// Reference SCH
Rsch = (struct complex16 *) &PHY_vars->sch_data[sch_index].rx_sig_f[aa][initial_pilot];
Rsch64 = (__m64 *) & PHY_vars->chsch_data[sch_index].rx_sig_f[aa][initial_pilot]; //IN MMX format
// SCH to be de-rotated
Rsymb = (struct complex16 *) &PHY_vars->sch_data[sch_index].rx_sig_f[aa][pilot_offset << (1 + LOG2_NUMBER_OF_OFDM_CARRIERS)];
// inner product of received CHSCH in pilot positions and received symbol
mm1 = _m_pxor (mm1, mm1);
for (i2 = 0; i2 < NUMBER_OF_OFDM_CARRIERS; i2++) {
// Indices
ind = i2 << 1;
ind64 = i2;
#ifdef DEBUG_PHY
#ifdef USER_MODE
msg ("[OPENAIR][PHY][CHBCH DEMOD]Ant %d symbol %d (%p), pilot %d (%d): RX p (%d,%d), RX s (%d,%d)\n", aa, i, Rsymb, i2, ind64, Rchsch[ind].r, Rchsch[ind].i, Rsymb[ind].r, Rsymb[ind].i);
#endif /* USER_MODE */
#endif /* DEBUG_PHY */
// perror.r += ( ((Rchsch[ind].r*Rsymb[ind].r)>>PERROR_SHIFT) + ((Rchsch[ind].i*Rsymb[ind].i)>>PERROR_SHIFT) );
// perror.i += ( ((Rchsch[ind].i*Rsymb[ind].r)>>PERROR_SHIFT) - ((Rchsch[ind].r*Rsymb[ind].i)>>PERROR_SHIFT) );
// MMX version
// Initializing the vector for complex mult
((short *) &Rsymb_conj64)[0] = Rsymb[ind].r;
((short *) &Rsymb_conj64)[1] = Rsymb[ind].i;
((short *) &Rsymb_conj64)[2] = -Rsymb[ind].i;
((short *) &Rsymb_conj64)[3] = Rsymb[ind].r;
mm0 = _mm_madd_pi16 (Rchsch64[ind64], Rsymb_conj64);
mm1 = _mm_add_pi32 (mm0, mm1);
}
// this is a bitwise shift
perror64 = _mm_srai_pi32 (mm1, PERROR_SHIFT + LOG2_NUMBER_OF_OFDM_CARRIERS);
perror.r = ((short *) &perror64)[0];
perror.i = ((short *) &perror64)[2];
// base shift for rotation on amplitude first OFDM symbol only (might be better to compute the max over the CHBCH
if ((aa == 0) && (i == 0)) {
// For normalization in the followinf routine
log2_perror_amp = log2_approx((unsigned int) ((int) perror.r * perror.r + (int)perror.i * perror.i)) >> 1;
}
// Apply rotation
rotate_cpx_vector ((short *) Rsymb,
(short *) &perror,
(short *) Rsymb,
NUMBER_OF_OFDM_CARRIERS,
log2_perror_amp,
0);
#ifdef DEBUG_PHY
#ifdef USER_MODE
msg ("[OPENAIR][PHY][CHBCH DEMOD] Ant %d : symbol %d, perror = (%d,%d) , approx amp %d\n", aa, i, perror.r, perror.i, log2_perror_amp);
#endif //USER_MODE
#endif //DEBUG_PHY
}
phy_channel_estimation ((short *) &PHY_vars->
sch_data[sch_index].
rx_sig_f[aa][i <<
(1 +
LOG2_NUMBER_OF_OFDM_CARRIERS)],
(short *) &PHY_vars->
sch_data[sch_index].
channel[aa][i <<
(1 +
LOG2_NUMBER_OF_OFDM_CARRIERS)],
(short *) &PHY_vars->
sch_data[sch_index].
channel_f[aa][i <<
(1 +
LOG2_NUMBER_OF_OFDM_CARRIERS)],
(short *) &PHY_vars->
sch_data[sch_index].
channel_matched_filter_f[aa][i <<
(1 +
LOG2_NUMBER_OF_OFDM_CARRIERS)],
(short *) &PHY_vars->sch_data[0].
SCH_conj_f[i <<
(1 +
LOG2_NUMBER_OF_OFDM_CARRIERS)],
15, //LOG2_SCH_RX_F_AMP,
(NB_ANTENNAS_RX == 1) ? 1 : 0);
#ifdef USER_MODE
#ifdef DEBUG_PHY
sprintf (fname, "sch%d_channelF%d.m", sch_index, aa);
sprintf (vname, "sch%d_chanF%d", sch_index, aa);
write_output (fname,
vname,
(short *) &PHY_vars->sch_data[sch_index].
channel_f[aa][0], 2 * NUMBER_OF_OFDM_CARRIERS, 2, 1);
sprintf (fname, "sch%d_channel%d.m", sch_index, aa);
sprintf (vname, "sch%d_chan%d", sch_index, aa);
write_output (fname,
vname,
(short *) &PHY_vars->sch_data[sch_index].
channel[aa][0], 2 * NUMBER_OF_OFDM_CARRIERS, 2, 1);
#endif // DEBUG_PHY
#endif // USER_MODE
}
}
}
#endif //PC_TARGET
}
void phy_phase_compensation (short *ref_sch, short *tgt_sch, short *out_sym, int ignore_prefix, int aa, struct complex16 *perror_out)
{
struct complex16 perror, *Rsymb, *Rsch;
struct complex32 perror32;
__m64 perror64, Rsymb_conj64, Rsch64;
__m64 Rsymb64[NUMBER_OF_OFDM_CARRIERS];
__m64 *tgt_sch64 = (__m64 *)tgt_sch;
register __m64 mm0, mm1, mm2;
int i,i2;
unsigned char log2_avg,log2_perror_amp;
int ind, ind64;
perror.r = 0;
perror.i = 0;
perror32.r = 0;
perror32.i = 0;
// Reference SCH
Rsch = (struct complex16 *) ref_sch;
// SCH to be de-rotated
Rsymb = (struct complex16 *) tgt_sch;
// The following code copies the data from *tgt_sch to *Rsymb64 and
// converts it into the following format: | Re0 Im0 Re0 Im0 || Re1 Im1 Re1 Im1 |
i2=0;
for(i=0; i<((NUMBER_OF_OFDM_CARRIERS)>>1); i++) { // reverse 2 complex samples at a time => does the loop size>>1 times
mm0 = tgt_sch64[i];
mm1 = mm0;
mm2 = mm0;
mm1 = _m_punpckldq(mm1,mm0);
mm2 = _m_punpckhdq(mm2,mm0);
Rsymb64[i2++]=mm1; // get the output index (reverse bit ordering index)
Rsymb64[i2++]=mm2;
}
// inner product of received CHSCH in pilot positions and received symbol
mm1 = _m_pxor (mm1, mm1);
for (i = 0; i < NUMBER_OF_OFDM_CARRIERS; i++) {
// Indices
ind = i;
//ind64 = i;
// Pure C version
// perror32.r += ( (((int)Rsch[ind].r*(int)Rsymb[ind].r) >> PERROR_SHIFT) + (((int)Rsch[ind].i*(int)Rsymb[ind].i) >> PERROR_SHIFT) );
// perror32.i += ( (((int)Rsch[ind].i*(int)Rsymb[ind].r) >> PERROR_SHIFT) - (((int)Rsch[ind].r*(int)Rsymb[ind].i) >> PERROR_SHIFT) );
// MMX version
((short *) &Rsch64)[0] = Rsch[ind].r;
((short *) &Rsch64)[1] = Rsch[ind].i;
((short *) &Rsch64)[2] = Rsch[ind].r;
((short *) &Rsch64)[3] = Rsch[ind].i;
// Initializing the vector for complex mult
((short *) &Rsymb_conj64)[0] = Rsymb[ind].r;
((short *) &Rsymb_conj64)[1] = Rsymb[ind].i;
((short *) &Rsymb_conj64)[2] = -Rsymb[ind].i;
((short *) &Rsymb_conj64)[3] = Rsymb[ind].r;
//Complex multiplication 16 -> 32 bits
mm0 = _mm_madd_pi16 (Rsch64, Rsymb_conj64);
mm1 = _mm_add_pi32 (mm0, mm1);
}
// Believe me... this is a bitwise shift! (bringing back to 16 bits)
perror64 = _mm_srai_pi32 (mm1, PERROR_SHIFT + LOG2_NUMBER_OF_OFDM_CARRIERS);
perror.r = ((short *) &perror64)[0];
perror.i = ((short *) &perror64)[2];
// perror.r = (short)(perror32.r >> LOG2_NUMBER_OF_OFDM_CARRIERS);
// perror.i = (short)(perror32.i >> LOG2_NUMBER_OF_OFDM_CARRIERS);
// base shift for rotation on amplitude first OFDM symbol only (might be better to compute the max over the CHBCH)
// if (aa == 0)
// {
// For normalization in the following routine
log2_perror_amp = log2_approx((unsigned int) ((int)(perror.r * perror.r) + (int)(perror.i * perror.i))) >> 1;
// }
*perror_out = perror;
// Apply rotation
rotate_cpx_vector ((short *) Rsymb64, (short *) &perror, (short *) out_sym, NUMBER_OF_OFDM_CARRIERS, log2_perror_amp,0);
}
File diff suppressed because it is too large Load Diff
-286
View File
@@ -1,286 +0,0 @@
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
short twiddle_fft128[127*4] = {16384,0,0,16384,
16384,0,0,16384,
0,16384,-16384,0,
16384,0,0,16384,
11585,11585,-11585,11585,
0,16384,-16384,0,
-11585,11585,-11585,-11585,
16384,0,0,16384,
15137,6270,-6270,15137,
11585,11585,-11585,11585,
6270,15137,-15137,6270,
0,16384,-16384,0,
-6270,15137,-15137,-6270,
-11585,11585,-11585,-11585,
-15137,6270,-6270,-15137,
16384,0,0,16384,
16069,3196,-3196,16069,
15137,6270,-6270,15137,
13623,9102,-9102,13623,
11585,11585,-11585,11585,
9102,13623,-13623,9102,
6270,15137,-15137,6270,
3196,16069,-16069,3196,
0,16384,-16384,0,
-3196,16069,-16069,-3196,
-6270,15137,-15137,-6270,
-9102,13623,-13623,-9102,
-11585,11585,-11585,-11585,
-13623,9102,-9102,-13623,
-15137,6270,-6270,-15137,
-16069,3196,-3196,-16069,
16384,0,0,16384,
16305,1606,-1606,16305,
16069,3196,-3196,16069,
15679,4756,-4756,15679,
15137,6270,-6270,15137,
14449,7723,-7723,14449,
13623,9102,-9102,13623,
12665,10394,-10394,12665,
11585,11585,-11585,11585,
10394,12665,-12665,10394,
9102,13623,-13623,9102,
7723,14449,-14449,7723,
6270,15137,-15137,6270,
4756,15679,-15679,4756,
3196,16069,-16069,3196,
1606,16305,-16305,1606,
0,16384,-16384,0,
-1606,16305,-16305,-1606,
-3196,16069,-16069,-3196,
-4756,15679,-15679,-4756,
-6270,15137,-15137,-6270,
-7723,14449,-14449,-7723,
-9102,13623,-13623,-9102,
-10394,12665,-12665,-10394,
-11585,11585,-11585,-11585,
-12665,10394,-10394,-12665,
-13623,9102,-9102,-13623,
-14449,7723,-7723,-14449,
-15137,6270,-6270,-15137,
-15679,4756,-4756,-15679,
-16069,3196,-3196,-16069,
-16305,1606,-1606,-16305,
16384,0,0,16384,
16364,804,-804,16364,
16305,1606,-1606,16305,
16207,2404,-2404,16207,
16069,3196,-3196,16069,
15893,3981,-3981,15893,
15679,4756,-4756,15679,
15426,5520,-5520,15426,
15137,6270,-6270,15137,
14811,7005,-7005,14811,
14449,7723,-7723,14449,
14053,8423,-8423,14053,
13623,9102,-9102,13623,
13160,9760,-9760,13160,
12665,10394,-10394,12665,
12140,11003,-11003,12140,
11585,11585,-11585,11585,
11003,12140,-12140,11003,
10394,12665,-12665,10394,
9760,13160,-13160,9760,
9102,13623,-13623,9102,
8423,14053,-14053,8423,
7723,14449,-14449,7723,
7005,14811,-14811,7005,
6270,15137,-15137,6270,
5520,15426,-15426,5520,
4756,15679,-15679,4756,
3981,15893,-15893,3981,
3196,16069,-16069,3196,
2404,16207,-16207,2404,
1606,16305,-16305,1606,
804,16364,-16364,804,
0,16384,-16384,0,
-804,16364,-16364,-804,
-1606,16305,-16305,-1606,
-2404,16207,-16207,-2404,
-3196,16069,-16069,-3196,
-3981,15893,-15893,-3981,
-4756,15679,-15679,-4756,
-5520,15426,-15426,-5520,
-6270,15137,-15137,-6270,
-7005,14811,-14811,-7005,
-7723,14449,-14449,-7723,
-8423,14053,-14053,-8423,
-9102,13623,-13623,-9102,
-9760,13160,-13160,-9760,
-10394,12665,-12665,-10394,
-11003,12140,-12140,-11003,
-11585,11585,-11585,-11585,
-12140,11003,-11003,-12140,
-12665,10394,-10394,-12665,
-13160,9760,-9760,-13160,
-13623,9102,-9102,-13623,
-14053,8423,-8423,-14053,
-14449,7723,-7723,-14449,
-14811,7005,-7005,-14811,
-15137,6270,-6270,-15137,
-15426,5520,-5520,-15426,
-15679,4756,-4756,-15679,
-15893,3981,-3981,-15893,
-16069,3196,-3196,-16069,
-16207,2404,-2404,-16207,
-16305,1606,-1606,-16305,
-16364,804,-804,-16364
};
short twiddle_ifft128[127*4] = {16384,0,0,16384,
16384,0,0,16384,
0,-16384,16384,0,
16384,0,0,16384,
11585,-11585,11585,11585,
0,-16384,16384,0,
-11585,-11585,11585,-11585,
16384,0,0,16384,
15137,-6270,6270,15137,
11585,-11585,11585,11585,
6270,-15137,15137,6270,
0,-16384,16384,0,
-6270,-15137,15137,-6270,
-11585,-11585,11585,-11585,
-15137,-6270,6270,-15137,
16384,0,0,16384,
16069,-3196,3196,16069,
15137,-6270,6270,15137,
13623,-9102,9102,13623,
11585,-11585,11585,11585,
9102,-13623,13623,9102,
6270,-15137,15137,6270,
3196,-16069,16069,3196,
0,-16384,16384,0,
-3196,-16069,16069,-3196,
-6270,-15137,15137,-6270,
-9102,-13623,13623,-9102,
-11585,-11585,11585,-11585,
-13623,-9102,9102,-13623,
-15137,-6270,6270,-15137,
-16069,-3196,3196,-16069,
16384,0,0,16384,
16305,-1606,1606,16305,
16069,-3196,3196,16069,
15679,-4756,4756,15679,
15137,-6270,6270,15137,
14449,-7723,7723,14449,
13623,-9102,9102,13623,
12665,-10394,10394,12665,
11585,-11585,11585,11585,
10394,-12665,12665,10394,
9102,-13623,13623,9102,
7723,-14449,14449,7723,
6270,-15137,15137,6270,
4756,-15679,15679,4756,
3196,-16069,16069,3196,
1606,-16305,16305,1606,
0,-16384,16384,0,
-1606,-16305,16305,-1606,
-3196,-16069,16069,-3196,
-4756,-15679,15679,-4756,
-6270,-15137,15137,-6270,
-7723,-14449,14449,-7723,
-9102,-13623,13623,-9102,
-10394,-12665,12665,-10394,
-11585,-11585,11585,-11585,
-12665,-10394,10394,-12665,
-13623,-9102,9102,-13623,
-14449,-7723,7723,-14449,
-15137,-6270,6270,-15137,
-15679,-4756,4756,-15679,
-16069,-3196,3196,-16069,
-16305,-1606,1606,-16305,
16384,0,0,16384,
16364,-804,804,16364,
16305,-1606,1606,16305,
16207,-2404,2404,16207,
16069,-3196,3196,16069,
15893,-3981,3981,15893,
15679,-4756,4756,15679,
15426,-5520,5520,15426,
15137,-6270,6270,15137,
14811,-7005,7005,14811,
14449,-7723,7723,14449,
14053,-8423,8423,14053,
13623,-9102,9102,13623,
13160,-9760,9760,13160,
12665,-10394,10394,12665,
12140,-11003,11003,12140,
11585,-11585,11585,11585,
11003,-12140,12140,11003,
10394,-12665,12665,10394,
9760,-13160,13160,9760,
9102,-13623,13623,9102,
8423,-14053,14053,8423,
7723,-14449,14449,7723,
7005,-14811,14811,7005,
6270,-15137,15137,6270,
5520,-15426,15426,5520,
4756,-15679,15679,4756,
3981,-15893,15893,3981,
3196,-16069,16069,3196,
2404,-16207,16207,2404,
1606,-16305,16305,1606,
804,-16364,16364,804,
0,-16384,16384,0,
-804,-16364,16364,-804,
-1606,-16305,16305,-1606,
-2404,-16207,16207,-2404,
-3196,-16069,16069,-3196,
-3981,-15893,15893,-3981,
-4756,-15679,15679,-4756,
-5520,-15426,15426,-5520,
-6270,-15137,15137,-6270,
-7005,-14811,14811,-7005,
-7723,-14449,14449,-7723,
-8423,-14053,14053,-8423,
-9102,-13623,13623,-9102,
-9760,-13160,13160,-9760,
-10394,-12665,12665,-10394,
-11003,-12140,12140,-11003,
-11585,-11585,11585,-11585,
-12140,-11003,11003,-12140,
-12665,-10394,10394,-12665,
-13160,-9760,9760,-13160,
-13623,-9102,9102,-13623,
-14053,-8423,8423,-14053,
-14449,-7723,7723,-14449,
-14811,-7005,7005,-14811,
-15137,-6270,6270,-15137,
-15426,-5520,5520,-15426,
-15679,-4756,4756,-15679,
-15893,-3981,3981,-15893,
-16069,-3196,3196,-16069,
-16207,-2404,2404,-16207,
-16305,-1606,1606,-16305,
-16364,-804,804,-16364
};
File diff suppressed because it is too large Load Diff
-542
View File
@@ -1,542 +0,0 @@
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
short twiddle_fft256[255*4] = {16384,0,0,16384,
16384,0,0,16384,
0,16384,-16384,0,
16384,0,0,16384,
11585,11585,-11585,11585,
0,16384,-16384,0,
-11585,11585,-11585,-11585,
16384,0,0,16384,
15137,6270,-6270,15137,
11585,11585,-11585,11585,
6270,15137,-15137,6270,
0,16384,-16384,0,
-6270,15137,-15137,-6270,
-11585,11585,-11585,-11585,
-15137,6270,-6270,-15137,
16384,0,0,16384,
16069,3196,-3196,16069,
15137,6270,-6270,15137,
13623,9102,-9102,13623,
11585,11585,-11585,11585,
9102,13623,-13623,9102,
6270,15137,-15137,6270,
3196,16069,-16069,3196,
0,16384,-16384,0,
-3196,16069,-16069,-3196,
-6270,15137,-15137,-6270,
-9102,13623,-13623,-9102,
-11585,11585,-11585,-11585,
-13623,9102,-9102,-13623,
-15137,6270,-6270,-15137,
-16069,3196,-3196,-16069,
16384,0,0,16384,
16305,1606,-1606,16305,
16069,3196,-3196,16069,
15679,4756,-4756,15679,
15137,6270,-6270,15137,
14449,7723,-7723,14449,
13623,9102,-9102,13623,
12665,10394,-10394,12665,
11585,11585,-11585,11585,
10394,12665,-12665,10394,
9102,13623,-13623,9102,
7723,14449,-14449,7723,
6270,15137,-15137,6270,
4756,15679,-15679,4756,
3196,16069,-16069,3196,
1606,16305,-16305,1606,
0,16384,-16384,0,
-1606,16305,-16305,-1606,
-3196,16069,-16069,-3196,
-4756,15679,-15679,-4756,
-6270,15137,-15137,-6270,
-7723,14449,-14449,-7723,
-9102,13623,-13623,-9102,
-10394,12665,-12665,-10394,
-11585,11585,-11585,-11585,
-12665,10394,-10394,-12665,
-13623,9102,-9102,-13623,
-14449,7723,-7723,-14449,
-15137,6270,-6270,-15137,
-15679,4756,-4756,-15679,
-16069,3196,-3196,-16069,
-16305,1606,-1606,-16305,
16384,0,0,16384,
16364,804,-804,16364,
16305,1606,-1606,16305,
16207,2404,-2404,16207,
16069,3196,-3196,16069,
15893,3981,-3981,15893,
15679,4756,-4756,15679,
15426,5520,-5520,15426,
15137,6270,-6270,15137,
14811,7005,-7005,14811,
14449,7723,-7723,14449,
14053,8423,-8423,14053,
13623,9102,-9102,13623,
13160,9760,-9760,13160,
12665,10394,-10394,12665,
12140,11003,-11003,12140,
11585,11585,-11585,11585,
11003,12140,-12140,11003,
10394,12665,-12665,10394,
9760,13160,-13160,9760,
9102,13623,-13623,9102,
8423,14053,-14053,8423,
7723,14449,-14449,7723,
7005,14811,-14811,7005,
6270,15137,-15137,6270,
5520,15426,-15426,5520,
4756,15679,-15679,4756,
3981,15893,-15893,3981,
3196,16069,-16069,3196,
2404,16207,-16207,2404,
1606,16305,-16305,1606,
804,16364,-16364,804,
0,16384,-16384,0,
-804,16364,-16364,-804,
-1606,16305,-16305,-1606,
-2404,16207,-16207,-2404,
-3196,16069,-16069,-3196,
-3981,15893,-15893,-3981,
-4756,15679,-15679,-4756,
-5520,15426,-15426,-5520,
-6270,15137,-15137,-6270,
-7005,14811,-14811,-7005,
-7723,14449,-14449,-7723,
-8423,14053,-14053,-8423,
-9102,13623,-13623,-9102,
-9760,13160,-13160,-9760,
-10394,12665,-12665,-10394,
-11003,12140,-12140,-11003,
-11585,11585,-11585,-11585,
-12140,11003,-11003,-12140,
-12665,10394,-10394,-12665,
-13160,9760,-9760,-13160,
-13623,9102,-9102,-13623,
-14053,8423,-8423,-14053,
-14449,7723,-7723,-14449,
-14811,7005,-7005,-14811,
-15137,6270,-6270,-15137,
-15426,5520,-5520,-15426,
-15679,4756,-4756,-15679,
-15893,3981,-3981,-15893,
-16069,3196,-3196,-16069,
-16207,2404,-2404,-16207,
-16305,1606,-1606,-16305,
-16364,804,-804,-16364,
16384,0,0,16384,
16379,402,-402,16379,
16364,804,-804,16364,
16340,1205,-1205,16340,
16305,1606,-1606,16305,
16261,2006,-2006,16261,
16207,2404,-2404,16207,
16143,2801,-2801,16143,
16069,3196,-3196,16069,
15986,3590,-3590,15986,
15893,3981,-3981,15893,
15791,4370,-4370,15791,
15679,4756,-4756,15679,
15557,5139,-5139,15557,
15426,5520,-5520,15426,
15286,5897,-5897,15286,
15137,6270,-6270,15137,
14978,6639,-6639,14978,
14811,7005,-7005,14811,
14635,7366,-7366,14635,
14449,7723,-7723,14449,
14256,8076,-8076,14256,
14053,8423,-8423,14053,
13842,8765,-8765,13842,
13623,9102,-9102,13623,
13395,9434,-9434,13395,
13160,9760,-9760,13160,
12916,10080,-10080,12916,
12665,10394,-10394,12665,
12406,10702,-10702,12406,
12140,11003,-11003,12140,
11866,11297,-11297,11866,
11585,11585,-11585,11585,
11297,11866,-11866,11297,
11003,12140,-12140,11003,
10702,12406,-12406,10702,
10394,12665,-12665,10394,
10080,12916,-12916,10080,
9760,13160,-13160,9760,
9434,13395,-13395,9434,
9102,13623,-13623,9102,
8765,13842,-13842,8765,
8423,14053,-14053,8423,
8076,14256,-14256,8076,
7723,14449,-14449,7723,
7366,14635,-14635,7366,
7005,14811,-14811,7005,
6639,14978,-14978,6639,
6270,15137,-15137,6270,
5897,15286,-15286,5897,
5520,15426,-15426,5520,
5139,15557,-15557,5139,
4756,15679,-15679,4756,
4370,15791,-15791,4370,
3981,15893,-15893,3981,
3590,15986,-15986,3590,
3196,16069,-16069,3196,
2801,16143,-16143,2801,
2404,16207,-16207,2404,
2006,16261,-16261,2006,
1606,16305,-16305,1606,
1205,16340,-16340,1205,
804,16364,-16364,804,
402,16379,-16379,402,
0,16384,-16384,0,
-402,16379,-16379,-402,
-804,16364,-16364,-804,
-1205,16340,-16340,-1205,
-1606,16305,-16305,-1606,
-2006,16261,-16261,-2006,
-2404,16207,-16207,-2404,
-2801,16143,-16143,-2801,
-3196,16069,-16069,-3196,
-3590,15986,-15986,-3590,
-3981,15893,-15893,-3981,
-4370,15791,-15791,-4370,
-4756,15679,-15679,-4756,
-5139,15557,-15557,-5139,
-5520,15426,-15426,-5520,
-5897,15286,-15286,-5897,
-6270,15137,-15137,-6270,
-6639,14978,-14978,-6639,
-7005,14811,-14811,-7005,
-7366,14635,-14635,-7366,
-7723,14449,-14449,-7723,
-8076,14256,-14256,-8076,
-8423,14053,-14053,-8423,
-8765,13842,-13842,-8765,
-9102,13623,-13623,-9102,
-9434,13395,-13395,-9434,
-9760,13160,-13160,-9760,
-10080,12916,-12916,-10080,
-10394,12665,-12665,-10394,
-10702,12406,-12406,-10702,
-11003,12140,-12140,-11003,
-11297,11866,-11866,-11297,
-11585,11585,-11585,-11585,
-11866,11297,-11297,-11866,
-12140,11003,-11003,-12140,
-12406,10702,-10702,-12406,
-12665,10394,-10394,-12665,
-12916,10080,-10080,-12916,
-13160,9760,-9760,-13160,
-13395,9434,-9434,-13395,
-13623,9102,-9102,-13623,
-13842,8765,-8765,-13842,
-14053,8423,-8423,-14053,
-14256,8076,-8076,-14256,
-14449,7723,-7723,-14449,
-14635,7366,-7366,-14635,
-14811,7005,-7005,-14811,
-14978,6639,-6639,-14978,
-15137,6270,-6270,-15137,
-15286,5897,-5897,-15286,
-15426,5520,-5520,-15426,
-15557,5139,-5139,-15557,
-15679,4756,-4756,-15679,
-15791,4370,-4370,-15791,
-15893,3981,-3981,-15893,
-15986,3590,-3590,-15986,
-16069,3196,-3196,-16069,
-16143,2801,-2801,-16143,
-16207,2404,-2404,-16207,
-16261,2006,-2006,-16261,
-16305,1606,-1606,-16305,
-16340,1205,-1205,-16340,
-16364,804,-804,-16364,
-16379,402,-402,-16379
};
short twiddle_ifft256[255*4] = {16384,0,0,16384,
16384,0,0,16384,
0,-16384,16384,0,
16384,0,0,16384,
11585,-11585,11585,11585,
0,-16384,16384,0,
-11585,-11585,11585,-11585,
16384,0,0,16384,
15137,-6270,6270,15137,
11585,-11585,11585,11585,
6270,-15137,15137,6270,
0,-16384,16384,0,
-6270,-15137,15137,-6270,
-11585,-11585,11585,-11585,
-15137,-6270,6270,-15137,
16384,0,0,16384,
16069,-3196,3196,16069,
15137,-6270,6270,15137,
13623,-9102,9102,13623,
11585,-11585,11585,11585,
9102,-13623,13623,9102,
6270,-15137,15137,6270,
3196,-16069,16069,3196,
0,-16384,16384,0,
-3196,-16069,16069,-3196,
-6270,-15137,15137,-6270,
-9102,-13623,13623,-9102,
-11585,-11585,11585,-11585,
-13623,-9102,9102,-13623,
-15137,-6270,6270,-15137,
-16069,-3196,3196,-16069,
16384,0,0,16384,
16305,-1606,1606,16305,
16069,-3196,3196,16069,
15679,-4756,4756,15679,
15137,-6270,6270,15137,
14449,-7723,7723,14449,
13623,-9102,9102,13623,
12665,-10394,10394,12665,
11585,-11585,11585,11585,
10394,-12665,12665,10394,
9102,-13623,13623,9102,
7723,-14449,14449,7723,
6270,-15137,15137,6270,
4756,-15679,15679,4756,
3196,-16069,16069,3196,
1606,-16305,16305,1606,
0,-16384,16384,0,
-1606,-16305,16305,-1606,
-3196,-16069,16069,-3196,
-4756,-15679,15679,-4756,
-6270,-15137,15137,-6270,
-7723,-14449,14449,-7723,
-9102,-13623,13623,-9102,
-10394,-12665,12665,-10394,
-11585,-11585,11585,-11585,
-12665,-10394,10394,-12665,
-13623,-9102,9102,-13623,
-14449,-7723,7723,-14449,
-15137,-6270,6270,-15137,
-15679,-4756,4756,-15679,
-16069,-3196,3196,-16069,
-16305,-1606,1606,-16305,
16384,0,0,16384,
16364,-804,804,16364,
16305,-1606,1606,16305,
16207,-2404,2404,16207,
16069,-3196,3196,16069,
15893,-3981,3981,15893,
15679,-4756,4756,15679,
15426,-5520,5520,15426,
15137,-6270,6270,15137,
14811,-7005,7005,14811,
14449,-7723,7723,14449,
14053,-8423,8423,14053,
13623,-9102,9102,13623,
13160,-9760,9760,13160,
12665,-10394,10394,12665,
12140,-11003,11003,12140,
11585,-11585,11585,11585,
11003,-12140,12140,11003,
10394,-12665,12665,10394,
9760,-13160,13160,9760,
9102,-13623,13623,9102,
8423,-14053,14053,8423,
7723,-14449,14449,7723,
7005,-14811,14811,7005,
6270,-15137,15137,6270,
5520,-15426,15426,5520,
4756,-15679,15679,4756,
3981,-15893,15893,3981,
3196,-16069,16069,3196,
2404,-16207,16207,2404,
1606,-16305,16305,1606,
804,-16364,16364,804,
0,-16384,16384,0,
-804,-16364,16364,-804,
-1606,-16305,16305,-1606,
-2404,-16207,16207,-2404,
-3196,-16069,16069,-3196,
-3981,-15893,15893,-3981,
-4756,-15679,15679,-4756,
-5520,-15426,15426,-5520,
-6270,-15137,15137,-6270,
-7005,-14811,14811,-7005,
-7723,-14449,14449,-7723,
-8423,-14053,14053,-8423,
-9102,-13623,13623,-9102,
-9760,-13160,13160,-9760,
-10394,-12665,12665,-10394,
-11003,-12140,12140,-11003,
-11585,-11585,11585,-11585,
-12140,-11003,11003,-12140,
-12665,-10394,10394,-12665,
-13160,-9760,9760,-13160,
-13623,-9102,9102,-13623,
-14053,-8423,8423,-14053,
-14449,-7723,7723,-14449,
-14811,-7005,7005,-14811,
-15137,-6270,6270,-15137,
-15426,-5520,5520,-15426,
-15679,-4756,4756,-15679,
-15893,-3981,3981,-15893,
-16069,-3196,3196,-16069,
-16207,-2404,2404,-16207,
-16305,-1606,1606,-16305,
-16364,-804,804,-16364,
16384,0,0,16384,
16379,-402,402,16379,
16364,-804,804,16364,
16340,-1205,1205,16340,
16305,-1606,1606,16305,
16261,-2006,2006,16261,
16207,-2404,2404,16207,
16143,-2801,2801,16143,
16069,-3196,3196,16069,
15986,-3590,3590,15986,
15893,-3981,3981,15893,
15791,-4370,4370,15791,
15679,-4756,4756,15679,
15557,-5139,5139,15557,
15426,-5520,5520,15426,
15286,-5897,5897,15286,
15137,-6270,6270,15137,
14978,-6639,6639,14978,
14811,-7005,7005,14811,
14635,-7366,7366,14635,
14449,-7723,7723,14449,
14256,-8076,8076,14256,
14053,-8423,8423,14053,
13842,-8765,8765,13842,
13623,-9102,9102,13623,
13395,-9434,9434,13395,
13160,-9760,9760,13160,
12916,-10080,10080,12916,
12665,-10394,10394,12665,
12406,-10702,10702,12406,
12140,-11003,11003,12140,
11866,-11297,11297,11866,
11585,-11585,11585,11585,
11297,-11866,11866,11297,
11003,-12140,12140,11003,
10702,-12406,12406,10702,
10394,-12665,12665,10394,
10080,-12916,12916,10080,
9760,-13160,13160,9760,
9434,-13395,13395,9434,
9102,-13623,13623,9102,
8765,-13842,13842,8765,
8423,-14053,14053,8423,
8076,-14256,14256,8076,
7723,-14449,14449,7723,
7366,-14635,14635,7366,
7005,-14811,14811,7005,
6639,-14978,14978,6639,
6270,-15137,15137,6270,
5897,-15286,15286,5897,
5520,-15426,15426,5520,
5139,-15557,15557,5139,
4756,-15679,15679,4756,
4370,-15791,15791,4370,
3981,-15893,15893,3981,
3590,-15986,15986,3590,
3196,-16069,16069,3196,
2801,-16143,16143,2801,
2404,-16207,16207,2404,
2006,-16261,16261,2006,
1606,-16305,16305,1606,
1205,-16340,16340,1205,
804,-16364,16364,804,
402,-16379,16379,402,
0,-16384,16384,0,
-402,-16379,16379,-402,
-804,-16364,16364,-804,
-1205,-16340,16340,-1205,
-1606,-16305,16305,-1606,
-2006,-16261,16261,-2006,
-2404,-16207,16207,-2404,
-2801,-16143,16143,-2801,
-3196,-16069,16069,-3196,
-3590,-15986,15986,-3590,
-3981,-15893,15893,-3981,
-4370,-15791,15791,-4370,
-4756,-15679,15679,-4756,
-5139,-15557,15557,-5139,
-5520,-15426,15426,-5520,
-5897,-15286,15286,-5897,
-6270,-15137,15137,-6270,
-6639,-14978,14978,-6639,
-7005,-14811,14811,-7005,
-7366,-14635,14635,-7366,
-7723,-14449,14449,-7723,
-8076,-14256,14256,-8076,
-8423,-14053,14053,-8423,
-8765,-13842,13842,-8765,
-9102,-13623,13623,-9102,
-9434,-13395,13395,-9434,
-9760,-13160,13160,-9760,
-10080,-12916,12916,-10080,
-10394,-12665,12665,-10394,
-10702,-12406,12406,-10702,
-11003,-12140,12140,-11003,
-11297,-11866,11866,-11297,
-11585,-11585,11585,-11585,
-11866,-11297,11297,-11866,
-12140,-11003,11003,-12140,
-12406,-10702,10702,-12406,
-12665,-10394,10394,-12665,
-12916,-10080,10080,-12916,
-13160,-9760,9760,-13160,
-13395,-9434,9434,-13395,
-13623,-9102,9102,-13623,
-13842,-8765,8765,-13842,
-14053,-8423,8423,-14053,
-14256,-8076,8076,-14256,
-14449,-7723,7723,-14449,
-14635,-7366,7366,-14635,
-14811,-7005,7005,-14811,
-14978,-6639,6639,-14978,
-15137,-6270,6270,-15137,
-15286,-5897,5897,-15286,
-15426,-5520,5520,-15426,
-15557,-5139,5139,-15557,
-15679,-4756,4756,-15679,
-15791,-4370,4370,-15791,
-15893,-3981,3981,-15893,
-15986,-3590,3590,-15986,
-16069,-3196,3196,-16069,
-16143,-2801,2801,-16143,
-16207,-2404,2404,-16207,
-16261,-2006,2006,-16261,
-16305,-1606,1606,-16305,
-16340,-1205,1205,-16340,
-16364,-804,804,-16364,
-16379,-402,402,-16379
};
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-158
View File
@@ -1,158 +0,0 @@
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
short twiddle_fft64[63*4] = {16384,0,0,16384,
16384,0,0,16384,
0,16384,-16384,0,
16384,0,0,16384,
11585,11585,-11585,11585,
0,16384,-16384,0,
-11585,11585,-11585,-11585,
16384,0,0,16384,
15137,6270,-6270,15137,
11585,11585,-11585,11585,
6270,15137,-15137,6270,
0,16384,-16384,0,
-6270,15137,-15137,-6270,
-11585,11585,-11585,-11585,
-15137,6270,-6270,-15137,
16384,0,0,16384,
16069,3196,-3196,16069,
15137,6270,-6270,15137,
13623,9102,-9102,13623,
11585,11585,-11585,11585,
9102,13623,-13623,9102,
6270,15137,-15137,6270,
3196,16069,-16069,3196,
0,16384,-16384,0,
-3196,16069,-16069,-3196,
-6270,15137,-15137,-6270,
-9102,13623,-13623,-9102,
-11585,11585,-11585,-11585,
-13623,9102,-9102,-13623,
-15137,6270,-6270,-15137,
-16069,3196,-3196,-16069,
16384,0,0,16384,
16305,1606,-1606,16305,
16069,3196,-3196,16069,
15679,4756,-4756,15679,
15137,6270,-6270,15137,
14449,7723,-7723,14449,
13623,9102,-9102,13623,
12665,10394,-10394,12665,
11585,11585,-11585,11585,
10394,12665,-12665,10394,
9102,13623,-13623,9102,
7723,14449,-14449,7723,
6270,15137,-15137,6270,
4756,15679,-15679,4756,
3196,16069,-16069,3196,
1606,16305,-16305,1606,
0,16384,-16384,0,
-1606,16305,-16305,-1606,
-3196,16069,-16069,-3196,
-4756,15679,-15679,-4756,
-6270,15137,-15137,-6270,
-7723,14449,-14449,-7723,
-9102,13623,-13623,-9102,
-10394,12665,-12665,-10394,
-11585,11585,-11585,-11585,
-12665,10394,-10394,-12665,
-13623,9102,-9102,-13623,
-14449,7723,-7723,-14449,
-15137,6270,-6270,-15137,
-15679,4756,-4756,-15679,
-16069,3196,-3196,-16069,
-16305,1606,-1606,-16305
};
short twiddle_ifft64[63*4] = {16384,0,0,16384,
16384,0,0,16384,
0,-16384,16384,0,
16384,0,0,16384,
11585,-11585,11585,11585,
0,-16384,16384,0,
-11585,-11585,11585,-11585,
16384,0,0,16384,
15137,-6270,6270,15137,
11585,-11585,11585,11585,
6270,-15137,15137,6270,
0,-16384,16384,0,
-6270,-15137,15137,-6270,
-11585,-11585,11585,-11585,
-15137,-6270,6270,-15137,
16384,0,0,16384,
16069,-3196,3196,16069,
15137,-6270,6270,15137,
13623,-9102,9102,13623,
11585,-11585,11585,11585,
9102,-13623,13623,9102,
6270,-15137,15137,6270,
3196,-16069,16069,3196,
0,-16384,16384,0,
-3196,-16069,16069,-3196,
-6270,-15137,15137,-6270,
-9102,-13623,13623,-9102,
-11585,-11585,11585,-11585,
-13623,-9102,9102,-13623,
-15137,-6270,6270,-15137,
-16069,-3196,3196,-16069,
16384,0,0,16384,
16305,-1606,1606,16305,
16069,-3196,3196,16069,
15679,-4756,4756,15679,
15137,-6270,6270,15137,
14449,-7723,7723,14449,
13623,-9102,9102,13623,
12665,-10394,10394,12665,
11585,-11585,11585,11585,
10394,-12665,12665,10394,
9102,-13623,13623,9102,
7723,-14449,14449,7723,
6270,-15137,15137,6270,
4756,-15679,15679,4756,
3196,-16069,16069,3196,
1606,-16305,16305,1606,
0,-16384,16384,0,
-1606,-16305,16305,-1606,
-3196,-16069,16069,-3196,
-4756,-15679,15679,-4756,
-6270,-15137,15137,-6270,
-7723,-14449,14449,-7723,
-9102,-13623,13623,-9102,
-10394,-12665,12665,-10394,
-11585,-11585,11585,-11585,
-12665,-10394,10394,-12665,
-13623,-9102,9102,-13623,
-14449,-7723,7723,-14449,
-15137,-6270,6270,-15137,
-15679,-4756,4756,-15679,
-16069,-3196,3196,-16069,
-16305,-1606,1606,-16305
};
File diff suppressed because it is too large Load Diff
-47
View File
@@ -1,47 +0,0 @@
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
extern short twiddle_fft64[];
extern short twiddle_ifft64[];
extern short twiddle_fft128[];
extern short twiddle_ifft128[];
extern short twiddle_fft256[];
extern short twiddle_ifft256[];
extern short twiddle_fft512[];
extern short twiddle_ifft512[];
extern short twiddle_fft1024[];
extern short twiddle_ifft1024[];
extern short twiddle_fft2048[];
extern short twiddle_ifft2048[];
extern short twiddle_fft4096[];
extern short twiddle_ifft4096[];
extern short twiddle_fft8192[];
extern short twiddle_ifft8192[];
extern short twiddle_fft32768[];
File diff suppressed because one or more lines are too long
+1 -3
View File
@@ -30,7 +30,7 @@
#define __PHY_EXTERN_H__ #define __PHY_EXTERN_H__
#include "PHY/defs.h" #include "PHY/defs.h"
#include "PHY/TOOLS/twiddle_extern.h"
extern char* namepointer_chMag ; extern char* namepointer_chMag ;
extern char* namepointer_log2; extern char* namepointer_log2;
@@ -38,8 +38,6 @@ extern char fmageren_name2[512];
extern unsigned int RX_DMA_BUFFER[4][NB_ANTENNAS_RX]; extern unsigned int RX_DMA_BUFFER[4][NB_ANTENNAS_RX];
extern unsigned int TX_DMA_BUFFER[4][NB_ANTENNAS_TX]; extern unsigned int TX_DMA_BUFFER[4][NB_ANTENNAS_TX];
extern short *twiddle_fft,*twiddle_ifft,*twiddle_fft_times4,*twiddle_ifft_times4,*twiddle_fft_half,*twiddle_ifft_half;
extern unsigned short rev[2048],rev_times4[8192],rev_half[1024],rev1024[1024],rev256[256],rev512[512],rev2048[2048],rev4096[4096],rev8192[8192];
#ifdef OPENAIR_LTE #ifdef OPENAIR_LTE
#include "PHY/LTE_TRANSPORT/extern.h" #include "PHY/LTE_TRANSPORT/extern.h"
-6
View File
@@ -534,12 +534,6 @@ typedef struct {
uint8_t nb_antennas_rx; uint8_t nb_antennas_rx;
/// Number of Transmit antennas in eNodeB /// Number of Transmit antennas in eNodeB
uint8_t nb_antennas_tx_eNB; uint8_t nb_antennas_tx_eNB;
/// Pointer to twiddle factors for FFT
int16_t *twiddle_fft;
///pointer to twiddle factors for IFFT
int16_t *twiddle_ifft;
///pointer to FFT permutation vector
uint16_t *rev;
/// PRACH_CONFIG /// PRACH_CONFIG
PRACH_CONFIG_COMMON prach_config_common; PRACH_CONFIG_COMMON prach_config_common;
/// PUCCH Config Common (from 36-331 RRC spec) /// PUCCH Config Common (from 36-331 RRC spec)
+4 -21
View File
@@ -42,22 +42,12 @@ char fmageren_name2[512];
char* namepointer_log2; char* namepointer_log2;
//PHY_CONFIG *PHY_config; //PHY_CONFIG *PHY_config;
#include "PHY/TOOLS/twiddle64.h"
#include "PHY/TOOLS/twiddle128.h"
#include "PHY/TOOLS/twiddle256.h"
#include "PHY/TOOLS/twiddle512.h"
#include "PHY/TOOLS/twiddle1024.h"
#include "PHY/TOOLS/twiddle2048.h"
#include "PHY/TOOLS/twiddle4096.h"
#include "PHY/TOOLS/twiddle8192.h"
#include "PHY/TOOLS/twiddle32768.h"
#ifdef OPENAIR_LTE
#include "PHY/LTE_REFSIG/primary_synch.h" #include "PHY/LTE_REFSIG/primary_synch.h"
int16_t *primary_synch0_time; int16_t *primary_synch0_time;
int16_t *primary_synch1_time; int16_t *primary_synch1_time;
int16_t *primary_synch2_time; int16_t *primary_synch2_time;
#endif
#include "PHY/CODING/vars.h" #include "PHY/CODING/vars.h"
@@ -67,25 +57,18 @@ PHY_VARS_eNB ***PHY_vars_eNB_g;
PHY_VARS_RN **PHY_vars_RN_g; PHY_VARS_RN **PHY_vars_RN_g;
LTE_DL_FRAME_PARMS *lte_frame_parms_g; LTE_DL_FRAME_PARMS *lte_frame_parms_g;
short *twiddle_ifft,*twiddle_fft,*twiddle_fft_times4,*twiddle_ifft_times4,*twiddle_fft_half,*twiddle_ifft_half;
#ifndef OPENAIR_LTE
CHBCH_RX_t rx_mode = ML;
#endif //OPENAIR_LTE
unsigned short rev[2048],rev_times4[8192],rev_half[1024]; unsigned short rev[2048],rev_times4[8192],rev_half[1024];
unsigned short rev256[256],rev512[512],rev1024[1024],rev4096[4096],rev2048[2048],rev8192[8192]; unsigned short rev256[256],rev512[512],rev1024[1024],rev4096[4096],rev2048[2048],rev8192[8192];
#ifdef OPENAIR_LTE
char mode_string[4][20] = {"NOT SYNCHED","PRACH","RAR","PUSCH"}; char mode_string[4][20] = {"NOT SYNCHED","PRACH","RAR","PUSCH"};
#include "PHY/LTE_TRANSPORT/vars.h" #include "PHY/LTE_TRANSPORT/vars.h"
#endif
#include "PHY/CODING/scrambler.h"
#ifdef USER_MODE
#include "SIMULATION/ETH_TRANSPORT/vars.h" #include "SIMULATION/ETH_TRANSPORT/vars.h"
#endif
#ifndef OPENAIR2 #ifndef OPENAIR2
unsigned char NB_eNB_INST=0; unsigned char NB_eNB_INST=0;
+4 -5
View File
@@ -1033,10 +1033,11 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
phy_vars_ue->tx_total_RE = 12; phy_vars_ue->tx_total_RE = 12;
if (SR_payload>0) { if (SR_payload>0) {
LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d Generating PUCCH 1a/1b (with SR for PUSCH), n1_pucch %d, Po_PUCCH, amp %d\n", LOG_D(PHY,"[UE %d][SR %x] Frame %d subframe %d Generating PUCCH 1a/1b payload %d,%d (with SR for PUSCH), n1_pucch %d, Po_PUCCH, amp %d\n",
Mod_id, Mod_id,
phy_vars_ue->dlsch_ue[eNB_id][0]->rnti, phy_vars_ue->dlsch_ue[eNB_id][0]->rnti,
frame_tx, subframe_tx, frame_tx, subframe_tx,
pucch_ack_payload[0],pucch_ack_payload[1],
phy_vars_ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex, phy_vars_ue->scheduling_request_config[eNB_id].sr_PUCCH_ResourceIndex,
Po_PUCCH, Po_PUCCH,
#if defined(EXMIMO) || defined(OAI_USRP) #if defined(EXMIMO) || defined(OAI_USRP)
@@ -1050,7 +1051,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
Mod_id, Mod_id,
phy_vars_ue->dlsch_ue[eNB_id][0]->rnti, phy_vars_ue->dlsch_ue[eNB_id][0]->rnti,
frame_tx, subframe_tx, frame_tx, subframe_tx,
n1_pucch,pucch_ack_payload[0],pucch_ack_payload[1],SR_payload, n1_pucch,pucch_ack_payload[0],pucch_ack_payload[1],SR_payload,
Po_PUCCH, Po_PUCCH,
#if defined(EXMIMO) || defined(OAI_USRP) #if defined(EXMIMO) || defined(OAI_USRP)
get_tx_amp(Po_PUCCH,phy_vars_ue->tx_power_max_dBm) get_tx_amp(Po_PUCCH,phy_vars_ue->tx_power_max_dBm)
@@ -1229,8 +1230,6 @@ void phy_procedures_UE_TX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstra
frame_parms->log2_symbol_size, frame_parms->log2_symbol_size,
nsymb, nsymb,
frame_parms->nb_prefix_samples, frame_parms->nb_prefix_samples,
frame_parms->twiddle_ifft,
frame_parms->rev,
CYCLIC_PREFIX); CYCLIC_PREFIX);
else else
normal_prefix_mod(&phy_vars_ue->lte_ue_common_vars.txdataF[aa][subframe_tx*nsymb*frame_parms->ofdm_symbol_size], normal_prefix_mod(&phy_vars_ue->lte_ue_common_vars.txdataF[aa][subframe_tx*nsymb*frame_parms->ofdm_symbol_size],
@@ -2615,7 +2614,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t abstrac
phy_vars_ue->Mod_id, phy_vars_ue->Mod_id,
phy_vars_ue->dlsch_ue[eNB_id][0]->rnti, phy_vars_ue->dlsch_ue[eNB_id][0]->rnti,
harq_pid, harq_pid,
frame_rx,subframe_prev); (subframe_prev == 9) ? (frame_rx-1) : frame_rx,subframe_prev);
#endif #endif
if (phy_vars_ue->dlsch_ue[eNB_id][0]) { if (phy_vars_ue->dlsch_ue[eNB_id][0]) {
+1 -7
View File
@@ -148,11 +148,7 @@ void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmi
//copy_lte_parms_to_phy_framing(lte_frame_parms, &(PHY_config->PHY_framing)); //copy_lte_parms_to_phy_framing(lte_frame_parms, &(PHY_config->PHY_framing));
phy_init_top(lte_frame_parms); //allocation // phy_init_top(lte_frame_parms); //allocation
lte_frame_parms->twiddle_fft = twiddle_fft;
lte_frame_parms->twiddle_ifft = twiddle_ifft;
lte_frame_parms->rev = rev;
PHY_vars_UE->is_secondary_ue = 0; PHY_vars_UE->is_secondary_ue = 0;
PHY_vars_UE->lte_frame_parms = *lte_frame_parms; PHY_vars_UE->lte_frame_parms = *lte_frame_parms;
@@ -221,8 +217,6 @@ void do_OFDM_mod_l(mod_sym_t **txdataF, int32_t **txdata, uint16_t next_slot, LT
frame_parms->log2_symbol_size, // log2_fft_size frame_parms->log2_symbol_size, // log2_fft_size
6, // number of symbols 6, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples frame_parms->nb_prefix_samples, // number of prefix samples
frame_parms->twiddle_ifft, // IFFT twiddle factors
frame_parms->rev, // bit-reversal permutation
CYCLIC_PREFIX); CYCLIC_PREFIX);
else { else {
normal_prefix_mod(&txdataF[aa][slot_offset_F], normal_prefix_mod(&txdataF[aa][slot_offset_F],
-8
View File
@@ -100,12 +100,6 @@ void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmi
//copy_lte_parms_to_phy_framing(lte_frame_parms, &(PHY_config->PHY_framing)); //copy_lte_parms_to_phy_framing(lte_frame_parms, &(PHY_config->PHY_framing));
phy_init_top(lte_frame_parms); //allocation
lte_frame_parms->twiddle_fft = twiddle_fft;
lte_frame_parms->twiddle_ifft = twiddle_ifft;
lte_frame_parms->rev = rev;
PHY_vars_UE->is_secondary_ue = 0; PHY_vars_UE->is_secondary_ue = 0;
PHY_vars_UE->lte_frame_parms = *lte_frame_parms; PHY_vars_UE->lte_frame_parms = *lte_frame_parms;
PHY_vars_eNB->lte_frame_parms = *lte_frame_parms; PHY_vars_eNB->lte_frame_parms = *lte_frame_parms;
@@ -480,8 +474,6 @@ int main(int argc, char **argv)
frame_parms->log2_symbol_size, // log2_fft_size frame_parms->log2_symbol_size, // log2_fft_size
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*nsymb, // number of symbols LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*nsymb, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples frame_parms->nb_prefix_samples, // number of prefix samples
frame_parms->twiddle_ifft, // IFFT twiddle factors
frame_parms->rev, // bit-reversal permutation
CYCLIC_PREFIX); CYCLIC_PREFIX);
if (n_frames==1) { if (n_frames==1) {
-12
View File
@@ -101,12 +101,6 @@ void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmi
//copy_lte_parms_to_phy_framing(lte_frame_parms, &(PHY_config->PHY_framing)); //copy_lte_parms_to_phy_framing(lte_frame_parms, &(PHY_config->PHY_framing));
phy_init_top(lte_frame_parms); //allocation
lte_frame_parms->twiddle_fft = twiddle_fft;
lte_frame_parms->twiddle_ifft = twiddle_ifft;
lte_frame_parms->rev = rev;
PHY_vars_UE->lte_frame_parms = *lte_frame_parms; PHY_vars_UE->lte_frame_parms = *lte_frame_parms;
phy_init_lte_top(lte_frame_parms); phy_init_lte_top(lte_frame_parms);
@@ -758,8 +752,6 @@ int main(int argc, char **argv)
frame_parms->log2_symbol_size, // log2_fft_size frame_parms->log2_symbol_size, // log2_fft_size
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*nsymb, // number of symbols LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*nsymb, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples frame_parms->nb_prefix_samples, // number of prefix samples
frame_parms->twiddle_ifft, // IFFT twiddle factors
frame_parms->rev, // bit-reversal permutation
CYCLIC_PREFIX); CYCLIC_PREFIX);
else { 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],
@@ -780,8 +772,6 @@ int main(int argc, char **argv)
frame_parms->log2_symbol_size, // log2_fft_size frame_parms->log2_symbol_size, // log2_fft_size
2*nsymb, // number of symbols 2*nsymb, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples frame_parms->nb_prefix_samples, // number of prefix samples
frame_parms->twiddle_ifft, // IFFT twiddle factors
frame_parms->rev, // bit-reversal permutation
CYCLIC_PREFIX); CYCLIC_PREFIX);
else { else {
normal_prefix_mod(PHY_vars_eNb1->lte_eNB_common_vars.txdataF[0][aa], normal_prefix_mod(PHY_vars_eNb1->lte_eNB_common_vars.txdataF[0][aa],
@@ -808,8 +798,6 @@ int main(int argc, char **argv)
frame_parms->log2_symbol_size, // log2_fft_size frame_parms->log2_symbol_size, // log2_fft_size
2*nsymb, // number of symbols 2*nsymb, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples frame_parms->nb_prefix_samples, // number of prefix samples
frame_parms->twiddle_ifft, // IFFT twiddle factors
frame_parms->rev, // bit-reversal permutation
CYCLIC_PREFIX); CYCLIC_PREFIX);
else { else {
normal_prefix_mod(PHY_vars_eNb2->lte_eNB_common_vars.txdataF[0][aa], normal_prefix_mod(PHY_vars_eNb2->lte_eNB_common_vars.txdataF[0][aa],
-9
View File
@@ -103,13 +103,6 @@ void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmi
//copy_lte_parms_to_phy_framing(lte_frame_parms, &(PHY_config->PHY_framing)); //copy_lte_parms_to_phy_framing(lte_frame_parms, &(PHY_config->PHY_framing));
phy_init_top(lte_frame_parms); //allocation
lte_frame_parms->twiddle_fft = twiddle_fft;
lte_frame_parms->twiddle_ifft = twiddle_ifft;
lte_frame_parms->rev = rev;
memcpy(&PHY_vars_UE->lte_frame_parms,lte_frame_parms,sizeof(LTE_DL_FRAME_PARMS)); memcpy(&PHY_vars_UE->lte_frame_parms,lte_frame_parms,sizeof(LTE_DL_FRAME_PARMS));
@@ -1113,8 +1106,6 @@ int main(int argc, char **argv)
PHY_vars_eNB->lte_frame_parms.log2_symbol_size, // log2_fft_size PHY_vars_eNB->lte_frame_parms.log2_symbol_size, // log2_fft_size
2*nsymb, // number of symbols 2*nsymb, // number of symbols
PHY_vars_eNB->lte_frame_parms.nb_prefix_samples, // number of prefix samples PHY_vars_eNB->lte_frame_parms.nb_prefix_samples, // number of prefix samples
PHY_vars_eNB->lte_frame_parms.twiddle_ifft, // IFFT twiddle factors
PHY_vars_eNB->lte_frame_parms.rev, // bit-reversal permutation
CYCLIC_PREFIX); CYCLIC_PREFIX);
else { else {
normal_prefix_mod(&PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNb_id][aa][subframe*nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size], normal_prefix_mod(&PHY_vars_eNB->lte_eNB_common_vars.txdataF[eNb_id][aa][subframe*nsymb*PHY_vars_eNB->lte_frame_parms.ofdm_symbol_size],
@@ -1,666 +0,0 @@
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
#include <string.h>
#include <math.h>
#include "SIMULATION/TOOLS/defs.h"
#include "SIMULATION/RF/defs.h"
#include "PHY/types.h"
#include "PHY/defs.h"
#include "PHY/vars.h"
#include "MAC_INTERFACE/vars.h"
#ifdef IFFT_FPGA
#include "PHY/LTE_REFSIG/mod_table.h"
#endif
#include "SCHED/defs.h"
#include "SCHED/vars.h"
#define DEBUG_PHY
#define BW 10.0
#define Td 1.0
#define N_TRIALS 1
/*
DCI0_5MHz_TDD0_t UL_alloc_pdu;
DCI1A_5MHz_TDD_1_6_t CCCH_alloc_pdu;
DCI2_5MHz_2A_L10PRB_TDD_t DLSCH_alloc_pdu1;
DCI2_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu2;
*/
#define UL_RB_ALLOC computeRIV(lte_frame_parms->N_RB_UL,0,24)
#define CCCH_RB_ALLOC computeRIV(lte_frame_parms->N_RB_UL,0,2)
#define DLSCH_RB_ALLOC 0x1fff
int number_of_cards=3;
int main(int argc, char **argv)
{
int i,l,aa,sector;
double sigma2, sigma2_dB=0;
mod_sym_t **txdataF;
#ifdef IFFT_FPGA
int **txdataF2;
#endif
int **txdata,**rxdata;
double **s_re,**s_im,**r_re,**r_im;
double amps[8] = {0.3868472 , 0.3094778 , 0.1547389 , 0.0773694 , 0.0386847 , 0.0193424 , 0.0096712 , 0.0038685};
double aoa=.03,ricean_factor=0.5;
int channel_length;
struct complex **ch;
unsigned char pbch_pdu[6];
int sync_pos, sync_pos_slot;
FILE *rx_frame_file;
int result;
int freq_offset;
int subframe_offset;
char fname[40], vname[40];
int trial, n_errors=0;
unsigned int nb_rb = 25;
unsigned int first_rb = 0;
unsigned int eNb_id = 0;
unsigned int slot_offset;
int n_frames;
int slot,last_slot, next_slot;
double nf[2] = {3.0,3.0}; //currently unused
double ip =0.0;
double N0W, path_loss, path_loss_dB, tx_pwr, rx_pwr;
int rx_pwr2;
unsigned char first_call = 1;
char stats_buffer[4096];
int len;
#ifdef EMOS
fifo_dump_emos emos_dump;
#endif
if (argc>1)
sigma2_dB = atoi(argv[1]);
if (argc>2)
n_frames = atoi(argv[2]);
else
n_frames = 3;
channel_length = (int) 11+2*BW*Td;
PHY_vars = malloc(sizeof(PHY_VARS));
PHY_config = malloc(sizeof(PHY_CONFIG));
mac_xface = malloc(sizeof(MAC_xface));
lte_frame_parms = &(PHY_config->lte_frame_parms);
lte_ue_common_vars = &(PHY_vars->lte_ue_common_vars);
lte_ue_dlsch_vars = &(PHY_vars->lte_ue_dlsch_vars[0]);
lte_ue_dlsch_vars_cntl = &(PHY_vars->lte_ue_dlsch_vars_cntl[0]);
lte_ue_dlsch_vars_ra = &PHY_vars->lte_ue_dlsch_vars_ra[0];
lte_ue_dlsch_vars_1A = &PHY_vars->lte_ue_dlsch_vars_1A[0];
lte_ue_pbch_vars = &(PHY_vars->lte_ue_pbch_vars[0]);
lte_ue_pdcch_vars = &(PHY_vars->lte_ue_pdcch_vars[0]);
lte_eNB_common_vars = &(PHY_vars->lte_eNB_common_vars);
lte_eNB_ulsch_vars = &(PHY_vars->lte_eNB_ulsch_vars[0]);
lte_frame_parms->N_RB_DL = 25;
lte_frame_parms->N_RB_UL = 25;
lte_frame_parms->Ncp = 1;
lte_frame_parms->Nid_cell = 0;
lte_frame_parms->nushift = 0;
lte_frame_parms->nb_antennas_tx = 2;
lte_frame_parms->nb_antennas_rx = 2;
lte_frame_parms->first_dlsch_symbol = 4;
lte_frame_parms->num_dlsch_symbols = 6;
lte_frame_parms->Csrs = 2;
lte_frame_parms->Bsrs = 0;
lte_frame_parms->kTC = 0;
lte_frame_parms->n_RRC = 0;
init_frame_parms(lte_frame_parms);
copy_lte_parms_to_phy_framing(lte_frame_parms, &(PHY_config->PHY_framing));
phy_init_top(NB_ANTENNAS_TX);
lte_frame_parms->twiddle_fft = twiddle_fft;
lte_frame_parms->twiddle_ifft = twiddle_ifft;
lte_frame_parms->rev = rev;
lte_gold(lte_frame_parms);
lte_sync_time_init(lte_frame_parms);
generate_ul_ref_sigs();
generate_ul_ref_sigs_rx();
generate_64qam_table();
generate_16qam_table();
generate_RIV_tables();
phy_init_lte_ue(lte_frame_parms,lte_ue_common_vars,lte_ue_dlsch_vars,lte_ue_dlsch_vars_cntl,lte_ue_dlsch_vars_ra,lte_ue_dlsch_vars_1A,lte_ue_pbch_vars,lte_ue_pdcch_vars);
phy_init_lte_eNB(lte_frame_parms,lte_eNB_common_vars,lte_eNB_ulsch_vars);
dlsch_eNb = (LTE_eNb_DLSCH_t**) malloc16(2*sizeof(LTE_eNb_DLSCH_t*));
dlsch_ue = (LTE_UE_DLSCH_t**) malloc16(2*sizeof(LTE_UE_DLSCH_t*));
ulsch_eNb = (LTE_eNb_ULSCH_t**) malloc16(2*sizeof(LTE_eNb_ULSCH_t*));
ulsch_ue = (LTE_UE_ULSCH_t**) malloc16(2*sizeof(LTE_UE_ULSCH_t*));
for (i=0; i<2; i++) {
dlsch_eNb[i] = new_eNb_dlsch(1,8);
if (!dlsch_eNb[i]) {
msg("Can't get eNb dlsch structures\n");
exit(-1);
}
dlsch_ue[i] = new_ue_dlsch(1,8);
if (!dlsch_ue) {
msg("Can't get ue dlsch structures\n");
exit(-1);
}
ulsch_eNb[i] = new_eNb_ulsch(3);
if (!ulsch_eNb[i]) {
msg("Can't get eNb ulsch structures\n");
exit(-1);
}
ulsch_ue[i] = new_ue_ulsch(3);
if (!ulsch_ue[i]) {
msg("Can't get ue ulsch structures\n");
exit(-1);
}
}
dlsch_eNb_cntl = new_eNb_dlsch(1,1);
dlsch_ue_cntl = new_ue_dlsch(1,1);
// init DCI structures for testing
UL_alloc_pdu.type = 0;
UL_alloc_pdu.hopping = 0;
UL_alloc_pdu.rballoc = UL_RB_ALLOC;
UL_alloc_pdu.mcs = 1;
UL_alloc_pdu.ndi = 1;
UL_alloc_pdu.TPC = 0;
UL_alloc_pdu.cqi_req = 1;
CCCH_alloc_pdu.type = 0;
CCCH_alloc_pdu.vrb_type = 0;
CCCH_alloc_pdu.rballoc = CCCH_RB_ALLOC;
CCCH_alloc_pdu.ndi = 1;
CCCH_alloc_pdu.rv = 1;
CCCH_alloc_pdu.mcs = 1;
CCCH_alloc_pdu.harq_pid = 0;
printf("CCCH_RB_ALLOC = %d\n",CCCH_RB_ALLOC);
DLSCH_alloc_pdu2.rah = 0;
DLSCH_alloc_pdu2.rballoc = DLSCH_RB_ALLOC;
DLSCH_alloc_pdu2.TPC = 0;
DLSCH_alloc_pdu2.dai = 0;
DLSCH_alloc_pdu2.harq_pid = 0;
DLSCH_alloc_pdu2.tb_swap = 0;
DLSCH_alloc_pdu2.mcs1 = 4;
DLSCH_alloc_pdu2.ndi1 = 1;
DLSCH_alloc_pdu2.rv1 = 0;
// Forget second codeword
DLSCH_alloc_pdu2.tpmi = 0;
#ifdef IFFT_FPGA
txdata = (int **)malloc16(2*sizeof(int*));
txdata[0] = (int *)malloc16(FRAME_LENGTH_BYTES);
txdata[1] = (int *)malloc16(FRAME_LENGTH_BYTES);
bzero(txdata[0],FRAME_LENGTH_BYTES);
bzero(txdata[1],FRAME_LENGTH_BYTES);
txdataF2 = (int **)malloc16(2*sizeof(int*));
txdataF2[0] = (int *)malloc16(FRAME_LENGTH_BYTES_NO_PREFIX);
txdataF2[1] = (int *)malloc16(FRAME_LENGTH_BYTES_NO_PREFIX);
bzero(txdataF2[0],FRAME_LENGTH_BYTES_NO_PREFIX);
bzero(txdataF2[1],FRAME_LENGTH_BYTES_NO_PREFIX);
#endif
s_re = malloc(2*sizeof(double*));
s_im = malloc(2*sizeof(double*));
r_re = malloc(2*sizeof(double*));
r_im = malloc(2*sizeof(double*));
for (i=0; i<2; i++) {
s_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
bzero(s_re[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
s_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
bzero(s_im[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
r_re[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
bzero(r_re[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
r_im[i] = malloc(FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
bzero(r_im[i],FRAME_LENGTH_COMPLEX_SAMPLES*sizeof(double));
}
ch = (struct complex**) malloc(4 * sizeof(struct complex*));
for (i = 0; i<4; i++)
ch[i] = (struct complex*) malloc(channel_length * sizeof(struct complex));
randominit(0);
set_taus_seed(0);
openair_daq_vars.tdd = 1;
openair_daq_vars.rx_gain_mode = DAQ_AGC_ON;
//openair_daq_vars.dlsch_transmission_mode = 1; //SISO
openair_daq_vars.dlsch_transmission_mode = 2; //ALAMOUTI
//openair_daq_vars.dlsch_transmission_mode = 6; //LAYER1 PRECODING
lte_frame_parms->mode1_flag = (openair_daq_vars.dlsch_transmission_mode==1);
PHY_vars->rx_total_gain_dB=140;
for (mac_xface->frame=0; mac_xface->frame<n_frames; mac_xface->frame++) {
for (slot=0 ; slot<20 ; slot++) {
last_slot = (slot - 1)%20;
if (last_slot <0)
last_slot+=20;
next_slot = (slot + 1)%20;
printf("Frame %d, slot %d : eNB procedures\n",mac_xface->frame,slot);
mac_xface->is_cluster_head = 1;
phy_procedures_lte(last_slot,next_slot);
len = chbch_stats_read(stats_buffer,NULL,0,4096);
//printf("%s\n\n",stats_buffer);
printf("Frame %d, slot %d : UE procedures\n",mac_xface->frame,slot);
mac_xface->is_cluster_head = 0;
phy_procedures_lte(last_slot,next_slot);
len = chbch_stats_read(stats_buffer,NULL,0,4096);
//printf("%s\n",stats_buffer);
// write_output("eNb_txsigF0.m","eNb_txsF0", lte_eNB_common_vars->txdataF[eNb_id][0],300*120,1,4);
// write_output("eNb_txsigF1.m","eNb_txsF1", lte_eNB_common_vars->txdataF[eNb_id][1],300*120,1,4);
if (subframe_select_tdd(lte_frame_parms->tdd_config,next_slot>>1) == SF_DL) {
txdataF = lte_eNB_common_vars->txdataF[eNb_id];
#ifndef IFFT_FPGA
txdata = lte_eNB_common_vars->txdata[eNb_id];
#endif
} else if (subframe_select_tdd(lte_frame_parms->tdd_config,next_slot>>1) == SF_UL) {
txdataF = lte_ue_common_vars->txdataF;
#ifndef IFFT_FPGA
txdata = lte_ue_common_vars->txdata;
#endif
} else //it must be a special subframe
if (next_slot%2==0) {//DL part
txdataF = lte_eNB_common_vars->txdataF[eNb_id];
#ifndef IFFT_FPGA
txdata = lte_eNB_common_vars->txdata[eNb_id];
#endif
} else { // UL part
txdataF = lte_ue_common_vars->txdataF;
#ifndef IFFT_FPGA
txdata = lte_ue_common_vars->txdata;
#endif
}
#ifdef IFFT_FPGA
slot_offset = (next_slot)*(lte_frame_parms->N_RB_DL*12)*((lte_frame_parms->Ncp==1) ? 6 : 7);
//write_output("eNb_txsigF0.m","eNb_txsF0", lte_eNB_common_vars->txdataF[eNb_id][0],300*120,1,4);
//write_output("eNb_txsigF1.m","eNb_txsF1", lte_eNB_common_vars->txdataF[eNb_id][1],300*120,1,4);
// do talbe lookup and write results to txdataF2
for (aa=0; aa<lte_frame_parms->nb_antennas_tx; aa++) {
l = slot_offset;
for (i=0; i<NUMBER_OF_OFDM_CARRIERS*((lte_frame_parms->Ncp==1) ? 6 : 7); i++)
if ((i%512>=1) && (i%512<=150))
txdataF2[aa][i] = ((int*)mod_table)[txdataF[aa][l++]];
else if (i%512>=362)
txdataF2[aa][i] = ((int*)mod_table)[txdataF[aa][l++]];
else
txdataF2[aa][i] = 0;
}
#ifdef DEBUG_PHY
if (next_slot <= 1) {
sprintf(fname,"eNb_frame%d_slot%d_txsigF20.m",mac_xface->frame,next_slot);
write_output(fname,"eNb_txsF0",txdataF2[0],512*6,1,1);
sprintf(fname,"eNb_frame%d_slot%d_txsigF21.m",mac_xface->frame,next_slot);
write_output(fname,"eNb_txsF1",txdataF2[1],512*6,1,1);
}
#endif
for (aa=0; aa<lte_frame_parms->nb_antennas_tx; aa++)
PHY_ofdm_mod(txdataF2[aa], // input
txdata[aa], // output
lte_frame_parms->log2_symbol_size, // log2_fft_size
(lte_frame_parms->Ncp==1) ? 6 : 7, // number of symbols
lte_frame_parms->nb_prefix_samples, // number of prefix samples
lte_frame_parms->twiddle_ifft, // IFFT twiddle factors
lte_frame_parms->rev, // bit-reversal permutation
CYCLIC_PREFIX);
#else
slot_offset = (next_slot)*(lte_frame_parms->ofdm_symbol_size)*((lte_frame_parms->Ncp==1) ? 6 : 7);
//printf("Copying TX buffer for slot %d (%d) (%p,%p)\n",next_slot,slot_offset,txdataF,txdata);
#ifdef DEBUG_PHY
if (next_slot <= 1) {
sprintf(fname,"eNb_frame%d_slot%d_txsigF0.m",mac_xface->frame,next_slot);
write_output(fname,"eNb_txsF0",&txdataF[0][slot_offset],512*12,1,1);
sprintf(fname,"eNb_frame%d_slot%d_txsigF1.m",mac_xface->frame,next_slot);
write_output(fname,"eNb_txsF1",&txdataF[1][slot_offset],512*12,1,1);
}
/*
if (next_slot == 2) {
sprintf(fname,"UE_frame%d_txsigF0.m",mac_xface->frame);
write_output(fname,"UE_txsF0",&txdataF[0][slot_offset],512*12,1,1);
sprintf(fname,"UE_frame%d_txsigF1.m",mac_xface->frame);
write_output(fname,"UE_txsF1",&txdataF[1][slot_offset],512*12,1,1);
}
*/
#endif
for (aa=0; aa<lte_frame_parms->nb_antennas_tx; aa++) {
PHY_ofdm_mod(&txdataF[aa][slot_offset], // input
txdata[aa], // output
lte_frame_parms->log2_symbol_size, // log2_fft_size
(lte_frame_parms->Ncp==1) ? 6 : 7, // number of symbols
lte_frame_parms->nb_prefix_samples, // number of prefix samples
lte_frame_parms->twiddle_ifft, // IFFT twiddle factors
lte_frame_parms->rev, // bit-reversal permutation
CYCLIC_PREFIX);
}
#endif
#ifdef DEBUG_PHY
if (next_slot <= 2) {
sprintf(fname,"eNb_frame%d_slot%d_txsig0.m",mac_xface->frame,next_slot);
write_output(fname,"eNb_txs0",txdata[0],640*12,1,1);
sprintf(fname,"eNb_frame%d_slot%d_txsig1.m",mac_xface->frame,next_slot);
write_output(fname,"eNb_txs1",txdata[1],640*12,1,1);
}
if ((next_slot >= 3) && (next_slot<=5)) {
sprintf(fname,"UE_frame%d_slot%d_txsig0.m",mac_xface->frame,next_slot);
write_output(fname,"UE_txs0",txdata[0],640*12,1,1);
sprintf(fname,"UE_frame%d_slot%d_txsig1.m",mac_xface->frame,next_slot);
write_output(fname,"UE_txs1",txdata[1],640*12,1,1);
}
#endif
#ifdef DAC
tx_pwr = dac_fixed_gain(s_re,
s_im,
txdata,
2,
lte_frame_parms->samples_per_tti>>1,
14,
0);
printf("tx_pwr %f dB for slot %d (subframe %d)\n",10*log10(tx_pwr),next_slot,next_slot>>1);
#else
for (i=0; i<(lte_frame_parms->samples_per_tti>>1); i++) {
for (aa=0; aa<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]);
}
}
#endif
// printf("channel for slot %d (subframe %d)\n",next_slot,next_slot>>1);
multipath_channel(ch,s_re,s_im,r_re,r_im,
amps,Td,BW,ricean_factor,aoa,
lte_frame_parms->nb_antennas_tx,
lte_frame_parms->nb_antennas_rx,
OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES*(7-lte_frame_parms->Ncp),
channel_length,
0,
1,
(first_call == 1) ? 1 : 0);
if (first_call == 1)
first_call = 0;
//write_output("channel0.m","chan0",ch[0],channel_length,1,8);
#ifdef RF
// scale by path_loss = NOW - P_noise
path_loss_dB = -70;
path_loss = pow(10,path_loss_dB/10);
// path_loss_dB = 0;
// path_loss = 1;
for (i=0; i<(lte_frame_parms->samples_per_tti>>1); i++) {
for (aa=0; aa<lte_frame_parms->nb_antennas_rx; aa++) {
r_re[aa][i]=r_re[aa][i]*sqrt(path_loss);
r_im[aa][i]=r_im[aa][i]*sqrt(path_loss);
}
}
// RF model
rf_rx(r_re,
r_im,
NULL,
NULL,
0,
lte_frame_parms->nb_antennas_rx,
lte_frame_parms->samples_per_tti>>1,
1.0/7.68e6 * 1e9, // sampling time (ns)
0.0, // freq offset (Hz) (-20kHz..20kHz)
0.0, // drift (Hz) NOT YET IMPLEMENTED
nf, // noise_figure NOT YET IMPLEMENTED
(double)PHY_vars->rx_total_gain_dB-72.247, // rx_gain (dB)
200, // IP3_dBm (dBm)
&ip, // initial phase
30.0e3, // pn_cutoff (kHz)
-500.0, // pn_amp (dBc) default: 50
0.0, // IQ imbalance (dB),
0.0); // IQ phase imbalance (rad)
rx_pwr = signal_energy_fp(r_re,r_im,lte_frame_parms->nb_antennas_rx,lte_frame_parms->samples_per_tti>>1,0);
printf("rx_pwr (ADC in) %f dB for slot %d (subframe %d)\n",10*log10(rx_pwr),next_slot,next_slot>>1);
#endif
if (subframe_select_tdd(lte_frame_parms->tdd_config,next_slot>>1) == SF_DL)
rxdata = lte_ue_common_vars->rxdata;
else if (subframe_select_tdd(lte_frame_parms->tdd_config,next_slot>>1) == SF_UL)
rxdata = lte_eNB_common_vars->rxdata[eNb_id];
else //it must be a special subframe
if (next_slot%2==0) //DL part
rxdata = lte_ue_common_vars->rxdata;
else // UL part
rxdata = lte_eNB_common_vars->rxdata[eNb_id];
slot_offset = (next_slot)*(lte_frame_parms->samples_per_tti>>1);
#ifdef ADC
adc(r_re,
r_im,
0,
slot_offset,
rxdata,
2,
lte_frame_parms->samples_per_tti>>1,
12);
rx_pwr2 = signal_energy(rxdata[0]+slot_offset,lte_frame_parms->samples_per_tti>>1);
printf("rx_pwr (ADC out) %f dB (%d) for slot %d (subframe %d)\n",10*log10((double)rx_pwr2),rx_pwr2,next_slot,next_slot>>1);
#else
sigma2 = pow(10,sigma2_dB/10);
for (i=0; i<(lte_frame_parms->samples_per_tti>>1); i++) {
for (aa=0; aa<lte_frame_parms->nb_antennas_rx; aa++) {
((short*) rxdata[aa])[2*(slot_offset+i)] = (short) ((r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0));
((short*) rxdata[aa])[2*(slot_offset+i)+1] = (short) ((r_im[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0));
/*
if ((next_slot==4) && ((i%16)==0))
printf("rxdata (slot_offset %d): %d:%d => %d,%d\n",slot_offset,aa,i,
((short *)rxdata[aa])[slot_offset + (2*i)],
((short *)rxdata[aa])[slot_offset + 1+(2*i)]);
*/
}
}
#endif
#ifdef DEBUG_PHY
/*
if ((last_slot == 5) && (mac_xface->frame == 1)) {
write_output("ulsch_rxF_comp0.m","ulsch0_rxF_comp0",&lte_eNB_ulsch_vars[0]->rxdataF_comp[0][0][0],300*12,1,1);
write_output("ulsch_rxF_llr.m","ulsch_llr",lte_eNB_ulsch_vars[eNb_id]->llr,ulsch_ue[0]->harq_processes[0]->nb_rb*12*2*9,1,0);
write_output("drs_est0.m","drsest0",lte_eNB_ulsch_vars[0]->drs_ch_estimates[0][0],300*12,1,1);
write_output("drs_est1.m","drsest1",lte_eNB_ulsch_vars[0]->drs_ch_estimates[0][1],300*12,1,1);
}
*/
/*
if (last_slot == 5) {
sprintf(fname,"eNB_frame%d_rxsig0_subframe2.m",mac_xface->frame);
write_output(fname,"eNB_rxs0",&rxdata[0][2*lte_frame_parms->samples_per_tti],640*12,1,1);
sprintf(fname,"eNB_frame%d_rxsig1_subframe2.m",mac_xface->frame);
write_output(fname,"eNB_rxs1",&rxdata[1][2*lte_frame_parms->samples_per_tti],640*12,1,1);
}
*/
if ((last_slot == 19) && (mac_xface->frame == 1)) {
write_output("UE_rxsig0.m","UE_rxs0", lte_ue_common_vars->rxdata[0],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
write_output("UE_rxsig1.m","UE_rxs1", lte_ue_common_vars->rxdata[1],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
write_output("eNb_rxsig0.m","eNb_rxs0", lte_eNB_common_vars->rxdata[eNb_id][0],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
write_output("eNb_rxsig1.m","eNb_rxs1", lte_eNB_common_vars->rxdata[eNb_id][1],FRAME_LENGTH_COMPLEX_SAMPLES,1,1);
}
#endif
/*
// optional: read rx_frame from file
if ((rx_frame_file = fopen("rx_frame.dat","r")) == NULL)
{
printf("[openair][CHBCH_TEST][INFO] Cannot open rx_frame.m data file\n");
exit(0);
}
result = fread((void *)PHY_vars->rx_vars[0].RX_DMA_BUFFER,4,FRAME_LENGTH_COMPLEX_SAMPLES,rx_frame_file);
printf("Read %d bytes\n",result);
result = fread((void *)PHY_vars->rx_vars[1].RX_DMA_BUFFER,4,FRAME_LENGTH_COMPLEX_SAMPLES,rx_frame_file);
printf("Read %d bytes\n",result);
fclose(rx_frame_file);
*/
}
}
/*
write_output("rxsigF0.m","rxsF0", lte_eNB_common_vars->rxdataF[0][0],512*12*2,2,1);
write_output("rxsigF1.m","rxsF1", lte_eNB_common_vars->rxdataF[0][1],512*12*2,2,1);
*/
write_output("srs_seq.m","srs",lte_eNB_common_vars->srs,2*lte_frame_parms->ofdm_symbol_size,2,1);
write_output("srs_est0.m","srsest0",lte_eNB_common_vars->srs_ch_estimates[0][0],512,1,1);
write_output("srs_est1.m","srsest1",lte_eNB_common_vars->srs_ch_estimates[0][1],512,1,1);
write_output("rxsigF0_ext.m","rxsF0_ext", lte_eNB_ulsch_vars[0]->rxdataF_ext[0][0],300*12*2,2,1);
write_output("rxsigF1_ext.m","rxsF1_ext", lte_eNB_ulsch_vars[0]->rxdataF_ext[0][1],300*12*2,2,1);
write_output("drs_est0.m","drsest0",lte_eNB_ulsch_vars[0]->drs_ch_estimates[0][0],300*12,1,1);
write_output("drs_est1.m","drsest1",lte_eNB_ulsch_vars[0]->drs_ch_estimates[0][1],300*12,1,1);
write_output("PBCH_rxF0_ext.m","pbch0_ext",lte_ue_pbch_vars[0]->rxdataF_ext[0],12*4*6,1,1);
write_output("PBCH_rxF1_ext.m","pbch1_ext",lte_ue_pbch_vars[0]->rxdataF_ext[1],12*4*6,1,1);
write_output("PBCH_rxF0_comp.m","pbch0_comp",lte_ue_pbch_vars[0]->rxdataF_comp[0],12*4*6,1,1);
write_output("PBCH_rxF1_comp.m","pbch1_comp",lte_ue_pbch_vars[0]->rxdataF_comp[1],12*4*6,1,1);
write_output("PBCH_rxF_llr.m","pbch_llr",lte_ue_pbch_vars[0]->llr,12*2*6*2,1,0);
#ifdef IFFT_FPGA
free(txdataF2[0]);
free(txdataF2[1]);
free(txdataF2);
free(txdata[0]);
free(txdata[1]);
free(txdata);
#endif
for (i=0; i<2; i++) {
free(s_re[i]);
free(s_im[i]);
free(r_re[i]);
free(r_im[i]);
}
free(s_re);
free(s_im);
free(r_re);
free(r_im);
lte_sync_time_free();
return(n_errors);
}
/*
for (i=1;i<4;i++)
memcpy((void *)&PHY_vars->tx_vars[0].TX_DMA_BUFFER[i*12*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES_NO_PREFIX*2],
(void *)&PHY_vars->tx_vars[0].TX_DMA_BUFFER[0],
12*OFDM_SYMBOL_SIZE_SAMPLES_NO_PREFIX*2);
*/
File diff suppressed because it is too large Load Diff
-5
View File
@@ -93,11 +93,6 @@ void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmi
//copy_lte_parms_to_phy_framing(lte_frame_parms, &(PHY_config->PHY_framing)); //copy_lte_parms_to_phy_framing(lte_frame_parms, &(PHY_config->PHY_framing));
phy_init_top(lte_frame_parms); //allocation
lte_frame_parms->twiddle_fft = twiddle_fft;
lte_frame_parms->twiddle_ifft = twiddle_ifft;
lte_frame_parms->rev = rev;
PHY_vars_UE->lte_frame_parms = *lte_frame_parms; PHY_vars_UE->lte_frame_parms = *lte_frame_parms;
-8
View File
@@ -96,10 +96,6 @@ void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmi
phy_init_top(lte_frame_parms); //allocation phy_init_top(lte_frame_parms); //allocation
lte_frame_parms->twiddle_fft = twiddle_fft;
lte_frame_parms->twiddle_ifft = twiddle_ifft;
lte_frame_parms->rev = rev;
PHY_vars_UE->lte_frame_parms = *lte_frame_parms; PHY_vars_UE->lte_frame_parms = *lte_frame_parms;
@@ -479,8 +475,6 @@ int main(int argc, char **argv)
frame_parms->log2_symbol_size, // log2_fft_size frame_parms->log2_symbol_size, // log2_fft_size
2*nsymb, // number of symbols 2*nsymb, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples frame_parms->nb_prefix_samples, // number of prefix samples
frame_parms->twiddle_ifft, // IFFT twiddle factors
frame_parms->rev, // bit-reversal permutation
CYCLIC_PREFIX); CYCLIC_PREFIX);
else else
normal_prefix_mod(txdataF2[aa],txdata[aa],2*nsymb,frame_parms); normal_prefix_mod(txdataF2[aa],txdata[aa],2*nsymb,frame_parms);
@@ -504,8 +498,6 @@ int main(int argc, char **argv)
frame_parms->log2_symbol_size, // log2_fft_size frame_parms->log2_symbol_size, // log2_fft_size
nsymb, // number of symbols nsymb, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples frame_parms->nb_prefix_samples, // number of prefix samples
frame_parms->twiddle_ifft, // IFFT twiddle factors
frame_parms->rev, // bit-reversal permutation
CYCLIC_PREFIX); CYCLIC_PREFIX);
else { else {
normal_prefix_mod(&PHY_vars_UE->lte_ue_common_vars.txdataF[eNB_id][subframe*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES_NO_PREFIX], normal_prefix_mod(&PHY_vars_UE->lte_ue_common_vars.txdataF[eNB_id][subframe*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES_NO_PREFIX],
-7
View File
@@ -101,11 +101,6 @@ void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmi
//copy_lte_parms_to_phy_framing(lte_frame_parms, &(PHY_config->PHY_framing)); //copy_lte_parms_to_phy_framing(lte_frame_parms, &(PHY_config->PHY_framing));
phy_init_top(lte_frame_parms); //allocation
lte_frame_parms->twiddle_fft = twiddle_fft;
lte_frame_parms->twiddle_ifft = twiddle_ifft;
lte_frame_parms->rev = rev;
PHY_vars_UE->lte_frame_parms = *lte_frame_parms; PHY_vars_UE->lte_frame_parms = *lte_frame_parms;
@@ -632,8 +627,6 @@ int main(int argc, char **argv)
frame_parms->log2_symbol_size, // log2_fft_size frame_parms->log2_symbol_size, // log2_fft_size
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*nsymb, // number of symbols LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*nsymb, // number of symbols
frame_parms->nb_prefix_samples, // number of prefix samples frame_parms->nb_prefix_samples, // number of prefix samples
frame_parms->twiddle_ifft, // IFFT twiddle factors
frame_parms->rev, // bit-reversal permutation
CYCLIC_PREFIX); CYCLIC_PREFIX);
else { 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],
-7
View File
@@ -138,11 +138,6 @@ void lte_param_init(unsigned char N_tx, unsigned char N_rx,unsigned char transmi
//copy_lte_parms_to_phy_framing(lte_frame_parms, &(PHY_config->PHY_framing)); //copy_lte_parms_to_phy_framing(lte_frame_parms, &(PHY_config->PHY_framing));
phy_init_top(lte_frame_parms); //allocation
lte_frame_parms->twiddle_fft = twiddle_fft;
lte_frame_parms->twiddle_ifft = twiddle_ifft;
lte_frame_parms->rev = rev;
PHY_vars_UE->lte_frame_parms = *lte_frame_parms; PHY_vars_UE->lte_frame_parms = *lte_frame_parms;
@@ -1120,8 +1115,6 @@ int main(int argc, char **argv)
PHY_vars_UE->lte_frame_parms.log2_symbol_size, // log2_fft_size PHY_vars_UE->lte_frame_parms.log2_symbol_size, // log2_fft_size
nsymb, // number of symbols nsymb, // number of symbols
PHY_vars_UE->lte_frame_parms.nb_prefix_samples, // number of prefix samples PHY_vars_UE->lte_frame_parms.nb_prefix_samples, // number of prefix samples
PHY_vars_UE->lte_frame_parms.twiddle_ifft, // IFFT twiddle factors
PHY_vars_UE->lte_frame_parms.rev, // bit-reversal permutation
CYCLIC_PREFIX); CYCLIC_PREFIX);
else else
normal_prefix_mod(&PHY_vars_UE->lte_ue_common_vars.txdataF[aa][subframe*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES_NO_PREFIX], normal_prefix_mod(&PHY_vars_UE->lte_ue_common_vars.txdataF[aa][subframe*nsymb*OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES_NO_PREFIX],
+1 -1
View File
@@ -2435,7 +2435,7 @@ int main( int argc, char **argv )
frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = 0; frame_parms[CC_id]->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = 0;
init_ul_hopping(frame_parms[CC_id]); init_ul_hopping(frame_parms[CC_id]);
init_frame_parms(frame_parms[CC_id],1); init_frame_parms(frame_parms[CC_id],1);
phy_init_top(frame_parms[CC_id]); // phy_init_top(frame_parms[CC_id]);
} }
phy_init_lte_top(frame_parms[0]); phy_init_lte_top(frame_parms[0]);
+1 -1
View File
@@ -267,7 +267,7 @@ void init_lte_vars(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs],
} }
phy_init_top(frame_parms[0]); // phy_init_top(frame_parms[0]);
phy_init_lte_top(frame_parms[0]); phy_init_lte_top(frame_parms[0]);