Commit 09c1f062 authored by Luis Ariza's avatar Luis Ariza

SIMD sincos function implemented and working

parent c77b8600
...@@ -335,14 +335,19 @@ float signal_energy_fp_SSE_float(float *s_re[2],float *s_im[2],uint32_t nb_anten ...@@ -335,14 +335,19 @@ float signal_energy_fp_SSE_float(float *s_re[2],float *s_im[2],uint32_t nb_anten
{ {
int32_t aa,i; int32_t aa,i;
float V=0.0; __m128 V128, s_re128,s_im128;
V128 = _mm_setzero_ps();
for (i=0; i<length; i++) { for (i=0; i<(length>>2); i++) {
for (aa=0; aa<nb_antennas; aa++) { for (aa=0; aa<nb_antennas; aa++) {
V= V + (s_re[aa][i+offset]*s_re[aa][i+offset]) + (s_im[aa][i+offset]*s_im[aa][i+offset]); // V= V + (s_re[aa][i+offset]*s_re[aa][i+offset]) + (s_im[aa][i+offset]*s_im[aa][i+offset]);
s_re128=_mm_loadu_ps(&s_re[aa][4*i+offset]);
s_im128=_mm_loadu_ps(&s_im[aa][4*i+offset]);
s_re128=_mm_mul_ps(s_re128,s_re128);
s_im128=_mm_mul_ps(s_im128,s_im128);
V128=_mm_add_ps(V128,_mm_add_ps(s_re128,s_im128));
} }
} }
return(V/length/nb_antennas); return((V128[0]+V128[1]+V128[2]+V128[3])/length/nb_antennas);
} }
double signal_energy_fp2(struct complex *s,uint32_t length) double signal_energy_fp2(struct complex *s,uint32_t length)
......
...@@ -206,7 +206,7 @@ void rf_rx_simple(double *r_re[2], ...@@ -206,7 +206,7 @@ void rf_rx_simple(double *r_re[2],
double s_time, double s_time,
double rx_gain_dB) double rx_gain_dB)
{ {
static int first_run=0; /* static int first_run=0;
static double sum; static double sum;
static int count; static int count;
if (!first_run) if (!first_run)
...@@ -214,7 +214,7 @@ void rf_rx_simple(double *r_re[2], ...@@ -214,7 +214,7 @@ void rf_rx_simple(double *r_re[2],
first_run=1; first_run=1;
sum=0; sum=0;
count=0; count=0;
} } */
int i,a; int i,a;
double rx_gain_lin = pow(10.0,.05*rx_gain_dB); double rx_gain_lin = pow(10.0,.05*rx_gain_dB);
//double rx_gain_lin = 1.0; //double rx_gain_lin = 1.0;
......
This diff is collapsed.
...@@ -61,7 +61,7 @@ typedef struct { ...@@ -61,7 +61,7 @@ typedef struct {
struct complex **chF; struct complex **chF;
struct complexf *chFf; struct complexf *chFf;
///Sampled prach frequency response (frequency analysis) ///Sampled prach frequency response (frequency analysis)
struct complex **chF_prach; struct complexf *chF_prach;
///Maximum path delay in mus. ///Maximum path delay in mus.
double Td; double Td;
///Channel bandwidth in MHz. ///Channel bandwidth in MHz.
...@@ -478,9 +478,13 @@ double ziggurat(double mean, double variance); ...@@ -478,9 +478,13 @@ double ziggurat(double mean, double variance);
int freq_channel(channel_desc_t *desc,uint16_t nb_rb, int16_t n_samples); int freq_channel(channel_desc_t *desc,uint16_t nb_rb, int16_t n_samples);
int freq_channel_SSE_float(channel_desc_t *desc,uint16_t nb_rb, int16_t n_samples); int freq_channel_SSE_float(channel_desc_t *desc,uint16_t nb_rb, int16_t n_samples);
int freq_channel_prach(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int16_t prach_fmt,int16_t n_ra_prb); int freq_channel_prach(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int16_t prach_fmt,int16_t n_ra_prb);
int freq_channel_prach_SSE_float(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int16_t prach_fmt,int16_t n_ra_prb);
int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples); int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples);
int init_freq_channel_SSE_float(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples); int init_freq_channel_SSE_float(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples);
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); 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);
int init_freq_channel_prach_SSE_float(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples,int16_t prach_fmt,int16_t n_ra_prb);
void sincos_ps(__m128 x, __m128 *s, __m128 *c);
uint8_t multipath_channel_nosigconv(channel_desc_t *desc); uint8_t multipath_channel_nosigconv(channel_desc_t *desc);
void multipath_tv_channel(channel_desc_t *desc, void multipath_tv_channel(channel_desc_t *desc,
......
...@@ -763,7 +763,7 @@ void multipath_channel_prach_SSE_float(channel_desc_t *desc, ...@@ -763,7 +763,7 @@ void multipath_channel_prach_SSE_float(channel_desc_t *desc,
// do nothing - keep channel // do nothing - keep channel
} else { } else {
random_channel_freq(desc,0); random_channel_freq(desc,0);
freq_channel_prach(desc,nb_rb,n_samples,prach_fmt,n_ra_prb);//Find desc->chF_prach freq_channel_prach_SSE_float(desc,nb_rb,n_samples,prach_fmt,n_ra_prb);//Find desc->chF_prach
} }
for (f=0;f<(length>>2); f++) { for (f=0;f<(length>>2); f++) {
//rx_tmp.x = 0; //rx_tmp.x = 0;
...@@ -776,8 +776,8 @@ void multipath_channel_prach_SSE_float(channel_desc_t *desc, ...@@ -776,8 +776,8 @@ void multipath_channel_prach_SSE_float(channel_desc_t *desc,
//RX_IM(k) = TX_IM(k).chF(k).x + TX_RE(k).chF(k).y //RX_IM(k) = TX_IM(k).chF(k).x + TX_RE(k).chF(k).y
tx128_re = _mm_loadu_ps(&tx_sig_re[j][(4*f)]); tx128_re = _mm_loadu_ps(&tx_sig_re[j][(4*f)]);
tx128_im = _mm_loadu_ps(&tx_sig_im[j][(4*f)]); tx128_im = _mm_loadu_ps(&tx_sig_im[j][(4*f)]);
chF128_x = _mm_set1_ps(desc->chFf[ii+(j*desc->nb_rx)].x[4*f+(prach_fmt<4)?13:3]); chF128_x = _mm_set1_ps(desc->chF_prach[ii+(j*desc->nb_rx)].x[4*f+(prach_fmt<4)?13:3]);
chF128_y = _mm_set1_ps(desc->chFf[ii+(j*desc->nb_rx)].y[4*f+(prach_fmt<4)?13:3]); chF128_y = _mm_set1_ps(desc->chF_prach[ii+(j*desc->nb_rx)].y[4*f+(prach_fmt<4)?13:3]);
//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.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_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_ps(tx128_re,chF128_x); rx_tmp128_1 = _mm_mul_ps(tx128_re,chF128_x);
......
This diff is collapsed.
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