Commit 57517313 authored by lfarizav's avatar lfarizav

preparing for some SSE implementations

parent 4a347a01
......@@ -23,6 +23,7 @@
#include "time_meas.h"
#include <math.h>
#include <unistd.h>
#include "PHY/extern.h"
// global var for openair performance profiler
int opp_enabled = 0;
......@@ -89,7 +90,16 @@ void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_ti
(ts->diff/ts->trials/cpu_freq_GHz/1000.0),
ts->trials);
} else {
fprintf(stderr, "%25s: %15.3f ms (%5.2f%%); %15.3f us (%5.2f%%); %15d;\n",
if (PHY_vars_UE_g[0][0]->do_ofdm_mod)
fprintf(stderr, "%25s: %15.3f us (%5.2f%%); %15.3f us (%5.2f%%); %15d;\n",
name,
(ts->diff_now/cpu_freq_GHz/1000.0),
((ts->diff_now/cpu_freq_GHz/1000.0)/(total_exec_time->diff/cpu_freq_GHz/1000.0))*100, // percentage
(ts->diff/ts->trials/cpu_freq_GHz/1000.0),
((ts->diff/ts->trials/cpu_freq_GHz/1000.0)/(sf_exec_time->diff/sf_exec_time->trials/cpu_freq_GHz/1000.0))*100, // percentage
ts->trials);
else
fprintf(stderr, "%25s: %15.3f ms (%5.2f%%); %15.3f us (%5.2f%%); %15d;\n",
name,
(ts->diff/cpu_freq_GHz/1000000.0),
((ts->diff/cpu_freq_GHz/1000000.0)/(total_exec_time->diff/cpu_freq_GHz/1000000.0))*100, // percentage
......
......@@ -118,7 +118,7 @@ static inline void stop_meas(time_stats_t *ts)
ts->diff_now = (out-ts->in);
ts->diff_now = (out-ts->in);
//ts->diff_now = (out-ts->in);
ts->diff += (out-ts->in);
/// process duration is the difference between two clock points
ts->p_time = (out-ts->in);
......
......@@ -21,7 +21,42 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "PHY/sse_intrin.h"
//#define DEBUG_ADC
//#define adc_SSE
#ifdef adc_SSE
void adc(double *r_re[2],
double *r_im[2],
unsigned int input_offset,
unsigned int output_offset,
unsigned int **output,
unsigned int nb_rx_antennas,
unsigned int length,
unsigned char B)
{
int i;
int aa;
__m128i r_re128, r_im128, output_re128, output_im128;
__m128d gain128
double gain = (double)(1<<(B-1));
gain128=_mm_set1_pd(gain);
for (i=0; i<(length>>1); i++) {//SSE can process 8 shorts in parallel (length>>3)
for (aa=0; aa<nb_rx_antennas; aa++) {
r_re128=_mm_loadu_pd(&r_re[aa][2*i+input_offset]]);
r_im128=_mm_loadu_pd(&r_im[aa][2*i+input_offset]]);
r_re128=_mm_mul_pd(r_re128,gain128);
r_im128=_mm_mul_pd(r_im128,gain128);
((short *)output[aa])[((i+output_offset)<<1)] = (short)(r_re[aa][i+input_offset]*gain);
((short *)output[aa])[1+((i+output_offset)<<1)] = (short)(r_im[aa][i+input_offset]*gain);
if ((r_re[aa][i+input_offset]*gain) > 30000) {
//("Adc outputs %d %e %d \n",i,((short *)output[0])[((i+output_offset)<<1)], ((i+output_offset)<<1) );
}
}
//printf("Adc outputs %d %e %d \n",i,((short *)output[0])[((i+output_offset)<<1)], ((i+output_offset)<<1) );
}
}
#else
void adc(double *r_re[2],
double *r_im[2],
unsigned int input_offset,
......@@ -55,6 +90,7 @@ void adc(double *r_re[2],
//printf("Adc outputs %d %e %d \n",i,((short *)output[0])[((i+output_offset)<<1)], ((i+output_offset)<<1) );
}
}
#endif
void adc_freq(double *r_re[2],
double *r_im[2],
unsigned int input_offset,
......
......@@ -36,8 +36,8 @@ double **cos_lut=NULL,**sin_lut=NULL;
//#if 1
#define abstraction_SSE
#ifdef abstraction_SSE
int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
{
......@@ -46,24 +46,69 @@ int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
double delay;
int16_t f;
uint8_t l;
//__m128d cos_lut128,sin_lut128,freq128,delay128;
if ((n_samples&1)==0) {
fprintf(stderr, "freq_channel_init: n_samples has to be odd\n");
return(-1);
}
delta_f = nb_rb*180000/(n_samples-1)*1e-6;
cos_lut = (double **)malloc(n_samples*sizeof(double*));
sin_lut = (double **)malloc(n_samples*sizeof(double*));
for (f=-(n_samples>>1); f<=(n_samples>>1); f++) {
cos_lut[f+(n_samples>>1)] = (double *)malloc((int)desc->nb_taps*sizeof(double));
sin_lut[f+(n_samples>>1)] = (double *)malloc((int)desc->nb_taps*sizeof(double));
}
for (f=-(n_samples>>2); f<=(n_samples>>2); f++) {
freq=delta_f*(double)f*2;// due to the fact that delays is in mus
//freq128=_mm_set1_pd(freq);
for (l=0; l<(int)desc->nb_taps; l++) {
if (desc->nb_taps==1)
delay = desc->delays[l];
//delay128 = _mm_set1_pd(desc->delays[l]);
else
delay = desc->delays[l]+NB_SAMPLES_CHANNEL_OFFSET/desc->sampling_rate;
//delay128 = _mm_set1_pd(desc->delays[l]+NB_SAMPLES_CHANNEL_OFFSET/desc->sampling_rate);
cos_lut[f+(n_samples>>1)][l] = cos(2*M_PI*freq*delay);
/*cos_lut128=_mm_set1_pd(cos(2*M_PI*freq*delay));
_mm_storeu_pd(&cos_lut[2*f+(n_samples>>1)][l],cos_lut128);*/
sin_lut[f+(n_samples>>1)][l] = sin(2*M_PI*freq*delay);
/*sin_lut128=_mm_set1_pd(sin(2*M_PI*freq*delay));
_mm_storeu_pd(&sin_lut[2*f+(n_samples>>1)][l],sin_lut128);*/
//printf("values cos:%d, sin:%d\n", cos_lut[f][l], sin_lut[f][l]);
}
}
return(0);
}
#else
int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
{
static int first_run;
double delta_f,freq; // 90 kHz spacing
double delay;
int16_t f;
uint8_t l;
if ((n_samples&1)==0) {
fprintf(stderr, "freq_channel_init: n_samples has to be odd\n");
return(-1);
}
delta_f = nb_rb*180000/(n_samples-1);
cos_lut = (double **)malloc(n_samples*sizeof(double*));
sin_lut = (double **)malloc(n_samples*sizeof(double*));
for (f=-(n_samples>>1); f<=(n_samples>>1); f++) {
freq=delta_f*(double)f*1e-6;// due to the fact that delays is in mus
cos_lut[f+(n_samples>>1)] = (double *)malloc((int)desc->nb_taps*sizeof(double));
sin_lut[f+(n_samples>>1)] = (double *)malloc((int)desc->nb_taps*sizeof(double));
}
for (f=-(n_samples>>1); f<=(n_samples>>1); f++) {
freq=delta_f*(double)f*1e-6;// due to the fact that delays is in mus
for (l=0; l<(int)desc->nb_taps; l++) {
if (desc->nb_taps==1)
delay = desc->delays[l];
......@@ -79,7 +124,68 @@ int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
return(0);
}
#endif
#ifdef abstraction_SSE
int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
{
int16_t f,f2,d;
uint8_t aarx,aatx,l;
double *clut,*slut;
static int freq_channel_init=0;
static int n_samples_max=0;
// do some error checking
// n_samples has to be a odd number because we assume the spectrum is symmetric around the DC and includes the DC
if ((n_samples&1)==0) {
fprintf(stderr, "freq_channel: n_samples has to be odd\n");
return(-1);
}
// printf("no of taps:%d,",(int)desc->nb_taps);
if (freq_channel_init == 0) {
// we are initializing the lut for the largets possible n_samples=12*nb_rb+1
// if called with n_samples<12*nb_rb+1, we decimate the lut
n_samples_max=12*nb_rb+1;
if (init_freq_channel(desc,nb_rb,n_samples_max)==0)
freq_channel_init=1;
else
return(-1);
}
d=(n_samples_max-1)/(n_samples-1);
//printf("no_samples=%d, n_samples_max=%d, d=%d\n",n_samples,n_samples_max,d);
start_meas(&desc->interp_freq);
for (f=-n_samples_max/2,f2=-n_samples/2; f<n_samples_max/2; f+=d,f2++) {
clut = cos_lut[n_samples_max/2+f];
slut = sin_lut[n_samples_max/2+f];
for (aarx=0; aarx<desc->nb_rx; aarx++) {
for (aatx=0; aatx<desc->nb_tx; aatx++) {
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].x=0.0;
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].y=0.0;
for (l=0; l<(int)desc->nb_taps; l++) {
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].x+=(desc->a[l][aarx+(aatx*desc->nb_rx)].x*clut[l]+
desc->a[l][aarx+(aatx*desc->nb_rx)].y*slut[l]);
desc->chF[aarx+(aatx*desc->nb_rx)][n_samples/2+f2].y+=(-desc->a[l][aarx+(aatx*desc->nb_rx)].x*slut[l]+
desc->a[l][aarx+(aatx*desc->nb_rx)].y*clut[l]);
}
}
}
}
stop_meas(&desc->interp_freq);
return(0);
}
#else
int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
{
......@@ -139,6 +245,8 @@ int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
return(0);
}
#endif
int init_freq_channel_prach(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int16_t prach_fmt,int16_t n_ra_prb)
{
......
......@@ -99,11 +99,17 @@ typedef struct {
time_stats_t DL_dac_fixed_gain;
time_stats_t DL_rf_rx_simple_freq;
time_stats_t DL_adc;
time_stats_t UL_multipath_channel_freq;
time_stats_t multipath_channel_freq_PRACH;
time_stats_t UL_dac_fixed_gain;
time_stats_t UL_rf_rx_simple_freq;
time_stats_t UL_adc;
time_stats_t multipath_channel_freq_PRACH;
time_stats_t dac_fixed_gain_PRACH;
time_stats_t rf_rx_simple_freq_PRACH;
time_stats_t adc_PRACH;
} channel_desc_t;
typedef struct {
......
......@@ -477,42 +477,77 @@ void multipath_channel_freq(channel_desc_t *desc,
}//k
}
#endif
void multipath_channel_freq_test(channel_desc_t *desc,
#ifdef CHANNEL_SSE
void multipath_channel_prach(channel_desc_t *desc,
double *tx_sig_re[2],
double *tx_sig_im[2],
double *rx_sig_re[2],
double *rx_sig_im[2],
uint32_t length,
uint8_t keep_channel)
LTE_DL_FRAME_PARMS* const fp,
uint32_t length,
uint8_t keep_channel,
uint8_t eNB_id,
uint8_t prach_fmt,
uint8_t n_ra_prb)
{
int ii,k,f;
int ii,j,f;
__m128d rx_tmp128_re_f,rx_tmp128_im_f,rx_tmp128_re,rx_tmp128_im, rx_tmp128_1,rx_tmp128_2,rx_tmp128_3,rx_tmp128_4,tx128_re,tx128_im,chF128_x,chF128_y,pathloss128;
struct complex rx_tmp;
int prach_samples = (prach_fmt<4)?13+839+12:3+139+2;
double path_loss = pow(10,desc->path_loss_dB/20);
pathloss128 = _mm_set1_pd(path_loss);
int nb_rb, n_samples;
nb_rb=fp->N_RB_DL;
n_samples=fp->N_RB_DL*12+1;
//int nb_rb, n_samples, ofdm_symbol_size, symbols_per_tti;
//nb_rb=PHY_vars_UE_g[0][0]->frame_parms.N_RB_DL;
//n_samples=PHY_vars_UE_g[0][0]->frame_parms.N_RB_DL*12+1;
int ofdm_symbol_size=length/PHY_vars_UE_g[0][0]->frame_parms.symbols_per_tti;
int symbols_per_tti=length/PHY_vars_UE_g[0][0]->frame_parms.ofdm_symbol_size;
//printf("[CHANNEL_FREQ] keep = %d : path_loss = %g (%f), nb_rx %d, nb_tx %d, dd %d, len %d , symbols tti %d\n",keep_channel,path_loss,desc->path_loss_dB,desc->nb_rx,desc->nb_tx,dd,desc->channel_length,symbols_per_tti);
for (k=0;k<symbols_per_tti;k++){//k = 0-13 normal cyclic prefix
for (f=0;f<ofdm_symbol_size; f++) {//f2 = 0-1024 for 10 Mhz
for (ii=0; ii<desc->nb_rx; ii++) {
{
rx_sig_re[ii][f+k*ofdm_symbol_size] = tx_sig_re[ii][f+k*ofdm_symbol_size]*path_loss;
rx_sig_im[ii][f+k*ofdm_symbol_size] = tx_sig_im[ii][f+k*ofdm_symbol_size]*path_loss;
}
#ifdef DEBUG_CH
printf("[CHANNEL_PRACH] keep = %d : path_loss = %g (%f), nb_rx %d, nb_tx %d, len %d \n",keep_channel,path_loss,desc->path_loss_dB,desc->nb_rx,desc->nb_tx,desc->channel_length);
#endif
if (keep_channel) {
// do nothing - keep channel
} else {
freq_channel_prach(desc,nb_rb,n_samples,prach_fmt,n_ra_prb);//Find desc->chF_prach
}
for (f=0;f<(prach_samples>>1); f++) {
//rx_tmp.x = 0;
//rx_tmp.y = 0;
rx_tmp128_re_f = _mm_setzero_pd();
rx_tmp128_im_f = _mm_setzero_pd();
for (ii=0; ii<desc->nb_rx; ii++) {
for (j=0; j<desc->nb_tx; j++) {
//RX_RE(k) = TX_RE(k).chF(k).x - TX_IM(k).chF(k).y
//RX_IM(k) = TX_IM(k).chF(k).x + TX_RE(k).chF(k).y
tx128_re = _mm_loadu_pd(&tx_sig_re[j][(2*f)]);
tx128_im = _mm_loadu_pd(&tx_sig_im[j][(2*f)]);
chF128_x = _mm_set1_pd(desc->ch[ii+(j*desc->nb_rx)][2*f+(prach_fmt<4)?13:3].x);
chF128_y = _mm_set1_pd(desc->ch[ii+(j*desc->nb_rx)][2*f+(prach_fmt<4)?13:3].y);
//rx_tmp.x += (tx_sig_re[ii][f] * desc->chF_prach[ii+(j*desc->nb_rx)][f+(prach_fmt<4)?13:3].x)-(tx_sig_im[ii][f] * desc->chF_prach[ii+(j*desc->nb_rx)][f+(prach_fmt<4)?13:3].y);
//rx_tmp.y += (tx_sig_im[ii][f] * desc->chF_prach[ii+(j*desc->nb_rx)][f+(prach_fmt<4)?13:3].x)+(tx_sig_re[ii][f] * desc->chF_prach[ii+(j*desc->nb_rx)][f+(prach_fmt<4)?13:3].y);
rx_tmp128_1 = _mm_mul_pd(tx128_re,chF128_x);
rx_tmp128_2 = _mm_mul_pd(tx128_im,chF128_y);
rx_tmp128_3 = _mm_mul_pd(tx128_im,chF128_x);
rx_tmp128_4 = _mm_mul_pd(tx128_re,chF128_y);
rx_tmp128_re = _mm_sub_pd(rx_tmp128_1,rx_tmp128_2);
rx_tmp128_im = _mm_add_pd(rx_tmp128_3,rx_tmp128_4);
rx_tmp128_re_f = _mm_add_pd(rx_tmp128_re_f,rx_tmp128_re);
rx_tmp128_im_f = _mm_add_pd(rx_tmp128_im_f,rx_tmp128_im);
} // ii
} // f
}//k
} // j
//printf("[multipath prach] k: %d\n",k/2);
//rx_sig_re[ii][f] = rx_tmp.x*path_loss;
//rx_sig_im[ii][f] = rx_tmp.y*path_loss;
rx_tmp128_re_f = _mm_mul_pd(rx_tmp128_re_f,pathloss128);
rx_tmp128_im_f = _mm_mul_pd(rx_tmp128_im_f,pathloss128);
_mm_storeu_pd(&rx_sig_re[ii][2*f],rx_tmp128_re_f); // max index: length-dd -1 + dd = length -1
_mm_storeu_pd(&rx_sig_im[ii][2*f],rx_tmp128_im_f);
} // ii
} // f
}
#else
void multipath_channel_prach(channel_desc_t *desc,
double *tx_sig_re[2],
double *tx_sig_im[2],
......@@ -547,7 +582,7 @@ void multipath_channel_prach(channel_desc_t *desc,
if (keep_channel) {
// do nothing - keep channel
} else {
random_channel(desc,0);//Find a(l)
//random_channel(desc,0);//Find a(l)
freq_channel_prach(desc,nb_rb,n_samples,prach_fmt,n_ra_prb);//Find desc->chF_prach
}
for (f=0;f<prach_samples; f++) {
......@@ -566,3 +601,30 @@ void multipath_channel_prach(channel_desc_t *desc,
} // ii
} // f
}
#endif
void multipath_channel_freq_test(channel_desc_t *desc,
double *tx_sig_re[2],
double *tx_sig_im[2],
double *rx_sig_re[2],
double *rx_sig_im[2],
uint32_t length,
uint8_t keep_channel)
{
int ii,k,f;
double path_loss = pow(10,desc->path_loss_dB/20);
int ofdm_symbol_size=length/PHY_vars_UE_g[0][0]->frame_parms.symbols_per_tti;
int symbols_per_tti=length/PHY_vars_UE_g[0][0]->frame_parms.ofdm_symbol_size;
for (k=0;k<symbols_per_tti;k++){//k = 0-13 normal cyclic prefix
for (f=0;f<ofdm_symbol_size; f++) {//f2 = 0-1024 for 10 Mhz
for (ii=0; ii<desc->nb_rx; ii++) {
{
rx_sig_re[ii][f+k*ofdm_symbol_size] = tx_sig_re[ii][f+k*ofdm_symbol_size]*path_loss;
rx_sig_im[ii][f+k*ofdm_symbol_size] = tx_sig_im[ii][f+k*ofdm_symbol_size]*path_loss;
}
} // ii
} // f
}//k
}
......@@ -28,6 +28,119 @@
#include "defs.h"
/*Ziggurat tables ytab, ktab, wtab are used in the random number generation routine*/
/*position of right-most step */
#define PARAM_R 3.44428647676
/* Tabulated values for the Ziggurat levels (heigt)*/
static const double ytab[128] = {
1, 0.963598623011, 0.936280813353, 0.913041104253,
0.892278506696, 0.873239356919, 0.855496407634, 0.838778928349,
0.822902083699, 0.807732738234, 0.793171045519, 0.779139726505,
0.765577436082, 0.752434456248, 0.739669787677, 0.727249120285,
0.715143377413, 0.703327646455, 0.691780377035, 0.68048276891,
0.669418297233, 0.65857233912, 0.647931876189, 0.637485254896,
0.62722199145, 0.617132611532, 0.607208517467, 0.597441877296,
0.587825531465, 0.578352913803, 0.569017984198, 0.559815170911,
0.550739320877, 0.541785656682, 0.532949739145, 0.524227434628,
0.515614886373, 0.507108489253, 0.498704867478, 0.490400854812,
0.482193476986, 0.47407993601, 0.466057596125, 0.458123971214,
0.450276713467, 0.442513603171, 0.434832539473, 0.427231532022,
0.419708693379, 0.41226223212, 0.404890446548, 0.397591718955,
0.390364510382, 0.383207355816, 0.376118859788, 0.369097692334,
0.362142585282, 0.355252328834, 0.348425768415, 0.341661801776,
0.334959376311, 0.328317486588, 0.321735172063, 0.31521151497,
0.308745638367, 0.302336704338, 0.29598391232, 0.289686497571,
0.283443729739, 0.27725491156, 0.271119377649, 0.265036493387,
0.259005653912, 0.253026283183, 0.247097833139, 0.241219782932,
0.235391638239, 0.229612930649, 0.223883217122, 0.218202079518,
0.212569124201, 0.206983981709, 0.201446306496, 0.195955776745,
0.190512094256, 0.185114984406, 0.179764196185, 0.174459502324,
0.169200699492, 0.1639876086, 0.158820075195, 0.153697969964,
0.148621189348, 0.143589656295, 0.138603321143, 0.133662162669,
0.128766189309, 0.123915440582, 0.119109988745, 0.114349940703,
0.10963544023, 0.104966670533, 0.100343857232, 0.0957672718266,
0.0912372357329, 0.0867541250127, 0.082318375932, 0.0779304915295,
0.0735910494266, 0.0693007111742, 0.065060233529, 0.0608704821745,
0.056732448584, 0.05264727098, 0.0486162607163, 0.0446409359769,
0.0407230655415, 0.0368647267386, 0.0330683839378, 0.0293369977411,
0.0256741818288, 0.0220844372634, 0.0185735200577, 0.0151490552854,
0.0118216532614, 0.00860719483079, 0.00553245272614, 0.00265435214565
};
/* Tabulated values for 2^24 times x[i]/x[i+1],
* used to accept for U*x[i+1]<=x[i] without any floating point operations */
static const unsigned long ktab[128] = {
0, 12590644, 14272653, 14988939,
15384584, 15635009, 15807561, 15933577,
16029594, 16105155, 16166147, 16216399,
16258508, 16294295, 16325078, 16351831,
16375291, 16396026, 16414479, 16431002,
16445880, 16459343, 16471578, 16482744,
16492970, 16502368, 16511031, 16519039,
16526459, 16533352, 16539769, 16545755,
16551348, 16556584, 16561493, 16566101,
16570433, 16574511, 16578353, 16581977,
16585398, 16588629, 16591685, 16594575,
16597311, 16599901, 16602354, 16604679,
16606881, 16608968, 16610945, 16612818,
16614592, 16616272, 16617861, 16619363,
16620782, 16622121, 16623383, 16624570,
16625685, 16626730, 16627708, 16628619,
16629465, 16630248, 16630969, 16631628,
16632228, 16632768, 16633248, 16633671,
16634034, 16634340, 16634586, 16634774,
16634903, 16634972, 16634980, 16634926,
16634810, 16634628, 16634381, 16634066,
16633680, 16633222, 16632688, 16632075,
16631380, 16630598, 16629726, 16628757,
16627686, 16626507, 16625212, 16623794,
16622243, 16620548, 16618698, 16616679,
16614476, 16612071, 16609444, 16606571,
16603425, 16599973, 16596178, 16591995,
16587369, 16582237, 16576520, 16570120,
16562917, 16554758, 16545450, 16534739,
16522287, 16507638, 16490152, 16468907,
16442518, 16408804, 16364095, 16301683,
16207738, 16047994, 15704248, 15472926
};
/* tabulated values of 2^{-24}*x[i] */
static const double wtab[128] = {
1.62318314817e-08, 2.16291505214e-08, 2.54246305087e-08, 2.84579525938e-08,
3.10340022482e-08, 3.33011726243e-08, 3.53439060345e-08, 3.72152672658e-08,
3.8950989572e-08, 4.05763964764e-08, 4.21101548915e-08, 4.35664624904e-08,
4.49563968336e-08, 4.62887864029e-08, 4.75707945735e-08, 4.88083237257e-08,
5.00063025384e-08, 5.11688950428e-08, 5.22996558616e-08, 5.34016475624e-08,
5.44775307871e-08, 5.55296344581e-08, 5.65600111659e-08, 5.75704813695e-08,
5.85626690412e-08, 5.95380306862e-08, 6.04978791776e-08, 6.14434034901e-08,
6.23756851626e-08, 6.32957121259e-08, 6.42043903937e-08, 6.51025540077e-08,
6.59909735447e-08, 6.68703634341e-08, 6.77413882848e-08, 6.8604668381e-08,
6.94607844804e-08, 7.03102820203e-08, 7.11536748229e-08, 7.1991448372e-08,
7.2824062723e-08, 7.36519550992e-08, 7.44755422158e-08, 7.52952223703e-08,
7.61113773308e-08, 7.69243740467e-08, 7.77345662086e-08, 7.85422956743e-08,
7.93478937793e-08, 8.01516825471e-08, 8.09539758128e-08, 8.17550802699e-08,
8.25552964535e-08, 8.33549196661e-08, 8.41542408569e-08, 8.49535474601e-08,
8.57531242006e-08, 8.65532538723e-08, 8.73542180955e-08, 8.8156298059e-08,
8.89597752521e-08, 8.97649321908e-08, 9.05720531451e-08, 9.138142487e-08,
9.21933373471e-08, 9.30080845407e-08, 9.38259651738e-08, 9.46472835298e-08,
9.54723502847e-08, 9.63014833769e-08, 9.71350089201e-08, 9.79732621669e-08,
9.88165885297e-08, 9.96653446693e-08, 1.00519899658e-07, 1.0138063623e-07,
1.02247952126e-07, 1.03122261554e-07, 1.04003996769e-07, 1.04893609795e-07,
1.05791574313e-07, 1.06698387725e-07, 1.07614573423e-07, 1.08540683296e-07,
1.09477300508e-07, 1.1042504257e-07, 1.11384564771e-07, 1.12356564007e-07,
1.13341783071e-07, 1.14341015475e-07, 1.15355110887e-07, 1.16384981291e-07,
1.17431607977e-07, 1.18496049514e-07, 1.19579450872e-07, 1.20683053909e-07,
1.21808209468e-07, 1.2295639141e-07, 1.24129212952e-07, 1.25328445797e-07,
1.26556042658e-07, 1.27814163916e-07, 1.29105209375e-07, 1.30431856341e-07,
1.31797105598e-07, 1.3320433736e-07, 1.34657379914e-07, 1.36160594606e-07,
1.37718982103e-07, 1.39338316679e-07, 1.41025317971e-07, 1.42787873535e-07,
1.44635331499e-07, 1.4657889173e-07, 1.48632138436e-07, 1.50811780719e-07,
1.53138707402e-07, 1.55639532047e-07, 1.58348931426e-07, 1.61313325908e-07,
1.64596952856e-07, 1.68292495203e-07, 1.72541128694e-07, 1.77574279496e-07,
1.83813550477e-07, 1.92166040885e-07, 2.05295471952e-07, 2.22600839893e-07
};
static unsigned int seed, iy, ir[98];
/*
@defgroup _uniformdouble
......@@ -114,9 +227,12 @@ double uniformrandom(void)
*/
/*!\brief Gaussian random number generator based on modified Box-Muller transformation.Returns a double-precision floating-point number. */
#define Ziggurat_SSE
#ifdef Ziggurat_SSE
double gaussdouble(double mean, double variance)
{
static int iset=0;
static double gset;
double fac,r,v1,v2;
......@@ -137,7 +253,30 @@ double gaussdouble(double mean, double variance)
return(sqrt(variance)*gset + mean);
}
}
#else
double gaussdouble(double mean, double variance)
{
static int iset=0;
static double gset;
double fac,r,v1,v2;
if (iset == 0) {
do {
v1 = 2.0*uniformrandom()-1.0;
v2 = 2.0*uniformrandom()-1.0;
r = v1*v1+v2*v2;
} while (r >= 1.0);
fac = sqrt(-2.0*log(r)/r);
gset= v1*fac;
iset=1;
return(sqrt(variance)*v2*fac + mean);
} else {
iset=0;
return(sqrt(variance)*gset + mean);
}
}
#endif
#ifdef MAIN
......
......@@ -139,7 +139,7 @@ eNBs =
////////// MME parameters:
mme_ip_address = ( { ipv4 = "172.24.11.18";
mme_ip_address = ( { ipv4 = "172.24.11.4";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
......
This diff is collapsed.
......@@ -1481,19 +1481,22 @@ reset_opp_meas_oaisim (void)
reset_meas (&UE2eNB[UE_id][eNB_id][0]->interp_time);
reset_meas (&UE2eNB[UE_id][eNB_id][0]->interp_freq);
reset_meas (&UE2eNB[UE_id][eNB_id][0]->convolution);
//Frequency domain - Time consumption analysis
//Time consuming in Frequency analysis
//Downlink
reset_meas (&eNB2UE[eNB_id][UE_id][0]->DL_multipath_channel_freq);
reset_meas (&eNB2UE[eNB_id][UE_id][0]->DL_dac_fixed_gain);
reset_meas (&eNB2UE[eNB_id][UE_id][0]->DL_rf_rx_simple_freq);
reset_meas (&eNB2UE[eNB_id][UE_id][0]->DL_adc);
reset_meas (&UE2eNB[UE_id][eNB_id][0]->multipath_channel_freq_PRACH);
//Uplink
reset_meas (&UE2eNB[UE_id][eNB_id][0]->UL_multipath_channel_freq);
reset_meas (&UE2eNB[UE_id][eNB_id][0]->UL_dac_fixed_gain);
reset_meas (&UE2eNB[UE_id][eNB_id][0]->UL_rf_rx_simple_freq);
reset_meas (&UE2eNB[UE_id][eNB_id][0]->UL_adc);
//PRACH
reset_meas (&UE2eNB[UE_id][eNB_id][0]->multipath_channel_freq_PRACH);
reset_meas (&UE2eNB[UE_id][eNB_id][0]->dac_fixed_gain_PRACH);
reset_meas (&UE2eNB[UE_id][eNB_id][0]->rf_rx_simple_freq_PRACH);
reset_meas (&UE2eNB[UE_id][eNB_id][0]->adc_PRACH);
}
reset_meas (&PHY_vars_eNB_g[eNB_id][0]->phy_proc);
......@@ -1591,6 +1594,35 @@ print_opp_meas_oaisim (void)
"[UL][interp_freq]", &oaisim_stats, &oaisim_stats_f);
print_meas (&UE2eNB[UE_id][eNB_id][0]->convolution,
"[UL][convolution]", &oaisim_stats, &oaisim_stats_f);
//Time consuming in Frequency analysis
//Downlink
print_meas (&eNB2UE[eNB_id][UE_id][0]->DL_multipath_channel_freq,
"[DL][multipath_channel_freq]", &oaisim_stats, &oaisim_stats_f);
print_meas (&eNB2UE[eNB_id][UE_id][0]->DL_dac_fixed_gain,
"[DL][dac_fixed_gain]", &oaisim_stats, &oaisim_stats_f);
print_meas (&eNB2UE[eNB_id][UE_id][0]->DL_rf_rx_simple_freq,
"[DL][rf_rx_simple_freq]", &oaisim_stats, &oaisim_stats_f);
print_meas (&eNB2UE[eNB_id][UE_id][0]->DL_adc,
"[DL][adc]", &oaisim_stats, &oaisim_stats_f);
//Uplink
print_meas (&UE2eNB[UE_id][eNB_id][0]->UL_multipath_channel_freq,
"[UL][multipath_channel_freq]", &oaisim_stats, &oaisim_stats_f);
print_meas (&UE2eNB[UE_id][eNB_id][0]->UL_dac_fixed_gain,
"[UL][dac_fixed_gain]", &oaisim_stats, &oaisim_stats_f);
print_meas (&UE2eNB[UE_id][eNB_id][0]->UL_rf_rx_simple_freq,
"[UL][rf_rx_simple_freq]", &oaisim_stats, &oaisim_stats_f);
print_meas (&UE2eNB[UE_id][eNB_id][0]->UL_adc,
"[UL][adc]", &oaisim_stats, &oaisim_stats_f);
//PRACH
print_meas (&UE2eNB[UE_id][eNB_id][0]->multipath_channel_freq_PRACH,
"[UL_PRACH][multipath_channel_freq]", &oaisim_stats, &oaisim_stats_f);
print_meas (&UE2eNB[UE_id][eNB_id][0]->dac_fixed_gain_PRACH,
"[UL_PRACH][dac_fixed_gain]", &oaisim_stats, &oaisim_stats_f);
print_meas (&UE2eNB[UE_id][eNB_id][0]->rf_rx_simple_freq_PRACH,
"[UL_PRACH][rf_rx_simple_freq]", &oaisim_stats, &oaisim_stats_f);
print_meas (&UE2eNB[UE_id][eNB_id][0]->adc_PRACH,
"[UL_PRACH][adc]", &oaisim_stats, &oaisim_stats_f);
}
}
......@@ -1868,7 +1900,6 @@ oai_shutdown (void)
}
if (oai_emulation.info.opp_enabled == 1)
print_opp_meas_oaisim ();
// relase all rx state
if (ethernet_flag == 1) {
emu_transport_release ();
......
......@@ -1041,17 +1041,16 @@ extern int subframe_eNB_mask,subframe_UE_mask;
int eNB_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc)
{
/*static int first_meas=0;
static int first_run=0;
static double sum;
static int count;
if (!first_run)
static int count=0;
int eNB,UE,CC;
if (count==500)
{
first_run=1;
sum=0;
//Use ./oaisim -q option to enable the oai performance profiler.
count=0;
}*/
print_opp_meas_oaisim ();
reset_opp_meas_oaisim ();
}
count++;
int ret = nsamps;
int eNB_id = device->Mod_id;
......@@ -1120,8 +1119,6 @@ int eNB_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void *
for (UE_id=0; UE_id<NB_UE_INST; UE_id++){
if (is_prach_subframe(&PHY_vars_UE_g[UE_id][CC_id]->frame_parms,frame,subframe) && PHY_vars_UE_g[UE_id][CC_id]->generate_prach)
{
/*count++;
clock_t start=clock();*/
do_UL_sig_freq_prach(UE2eNB,
enb_data,
ue_data,
......@@ -1131,33 +1128,10 @@ int eNB_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void *
0, // frame is only used for abstraction
eNB_id,
CC_id);
/*clock_t stop=clock();
printf("do_UL_sig_PRACH time is %f s, AVERAGE time is %f s, count %d, sum %e\n",(float) (stop-start)/CLOCKS_PER_SEC,(float) (sum+stop-start)/(count*CLOCKS_PER_SEC),count,sum+stop-start);
sum=(sum+stop-start);*/
//write_output("txprachF.m","prach_txF", PHY_vars_UE_g[0][CC_id]->prach_vars[0]->prachF,12*frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti,1,16);
break;
}
}
//// oai performance profiler is disabled, opp=0. Use ./oaisim -q option
/*if (!first_meas || ul_chan_stats_f.trials<0)
{
printf("first_meas %d\n",first_meas);
reset_meas(&ul_chan_stats_f);
first_meas=1;
}
printf("trials %d, diff %d, diff_now %d, p_time %d diff_square %d, max %d, meas_flag %d\n",(int)ul_chan_stats_f.trials,
(int)ul_chan_stats_f.diff,
(int)ul_chan_stats_f.diff_now,
(int)ul_chan_stats_f.p_time,
(int)ul_chan_stats_f.diff_square,
(int)ul_chan_stats_f.max,
(int)ul_chan_stats_f.meas_flag);
start_meas(&ul_chan_stats_f);*/
/*count++;
clock_t start=clock();*/
do_UL_sig_freq(UE2eNB,
enb_data,
ue_data,
......@@ -1167,16 +1141,9 @@ int eNB_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void *
0, // frame is only used for abstraction
eNB_id,
CC_id);
/*clock_t stop=clock();
printf("do_UL_sig freq is %f s, AVERAGE time is %f s, count %d, sum %e\n",(float) (stop-start)/CLOCKS_PER_SEC,(float) (sum+stop-start)/(count*CLOCKS_PER_SEC),count,sum+stop-start);
sum=(sum+stop-start);*/
/*stop_meas(&ul_chan_stats_f);
print_meas(&ul_chan_stats_f,"UL_Channel Stats Frequency Domain",&ul_chan_stats_f,&ul_chan_stats_f);*/
}
else
{
//clock_t start=clock();
do_UL_sig(UE2eNB,
enb_data,
ue_data,
......@@ -1186,11 +1153,6 @@ int eNB_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void *
0, // frame is only used for abstraction
eNB_id,
CC_id);
/*clock_t stop=clock();
printf("do_UL_sig time is %f s, AVERAGE time is %f s, count %d, sum %e\n",(float) (stop-start)/CLOCKS_PER_SEC,(float) (sum+stop-start)/(count*CLOCKS_PER_SEC),count,sum+stop-start);
sum=(sum+stop-start);*/
//if (is_prach_subframe(frame_parms,frame,subframe))
//write_output("txprachF.m","prach_txF", PHY_vars_UE_g[0][CC_id]->prach_vars[0]->prachF,12*frame_parms->ofdm_symbol_size*frame_parms->symbols_per_tti,1,16);
}
last_eNB_rx_timestamp[eNB_id][CC_id] = last;
......@@ -1204,16 +1166,6 @@ int eNB_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void *
int UE_trx_read(openair0_device *device, openair0_timestamp *ptimestamp, void **buff, int nsamps, int cc)
{
/*static int first_run=0;
static double sum;
static int count;
if (!first_run)
{
first_run=1;
sum=0;
count=0;
}
count++;*/
int ret = nsamps;
int UE_id = device->Mod_id;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment