Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
promise
OpenXG-RAN
Commits
e8ef1cdb
Commit
e8ef1cdb
authored
Jan 25, 2018
by
lfarizav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimizing channel functions
parent
d4a81046
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
137 additions
and
64 deletions
+137
-64
openair1/SIMULATION/RF/adc.c
openair1/SIMULATION/RF/adc.c
+36
-0
openair1/SIMULATION/RF/rf.c
openair1/SIMULATION/RF/rf.c
+2
-2
openair1/SIMULATION/TOOLS/abstraction.c
openair1/SIMULATION/TOOLS/abstraction.c
+93
-53
openair1/SIMULATION/TOOLS/random_channel.c
openair1/SIMULATION/TOOLS/random_channel.c
+2
-2
openair1/SIMULATION/TOOLS/rangen_double.c
openair1/SIMULATION/TOOLS/rangen_double.c
+1
-3
targets/SIMU/USER/channel_sim.c
targets/SIMU/USER/channel_sim.c
+3
-4
No files found.
openair1/SIMULATION/RF/adc.c
View file @
e8ef1cdb
...
...
@@ -118,6 +118,42 @@ void adc_SSE_float(float *r_re[2],
//printf("Adc outputs %d %e %d \n",i,((short *)output[0])[((i+output_offset)<<1)], ((i+output_offset)<<1) );
}
}
void
adc_SSE_float_test
(
float
*
r_re
[
2
],
float
*
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
;
__m128
r_re128
,
r_im128
,
gain128
;
__m128i
r_re128i
,
r_im128i
,
output128
;
float
gain
=
(
float
)(
1
<<
(
B
-
1
));
gain128
=
_mm_set1_ps
(
gain
);
for
(
i
=
0
;
i
<
(
length
>>
2
);
i
++
)
{
for
(
aa
=
0
;
aa
<
nb_rx_antennas
;
aa
++
)
{
r_re128
=
_mm_loadu_ps
(
&
r_re
[
aa
][
4
*
i
+
input_offset
]);
r_im128
=
_mm_loadu_ps
(
&
r_im
[
aa
][
4
*
i
+
input_offset
]);
r_re128
=
_mm_mul_ps
(
r_re128
,
gain128
);
r_im128
=
_mm_mul_ps
(
r_im128
,
gain128
);
r_re128i
=
_mm_cvtps_epi32
(
r_re128
);
r_im128i
=
_mm_cvtps_epi32
(
r_im128
);
output128
=
_mm_packs_epi32
(
r_im128i
,
r_re128i
);
_mm_store_si128
(
&
output
[
aa
][
4
*
i
+
input_offset
],
output128
);
}
}
for
(
i
=
0
;
i
<
(
length
>>
2
);
i
++
)
{
for
(
aa
=
0
;
aa
<
nb_rx_antennas
;
aa
++
)
{
}
}
/*for (i=0; i<length; i++) {
printf("output[%d] %d\n",i,((short *)output[0])[((4*i+output_offset)<<1)]);
}*/
}
void
adc_freq
(
double
*
r_re
[
2
],
double
*
r_im
[
2
],
unsigned
int
input_offset
,
...
...
openair1/SIMULATION/RF/rf.c
View file @
e8ef1cdb
...
...
@@ -419,8 +419,8 @@ clock_t start=clock();*/
rx128_re
=
_mm_loadu_ps
(
&
r_re
[
a
][
4
*
i
]);
//r_re[a][i],r_re[a][i+1]
rx128_im
=
_mm_loadu_ps
(
&
r_im
[
a
][
4
*
i
]);
//r_im[a][i],r_im[a][i+1]
rx128_gain_lin
=
_mm_set1_ps
(
rx_gain_lin
);
gauss_0_128_sqrt_NOW
=
_mm_set
_ps
(
ziggurat
(
0
.
0
,
1
.
0
),
ziggurat
(
0
.
0
,
1
.
0
),
ziggurat
(
0
.
0
,
1
.
0
),
ziggurat
(
0
.
0
,
1
.
0
));
gauss_1_128_sqrt_NOW
=
_mm_set
_ps
(
ziggurat
(
0
.
0
,
1
.
0
),
ziggurat
(
0
.
0
,
1
.
0
),
ziggurat
(
0
.
0
,
1
.
0
),
ziggurat
(
0
.
0
,
1
.
0
));
gauss_0_128_sqrt_NOW
=
_mm_set
1_ps
(
ziggurat
(
0
.
0
,
1
.
0
));
gauss_1_128_sqrt_NOW
=
_mm_set
1_ps
(
ziggurat
(
0
.
0
,
1
.
0
));
gauss_0_128_sqrt_NOW
=
_mm_mul_ps
(
gauss_0_128_sqrt_NOW
,
_mm_set1_ps
(
sqrt_NOW
));
gauss_1_128_sqrt_NOW
=
_mm_mul_ps
(
gauss_1_128_sqrt_NOW
,
_mm_set1_ps
(
sqrt_NOW
));
// Amplify by receiver gain and apply 3rd order non-linearity
...
...
openair1/SIMULATION/TOOLS/abstraction.c
View file @
e8ef1cdb
...
...
@@ -31,68 +31,101 @@
// NEW code with lookup table for sin/cos based on delay profile (TO BE TESTED)
double
**
cos_lut
=
NULL
,
**
sin_lut
=
NULL
;
static
double
**
cos_lut
=
NULL
,
**
sin_lut
=
NULL
;
//#if 1
//#define abstraction_SSE
#ifdef abstraction_SSE
#ifdef abstraction_SSE
//abstraction_SSE is not working.
int
init_freq_channel
(
channel_desc_t
*
desc
,
uint16_t
nb_rb
,
int16_t
n_samples
)
{
double
delta_f
,
freq
;
// 90 kHz spacing
static
int
first_run
=
1
;
double
delta_f
,
freq
,
twopi
;
// 90 kHz spacing
double
delay
;
int16_t
f
;
uint8_t
l
;
//__m128d cos_lut128,sin_lut128,freq128,delay128;
__m128d
cos_lut128
,
sin_lut128
;
//static int count=0;
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
;
delta_f
=
nb_rb
*
180000
/
(
n_samples
-
1
);
cos_lut
=
(
double
**
)
malloc
(
n_samples
*
sizeof
(
double
*
));
sin_lut
=
(
double
**
)
malloc
(
n_samples
*
sizeof
(
double
*
));
if
(
first_run
)
{
cos_lut
=
(
double
**
)
malloc16
(
n_samples
*
sizeof
(
double
*
));
sin_lut
=
(
double
**
)
malloc16
(
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
));
cos_lut
[
f
+
(
n_samples
>>
1
)]
=
(
double
*
)
malloc16_clear
((
int
)
desc
->
nb_taps
*
sizeof
(
double
));
sin_lut
[
f
+
(
n_samples
>>
1
)]
=
(
double
*
)
malloc16_clear
((
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);
first_run
=
0
;
}
twopi
=
2
*
M_PI
*
1e-6
*
delta_f
;
for
(
f
=-
(
n_samples
>>
2
);
f
<
0
;
f
++
)
{
//count++;
//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
];
//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);*/
cos_lut128
=
_mm_set_pd
(
cos
(
twopi
*
2
*
f
*
delay
),
cos
(
twopi
*
(
2
*
f
+
1
)
*
delay
));
sin_lut128
=
_mm_set_pd
(
sin
(
twopi
*
2
*
f
*
delay
),
sin
(
twopi
*
(
2
*
f
+
1
)
*
delay
));
_mm_storeu_pd
(
&
cos_lut
[
2
*
f
+
(
n_samples
>>
1
)][
l
],
cos_lut128
);
_mm_storeu_pd
(
&
sin_lut
[
2
*
f
+
(
n_samples
>>
1
)][
l
],
sin_lut128
);
//cos_lut[f+(n_samples>>1)][l] = cos(2*M_PI*freq*delay);
//sin_lut[f+(n_samples>>1)][l] = sin(2*M_PI*freq*delay);
//printf("values cos:%d, sin:%d\n", cos_lut[f][l], sin_lut[f][l]);
}
}
for
(
l
=
0
;
l
<
(
int
)
desc
->
nb_taps
;
l
++
)
{
cos_lut
[(
n_samples
>>
1
)][
l
]
=
1
;
sin_lut
[(
n_samples
>>
1
)][
l
]
=
0
;
printf
(
"[%d][%d] (cos,sin) (%e,%e):
\n
"
,
2
*
f
,
l
,
cos_lut
[(
n_samples
>>
1
)][
l
],
sin_lut
[(
n_samples
>>
1
)][
l
]);
}
for
(
f
=
1
;
f
<=
(
n_samples
>>
2
);
f
++
)
{
//count++;
//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
];
else
delay
=
desc
->
delays
[
l
]
+
NB_SAMPLES_CHANNEL_OFFSET
/
desc
->
sampling_rate
;
cos_lut128
=
_mm_set_pd
(
cos
(
twopi
*
2
*
f
*
delay
),
cos
(
twopi
*
(
2
*
f
+
1
)
*
delay
));
sin_lut128
=
_mm_set_pd
(
sin
(
twopi
*
2
*
f
*
delay
),
sin
(
twopi
*
(
2
*
f
+
1
)
*
delay
));
_mm_storeu_pd
(
&
cos_lut
[
2
*
f
+
(
n_samples
>>
1
)][
l
],
cos_lut128
);
_mm_storeu_pd
(
&
sin_lut
[
2
*
f
+
(
n_samples
>>
1
)][
l
],
sin_lut128
);
//cos_lut[f+(n_samples>>1)][l] = cos(2*M_PI*freq*delay);
//sin_lut[f+(n_samples>>1)][l] = sin(2*M_PI*freq*delay);
//printf("values cos:%d, sin:%d\n", cos_lut[f][l], sin_lut[f][l]);
}
}
for
(
f
=-
(
n_samples
>>
1
);
f
<=
(
n_samples
>>
1
);
f
++
)
{
for
(
l
=
0
;
l
<
(
int
)
desc
->
nb_taps
;
l
++
)
{
printf
(
"[%d][%d] (cos,sin) (%e,%e):
\n
"
,
f
,
l
,
cos_lut
[
f
+
(
n_samples
>>
1
)][
l
],
sin_lut
[
f
+
(
n_samples
>>
1
)][
l
]);
}
}
return
(
0
);
}
#else
int
init_freq_channel
(
channel_desc_t
*
desc
,
uint16_t
nb_rb
,
int16_t
n_samples
)
{
static
int
first_run
;
static
int
first_run
=
1
;
double
delta_f
,
freq
;
// 90 kHz spacing
double
delay
;
int16_t
f
;
uint8_t
l
;
//static int count=0;
if
((
n_samples
&
1
)
==
0
)
{
fprintf
(
stderr
,
"freq_channel_init: n_samples has to be odd
\n
"
);
...
...
@@ -100,14 +133,19 @@ int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
}
delta_f
=
nb_rb
*
180000
/
(
n_samples
-
1
);
cos_lut
=
(
double
**
)
malloc
(
n_samples
*
sizeof
(
double
*
));
sin_lut
=
(
double
**
)
malloc
(
n_samples
*
sizeof
(
double
*
));
if
(
first_run
)
{
cos_lut
=
(
double
**
)
malloc16
(
n_samples
*
sizeof
(
double
*
));
sin_lut
=
(
double
**
)
malloc16
(
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
));
cos_lut
[
f
+
(
n_samples
>>
1
)]
=
(
double
*
)
malloc16_clear
((
int
)
desc
->
nb_taps
*
sizeof
(
double
));
sin_lut
[
f
+
(
n_samples
>>
1
)]
=
(
double
*
)
malloc16_clear
((
int
)
desc
->
nb_taps
*
sizeof
(
double
));
}
first_run
=
0
;
}
for
(
f
=-
(
n_samples
>>
1
);
f
<=
(
n_samples
>>
1
);
f
++
)
{
//count++;
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
)
...
...
@@ -117,24 +155,23 @@ int init_freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
cos_lut
[
f
+
(
n_samples
>>
1
)][
l
]
=
cos
(
2
*
M_PI
*
freq
*
delay
);
sin_lut
[
f
+
(
n_samples
>>
1
)][
l
]
=
sin
(
2
*
M_PI
*
freq
*
delay
);
//printf("
values cos:%d, sin:%d\n", cos_lut[f][l], sin_lut[f
][l]);
//printf("
[%d][%d] (cos,sin) (%e,%e):\n",f,l,cos_lut[f+(n_samples>>1)][l],sin_lut[f+(n_samples>>1)
][l]);
}
}
//printf("count %d\n",count);
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
;
__m128d
clut128
,
slut128
,
chFx_128
,
chFy_128
;
// 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
...
...
@@ -161,22 +198,25 @@ int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
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
(
f
=-
(
n_samples_max
>>
2
),
f2
=-
(
n_samples
>>
2
);
f
<
(
n_samples_max
>>
2
);
f
+=
d
,
f2
++
)
{
//clut = cos_lut[(n_samples_max>>1)+f];
//slut = sin_lut[(n_samples_max>>1)+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
;
chFx_128
=
_mm_setzero_pd
();
chFy_128
=
_mm_setzero_pd
();
//desc->chF[aarx+(aatx*desc->nb_rx)][(n_samples>>1)+f2].x=0.0;
//desc->chF[aarx+(aatx*desc->nb_rx)][(n_samples>>1)+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
]);
//desc->chF[aarx+(aatx*desc->nb_rx)][(n_samples>>1)+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>>1)+f2].y+=(-desc->a[l][aarx+(aatx*desc->nb_rx)].x*slut[l]+
// desc->a[l][aarx+(aatx*desc->nb_rx)].y*clut[l]);
chFx_128
=
_mm_add_pd
(
chFx_128
,
_mm_add_pd
(
_mm_mul_pd
(
_mm_set1_pd
(
desc
->
a
[
l
][
aarx
+
(
aatx
*
desc
->
nb_rx
)].
x
),
_mm_loadu_pd
(
&
cos_lut
[(
n_samples_max
>>
1
)
+
2
*
f
][
l
])),
_mm_mul_pd
(
_mm_set1_pd
(
desc
->
a
[
l
][
aarx
+
(
aatx
*
desc
->
nb_rx
)].
y
),
_mm_loadu_pd
(
&
sin_lut
[(
n_samples_max
>>
1
)
+
2
*
f
][
l
]))));
chFy_128
=
_mm_add_pd
(
chFy_128
,
_mm_sub_pd
(
_mm_mul_pd
(
_mm_set1_pd
(
desc
->
a
[
l
][
aarx
+
(
aatx
*
desc
->
nb_rx
)].
y
),
_mm_loadu_pd
(
&
cos_lut
[(
n_samples_max
>>
1
)
+
2
*
f
][
l
])),
_mm_mul_pd
(
_mm_set1_pd
(
desc
->
a
[
l
][
aarx
+
(
aatx
*
desc
->
nb_rx
)].
x
),
_mm_loadu_pd
(
&
sin_lut
[(
n_samples_max
>>
1
)
+
2
*
f
][
l
]))));
}
_mm_storeu_pd
(
&
desc
->
chF
[
aarx
+
(
aatx
*
desc
->
nb_rx
)][(
n_samples
>>
1
)
+
2
*
f2
].
x
,
chFx_128
);
_mm_storeu_pd
(
&
desc
->
chF
[
aarx
+
(
aatx
*
desc
->
nb_rx
)][(
n_samples
>>
1
)
+
2
*
f2
].
y
,
chFy_128
);
}
}
}
...
...
@@ -221,20 +261,20 @@ int freq_channel(channel_desc_t *desc,uint16_t nb_rb,int16_t n_samples)
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
(
f
=-
(
n_samples_max
>>
1
),
f2
=-
(
n_samples
>>
1
);
f
<
(
n_samples_max
>>
1
)
;
f
+=
d
,
f2
++
)
{
clut
=
cos_lut
[
(
n_samples_max
>>
1
)
+
f
];
slut
=
sin_lut
[
(
n_samples_max
>>
1
)
+
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
;
desc
->
chF
[
aarx
+
(
aatx
*
desc
->
nb_rx
)][
(
n_samples
>>
1
)
+
f2
].
x
=
0
.
0
;
desc
->
chF
[
aarx
+
(
aatx
*
desc
->
nb_rx
)][
(
n_samples
>>
1
)
+
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
->
chF
[
aarx
+
(
aatx
*
desc
->
nb_rx
)][
(
n_samples
>>
1
)
+
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
->
chF
[
aarx
+
(
aatx
*
desc
->
nb_rx
)][
(
n_samples
>>
1
)
+
f2
].
y
+=
(
-
desc
->
a
[
l
][
aarx
+
(
aatx
*
desc
->
nb_rx
)].
x
*
slut
[
l
]
+
desc
->
a
[
l
][
aarx
+
(
aatx
*
desc
->
nb_rx
)].
y
*
clut
[
l
]);
}
}
...
...
openair1/SIMULATION/TOOLS/random_channel.c
View file @
e8ef1cdb
...
...
@@ -1266,8 +1266,8 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) {
for
(
aarx
=
0
;
aarx
<
desc
->
nb_rx
;
aarx
++
)
{
for
(
aatx
=
0
;
aatx
<
desc
->
nb_tx
;
aatx
++
)
{
anew
[
aarx
+
(
aatx
*
desc
->
nb_rx
)].
x
=
sqrt
(
desc
->
ricean_factor
*
desc
->
amps
[
i
]
/
2
)
*
gaussdouble
(
0
.
0
,
1
.
0
);
anew
[
aarx
+
(
aatx
*
desc
->
nb_rx
)].
y
=
sqrt
(
desc
->
ricean_factor
*
desc
->
amps
[
i
]
/
2
)
*
gaussdouble
(
0
.
0
,
1
.
0
);
anew
[
aarx
+
(
aatx
*
desc
->
nb_rx
)].
x
=
sqrt
(
desc
->
ricean_factor
*
desc
->
amps
[
i
]
/
2
)
*
ziggurat
(
0
.
0
,
1
.
0
);
anew
[
aarx
+
(
aatx
*
desc
->
nb_rx
)].
y
=
sqrt
(
desc
->
ricean_factor
*
desc
->
amps
[
i
]
/
2
)
*
ziggurat
(
0
.
0
,
1
.
0
);
if
((
i
==
0
)
&&
(
desc
->
ricean_factor
!=
1
.
0
))
{
if
(
desc
->
random_aoa
==
1
)
{
...
...
openair1/SIMULATION/TOOLS/rangen_double.c
View file @
e8ef1cdb
...
...
@@ -225,8 +225,6 @@ void table_nor(unsigned long seed)
}
double
ziggurat
(
double
mean
,
double
variance
)
{
//double nor=NOR;
//printf("NOR %e\n",nor);
return
NOR
;
}
/*
...
...
@@ -237,7 +235,7 @@ double ziggurat(double mean, double variance)
/*!\brief Gaussian random number generator based on modified Box-Muller transformation.Returns a double-precision floating-point number. */
//#define random_SSE
#ifdef random_SSE
double
gaussdouble
(
double
mean
,
double
variance
)
//It is necessary to improve the function.
double
gaussdouble
(
double
mean
,
double
variance
)
{
static
int
iset
=
0
;
static
double
gset
;
...
...
targets/SIMU/USER/channel_sim.c
View file @
e8ef1cdb
...
...
@@ -544,14 +544,13 @@ void do_DL_sig_freq(channel_desc_t *eNB2UE[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][
frame_parms
->
ofdm_symbol_size
*
frame_parms
->
symbols_per_tti
,
hold_channel
,
eNB_id
,
UE_id
,
CC_id
,
subframe
&
0x1
);
#endif
stop_meas
(
&
eNB2UE
[
eNB_id
][
UE_id
][
CC_id
]
->
DL_multipath_channel_freq
);
//print_meas (&eNB2UE[eNB_id][UE_id][CC_id]->DL_multipath_channel_freq,"[DL][multipath_channel_freq]", &eNB2UE[eNB_id][UE_id][CC_id]->DL_multipath_channel_freq, &eNB2UE[eNB_id][UE_id][CC_id]->DL_multipath_channel_freq);
/*clock_t stop=clock();
printf("multipath_channel DL 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);*/
/
/
for (int x=0;x<frame_parms->N_RB_DL*12;x++){
//
fprintf(file1,"%d\t%e\t%e\n",x,eNB2UE[eNB_id][UE_id][CC_id]->chF[0][x].x,eNB2UE[eNB_id][UE_id][CC_id]->chF[0][x].y);
//}
/
*
for (int x=0;x<frame_parms->N_RB_DL*12;x++){
fprintf(file1,"%d\t%e\t%e\n",x,eNB2UE[eNB_id][UE_id][CC_id]->chF[0][x].x,eNB2UE[eNB_id][UE_id][CC_id]->chF[0][x].y);
}*/
#ifdef DEBUG_SIM
rx_pwr
=
signal_energy_fp2
(
eNB2UE
[
eNB_id
][
UE_id
][
CC_id
]
->
chF
[
0
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment