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
lizhongxiao
OpenXG-RAN
Commits
40338296
Commit
40338296
authored
May 19, 2018
by
Raymond Knopp
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'l1-sidelink' of
https://gitlab.eurecom.fr/matzakos/LTE-D2D
into l1-sidelink
parents
07349091
e07db38f
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
130 additions
and
92 deletions
+130
-92
openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
+76
-39
openair1/PHY/LTE_TRANSPORT/initial_syncSL.c
openair1/PHY/LTE_TRANSPORT/initial_syncSL.c
+3
-5
openair1/PHY/LTE_TRANSPORT/slsss.c
openair1/PHY/LTE_TRANSPORT/slsss.c
+6
-5
openair1/PHY/TOOLS/cdot_prod.c
openair1/PHY/TOOLS/cdot_prod.c
+15
-22
openair1/PHY/TOOLS/dB_routines.c
openair1/PHY/TOOLS/dB_routines.c
+14
-7
openair1/PHY/TOOLS/defs.h
openair1/PHY/TOOLS/defs.h
+6
-4
openair1/PHY/extern.h
openair1/PHY/extern.h
+5
-5
openair1/PHY/vars.h
openair1/PHY/vars.h
+5
-5
No files found.
openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
View file @
40338296
...
...
@@ -43,8 +43,6 @@
int32_t
*
sync_corr_ue0
=
NULL
;
int32_t
*
sync_corr_ue1
=
NULL
;
int32_t
*
sync_corr_ue2
=
NULL
;
int32_t
sync_tmp
[
2048
*
4
]
__attribute__
((
aligned
(
32
)));
int16_t
syncF_tmp
[
2048
*
2
]
__attribute__
((
aligned
(
32
)));
extern
int16_t
s6n_kHz_7_5
[
1920
];
...
...
@@ -63,6 +61,8 @@ int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *com
{
int
i
,
k
;
int32_t
sync_tmp
[
2048
*
4
]
__attribute__
((
aligned
(
32
)));
int16_t
syncF_tmp
[
2048
*
2
]
__attribute__
((
aligned
(
32
)));
sync_corr_ue0
=
(
int32_t
*
)
malloc16
(
4
*
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME
*
sizeof
(
int32_t
)
*
frame_parms
->
samples_per_tti
);
sync_corr_ue1
=
(
int32_t
*
)
malloc16
(
4
*
LTE_NUMBER_OF_SUBFRAMES_PER_FRAME
*
sizeof
(
int32_t
)
*
frame_parms
->
samples_per_tti
);
...
...
@@ -167,7 +167,7 @@ int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *com
}
else
AssertFatal
(
1
==
0
,
"primary_synch1SL_time_rx not allocated
\n
"
);
memset
((
void
*
)
syncF_tmp
,
0
,
2048
*
sizeof
(
int32_t
));
// generate oversampled sync_time sequences
k
=
frame_parms
->
ofdm_symbol_size
-
36
;
...
...
@@ -217,6 +217,8 @@ int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *com
for
(
i
=
0
;
i
<
frame_parms
->
ofdm_symbol_size
;
i
++
)
((
int32_t
*
)
primary_synch0_time
)[
i
]
=
sync_tmp
[
i
];
memset
((
void
*
)
syncF_tmp
,
0
,
2048
*
sizeof
(
int32_t
));
k
=
frame_parms
->
ofdm_symbol_size
-
36
;
for
(
i
=
0
;
i
<
72
;
i
++
)
{
...
...
@@ -265,6 +267,8 @@ int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *com
for
(
i
=
0
;
i
<
frame_parms
->
ofdm_symbol_size
;
i
++
)
((
int32_t
*
)
primary_synch1_time
)[
i
]
=
sync_tmp
[
i
];
memset
((
void
*
)
syncF_tmp
,
0
,
2048
*
sizeof
(
int32_t
));
k
=
frame_parms
->
ofdm_symbol_size
-
36
;
for
(
i
=
0
;
i
<
72
;
i
++
)
{
...
...
@@ -313,6 +317,8 @@ int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *com
for
(
i
=
0
;
i
<
frame_parms
->
ofdm_symbol_size
;
i
++
)
((
int32_t
*
)
primary_synch2_time
)[
i
]
=
sync_tmp
[
i
];
memset
((
void
*
)
syncF_tmp
,
0
,
2048
*
sizeof
(
int32_t
));
k
=
frame_parms
->
ofdm_symbol_size
-
36
;
for
(
i
=
0
;
i
<
72
;
i
++
)
{
...
...
@@ -325,7 +331,7 @@ int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *com
}
}
u
int16_t
*
kHz7_5ptr
;
int16_t
*
kHz7_5ptr
;
switch
(
frame_parms
->
N_RB_DL
)
{
...
...
@@ -333,21 +339,21 @@ int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *com
idft128
((
int16_t
*
)
syncF_tmp
,
/// complex input
(
int16_t
*
)
sync_tmp
,
/// complex output
1
);
kHz7_5ptr
=
(
frame_parms
->
Ncp
==
0
)
?
(((
uint32_t
*
)
s6n_kHz_7_5
)
+
138
)
:
(((
uint32_t
*
)
s6e_kHz_7_5
)
+
160
)
;
kHz7_5ptr
=
(
frame_parms
->
Ncp
==
0
)
?
&
s6n_kHz_7_5
[
2
*
138
]
:
&
s6e_kHz_7_5
[
2
*
160
]
;
break
;
case
25
:
idft512
((
int16_t
*
)
syncF_tmp
,
/// complex input
(
int16_t
*
)
sync_tmp
,
/// complex output
1
);
kHz7_5ptr
=
(
frame_parms
->
Ncp
==
0
)
?
(((
uint32_t
*
)
s25n_kHz_7_5
)
+
552
)
:
(((
uint32_t
*
)
s25e_kHz_7_5
)
+
640
)
;
kHz7_5ptr
=
(
frame_parms
->
Ncp
==
0
)
?
&
s25n_kHz_7_5
[
2
*
552
]
:
&
s25e_kHz_7_5
[
2
*
640
]
;
break
;
case
50
:
idft1024
((
int16_t
*
)
syncF_tmp
,
/// complex input
(
int16_t
*
)
sync_tmp
,
/// complex output
1
);
kHz7_5ptr
=
(
frame_parms
->
Ncp
==
0
)
?
&
s50n_kHz_7_5
[
2
*
1104
]
:
s50e_kHz_7_5
[
2
*
1280
];
kHz7_5ptr
=
(
frame_parms
->
Ncp
==
0
)
?
&
s50n_kHz_7_5
[
2
*
1104
]
:
&
s50e_kHz_7_5
[
2
*
1280
];
printf
(
"%p
\n
"
,
kHz7_5ptr
);
break
;
...
...
@@ -355,14 +361,14 @@ int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *com
idft1536
((
int16_t
*
)
syncF_tmp
,
/// complex input
(
int16_t
*
)
sync_tmp
,
1
);
/// complex output
kHz7_5ptr
=
(
frame_parms
->
Ncp
==
0
)
?
(((
uint32_t
*
)
s75n_kHz_7_5
)
+
1656
)
:
(((
uint32_t
*
)
s75e_kHz_7_5
)
+
1920
)
;
kHz7_5ptr
=
(
frame_parms
->
Ncp
==
0
)
?
&
s75n_kHz_7_5
[
2
*
1656
]
:
&
s75e_kHz_7_5
[
2
*
1920
]
;
break
;
case
100
:
idft2048
((
int16_t
*
)
syncF_tmp
,
/// complex input
(
int16_t
*
)
sync_tmp
,
/// complex output
1
);
kHz7_5ptr
=
(
frame_parms
->
Ncp
==
0
)
?
(((
uint32_t
*
)
s100n_kHz_7_5
)
+
2208
)
:
(((
uint32_t
*
)
s100e_kHz_7_5
)
+
2560
)
;
kHz7_5ptr
=
(
frame_parms
->
Ncp
==
0
)
?
&
s100n_kHz_7_5
[
2
*
2208
]
:
&
s100e_kHz_7_5
[
2
*
2560
]
;
break
;
default:
...
...
@@ -380,6 +386,7 @@ int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *com
primary_synch0SL_time_rx
[
1
+
(
i
<<
1
)]
=
(
int16_t
)(((
int32_t
)
primary_synch0SL_time
[
imod
<<
1
]
*
kHz7_5ptr
[
1
+
(
i
<<
1
)])
>>
15
)
+
(
int16_t
)(((
int32_t
)
primary_synch0SL_time
[
1
+
(
imod
<<
1
)]
*
kHz7_5ptr
[
i
<<
1
])
>>
15
);
}
memset
((
void
*
)
syncF_tmp
,
0
,
2048
*
sizeof
(
int32_t
));
k
=
frame_parms
->
ofdm_symbol_size
-
36
;
...
...
@@ -425,28 +432,40 @@ int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) // LTE_UE_COMMON *com
break
;
}
for
(
i
=
0
;
i
<
(
frame_parms
->
ofdm_symbol_size
+
frame_parms
->
nb_prefix_samples
);
i
++
)
((
int32_t
*
)
primary_synch1SL_time
)[
i
]
=
sync_tmp
[(
i
+
(
frame_parms
->
ofdm_symbol_size
-
frame_parms
->
nb_prefix_samples
))
%
frame_parms
->
ofdm_symbol_size
];
for
(
i
=
0
;
i
<
(
frame_parms
->
ofdm_symbol_size
+
frame_parms
->
nb_prefix_samples
)
*
2
;
i
++
)
{
imod
=
i
%
(
frame_parms
->
ofdm_symbol_size
+
frame_parms
->
nb_prefix_samples
);
if
(
i
<
(
frame_parms
->
ofdm_symbol_size
+
frame_parms
->
nb_prefix_samples
))
((
int32_t
*
)
primary_synch1SL_time
)[
i
]
=
sync_tmp
[(
i
+
(
frame_parms
->
ofdm_symbol_size
-
frame_parms
->
nb_prefix_samples
))
%
frame_parms
->
ofdm_symbol_size
];
primary_synch1SL_time_rx
[
i
<<
1
]
=
(
int16_t
)(((
int32_t
)
primary_synch1SL_time
[
imod
<<
1
]
*
kHz7_5ptr
[
i
<<
1
])
>>
15
)
-
primary_synch1SL_time_rx
[
i
<<
1
]
=
(
int16_t
)(((
int32_t
)
primary_synch1SL_time
[
imod
<<
1
]
*
kHz7_5ptr
[
i
<<
1
])
>>
15
)
+
(
int16_t
)(((
int32_t
)
primary_synch1SL_time
[
1
+
(
imod
<<
1
)]
*
kHz7_5ptr
[
1
+
(
i
<<
1
)])
>>
15
);
primary_synch1SL_time_rx
[
1
+
(
i
<<
1
)]
=
(
int16_t
)(((
int32_t
)
primary_synch1SL_time
[
imod
<<
1
]
*
kHz7_5ptr
[
1
+
(
i
<<
1
)])
>>
15
)
+
primary_synch1SL_time_rx
[
1
+
(
i
<<
1
)]
=
-
(
int16_t
)(((
int32_t
)
primary_synch1SL_time
[
imod
<<
1
]
*
kHz7_5ptr
[
1
+
(
i
<<
1
)])
>>
15
)
+
(
int16_t
)(((
int32_t
)
primary_synch1SL_time
[
1
+
(
imod
<<
1
)]
*
kHz7_5ptr
[
i
<<
1
])
>>
15
);
/* printf("sync_timeSL1(%d) : (%d,%d) x (%d,%d)' = (%d,%d)\n",
i,
primary_synch1SL_time[imod<<1],
primary_synch1SL_time[1+(imod<<1)],
kHz7_5ptr[i<<1],
kHz7_5ptr[1+(i<<1)],
primary_synch1SL_time_rx[i<<1],
primary_synch1SL_time_rx[1+(i<<1)]);
*/
}
/*
write_output("primary_sync0.m","psync0",primary_synch0_time,frame_parms->ofdm_symbol_size,1,1);
write_output("primary_sync1.m","psync1",primary_synch1_time,frame_parms->ofdm_symbol_size,1,1);
write_output("primary_sync2.m","psync2",primary_synch2_time,frame_parms->ofdm_symbol_size,1,1);
write_output("primary_syncSL0.m","psyncSL0",primary_synch0SL_time,frame_parms->ofdm_symbol_size,1,1);
write_output("primary_sync2.m","psync2",primary_synch2_time,frame_parms->ofdm_symbol_size,1,1);*/
write_output
(
"primary_syncSL0.m"
,
"psyncSL0"
,
primary_synch0SL_time
,
frame_parms
->
ofdm_symbol_size
+
frame_parms
->
nb_prefix_samples
,
1
,
1
);
write_output
(
"primary_syncSL1.m"
,
"psyncSL1"
,
primary_synch1SL_time
,
frame_parms
->
ofdm_symbol_size
+
frame_parms
->
nb_prefix_samples
,
1
,
1
);
write_output("primary_syncSL1.m","psyncSL1",primary_synch1SL_time_rx,2*(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples),1,1);
write_output("primary_syncSL0.m","psyncSL0",primary_synch0SL_time_rx,2*(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples),1,1);
write_output
(
"primary_syncSL1rx.m"
,
"psyncSL1rx"
,
primary_synch1SL_time_rx
,
2
*
(
frame_parms
->
ofdm_symbol_size
+
frame_parms
->
nb_prefix_samples
),
1
,
1
);
write_output
(
"primary_syncSL0rx.m"
,
"psyncSL0rx"
,
primary_synch0SL_time_rx
,
2
*
(
frame_parms
->
ofdm_symbol_size
+
frame_parms
->
nb_prefix_samples
),
1
,
1
);
write_output
(
"kHz75.m"
,
"kHz75"
,
kHz7_5ptr
,
2
*
1096
,
1
,
1
);
*/
return
(
1
);
}
...
...
@@ -509,6 +528,11 @@ static inline int32_t abs32(int32_t x)
return
(((
int32_t
)((
int16_t
*
)
&
x
)[
0
])
*
((
int32_t
)((
int16_t
*
)
&
x
)[
0
])
+
((
int32_t
)((
int16_t
*
)
&
x
)[
1
])
*
((
int32_t
)((
int16_t
*
)
&
x
)[
1
]));
}
static
inline
int64_t
abs64
(
int64_t
x
)
{
return
(((
int64_t
)((
int32_t
*
)
&
x
)[
0
])
*
((
int64_t
)((
int32_t
*
)
&
x
)[
0
])
+
((
int64_t
)((
int32_t
*
)
&
x
)[
1
])
*
((
int64_t
)((
int32_t
*
)
&
x
)[
1
]));
}
#ifdef DEBUG_PHY
int
debug_cnt
=
0
;
#endif
...
...
@@ -680,12 +704,12 @@ int lte_sync_timeSL(PHY_VARS_UE *ue,
(
void
*
)
&
ue
->
common_vars
.
rxdata_syncSL
[
ar
][
0
],
frame_parms
->
ofdm_symbol_size
);
int
32
_t
tmp0
,
tmp1
;
int
32
_t
magtmp0
,
magtmp1
,
maxlev0
=
0
,
maxlev1
=
0
;
int
64
_t
tmp0
,
tmp1
;
int
64
_t
magtmp0
,
magtmp1
,
maxlev0
=
0
,
maxlev1
=
0
;
int
maxpos0
=
0
,
maxpos1
=
0
;
int64_t
avg0
=
0
,
avg1
=
0
;
int
32
_t
result
;
int32_t
**
rxdata
=
ue
->
common_vars
.
rxdata_syncSL
;
///rx data in time domain
int
64
_t
result
;
int32_t
**
rxdata
=
(
int32_t
**
)
ue
->
common_vars
.
rxdata_syncSL
;
///rx data in time domain
RU_t
ru_tmp
;
int16_t
**
rxdata_7_5kHz
=
ue
->
sl_rxdata_7_5kHz
;
...
...
@@ -697,39 +721,51 @@ int lte_sync_timeSL(PHY_VARS_UE *ue,
ru_tmp
.
common
.
rxdata_7_5kHz
=
(
int32_t
**
)
rxdata_7_5kHz
;
ru_tmp
.
nb_rx
=
frame_parms
->
nb_antennas_rx
;
for
(
int
n
=
0
;
n
<
length
;
n
+=
4
)
{
int
maxval
=
0
;
for
(
int
i
=
0
;
i
<
2
*
(
frame_parms
->
ofdm_symbol_size
+
frame_parms
->
nb_prefix_samples
);
i
++
)
{
maxval
=
max
(
maxval
,
primary_synch0SL_time_rx
[
i
]);
maxval
=
max
(
maxval
,
-
primary_synch0SL_time_rx
[
i
]);
maxval
=
max
(
maxval
,
primary_synch1SL_time_rx
[
i
]);
maxval
=
max
(
maxval
,
-
primary_synch1SL_time_rx
[
i
]);
}
int
shift
=
log2_approx
(
maxval
);
//*(frame_parms->ofdm_symbol_size+frame_parms->nb_prefix_samples)*2);
printf
(
"Synchtime SL : shifting by %d bits
\n
"
,
shift
);
for
(
int
n
=
0
;
n
<
length
;
n
+=
4
)
{
tmp0
=
0
;
tmp1
=
0
;
int32_t
tmp0_re
=
((
int32_t
*
)
&
tmp0
)[
0
],
tmp0_im
=
((
int32_t
*
)
&
tmp0
)[
1
];
int32_t
tmp1_re
=
((
int32_t
*
)
&
tmp1
)[
0
],
tmp1_im
=
((
int32_t
*
)
&
tmp1
)[
1
];
//calculate dot product of primary_synch0_time and rxdata[ar][n] (ar=0..nb_ant_rx) and store the sum in temp[n];
for
(
int
ar
=
0
;
ar
<
frame_parms
->
nb_antennas_rx
;
ar
++
)
{
result
=
dot_product
(
(
int16_t
*
)
primary_synch0SL_time_rx
,
result
=
dot_product
(
primary_synch0SL_time_rx
,
(
int16_t
*
)
&
(
rxdata
[
ar
][
n
]),
(
frame_parms
->
ofdm_symbol_size
+
frame_parms
->
nb_prefix_samples
)
*
2
,
11
);
shift
);
((
int16_t
*
)
&
tmp0
)[
0
]
+=
((
int16
_t
*
)
&
result
)[
0
];
((
int16_t
*
)
&
tmp0
)[
1
]
+=
((
int16
_t
*
)
&
result
)[
1
];
tmp0_re
+=
((
int32
_t
*
)
&
result
)[
0
];
tmp0_im
+=
((
int32
_t
*
)
&
result
)[
1
];
result
=
dot_product
(
(
int16_t
*
)
primary_synch1SL_time_rx
,
result
=
dot_product
(
primary_synch1SL_time_rx
,
(
int16_t
*
)
&
(
rxdata
[
ar
][
n
]),
(
frame_parms
->
ofdm_symbol_size
+
frame_parms
->
nb_prefix_samples
)
*
2
,
11
);
shift
);
((
int16_t
*
)
&
tmp1
)[
0
]
+=
((
int16
_t
*
)
&
result
)[
0
];
((
int16_t
*
)
&
tmp1
)[
1
]
+=
((
int16
_t
*
)
&
result
)[
1
];
tmp1_re
+=
((
int32
_t
*
)
&
result
)[
0
];
tmp1_im
+=
((
int32
_t
*
)
&
result
)[
1
];
}
// tmpi holds <synchi,rx0>+<synci,rx1>+...+<synchi,rx_{nbrx-1}>
magtmp0
=
abs32
(
tmp0
)
;
magtmp1
=
abs32
(
tmp1
)
;
magtmp0
=
(
int64_t
)
tmp0_re
*
tmp0_re
+
(
int64_t
)
tmp0_im
*
tmp0_im
;
magtmp1
=
(
int64_t
)
tmp1_re
*
tmp1_re
+
(
int64_t
)
tmp1_im
*
tmp1_im
;
//printf("0: n %d (%d,%d) => %lld\n",n,tmp0_re,tmp0_im,magtmp0);
//printf("1: n %d (%d,%d) => %lld\n",n,tmp1_re,tmp1_im,magtmp1);
// this does max |tmpi(n)|^2 + |tmpi(n-L)|^2 and argmax |tmpi(n)|^2 + |tmpi(n-L)|^2
if
(
magtmp0
>
maxlev0
)
{
maxlev0
=
magtmp0
;
maxpos0
=
n
;
}
...
...
@@ -737,8 +773,8 @@ int lte_sync_timeSL(PHY_VARS_UE *ue,
avg0
+=
magtmp0
;
avg1
+=
magtmp1
;
if
(
n
<
4
*
FRAME_LENGTH_COMPLEX_SAMPLES
)
{
sync_corr_ue1
[
n
]
=
magtmp1
;
sync_corr_ue0
[
n
]
=
magtmp0
;
sync_corr_ue1
[
n
]
=
(
int32_t
)(
magtmp1
>>
31
)
;
sync_corr_ue0
[
n
]
=
(
int32_t
)(
magtmp0
>>
31
)
;
}
}
avg0
/=
(
length
/
4
);
...
...
@@ -746,7 +782,8 @@ int lte_sync_timeSL(PHY_VARS_UE *ue,
// PSS in symbol 1
int
pssoffset
=
frame_parms
->
ofdm_symbol_size
+
frame_parms
->
nb_prefix_samples0
;
printf
(
"maxpos1 = %d, pssoffset = %d
\n
"
,
maxpos1
,
pssoffset
);
printf
(
"maxpos = (%d,%d), pssoffset = %d, maxlev= (%lld,%lld) avglev (%lld,%lld)
\n
"
,
maxpos0
,
maxpos1
,
pssoffset
,
(
long
long
int
)
maxlev0
,(
long
long
int
)
maxlev1
,(
long
long
int
)
avg0
,(
long
long
int
)
avg1
);
if
(
maxlev0
>
maxlev1
)
{
if
((
int64_t
)
maxlev0
>
(
5
*
avg0
))
{
*
lev
=
maxlev0
;
*
ind
=
0
;
*
avg
=
avg0
;
return
((
length
+
maxpos0
-
pssoffset
)
%
length
);};
...
...
openair1/PHY/LTE_TRANSPORT/initial_syncSL.c
View file @
40338296
...
...
@@ -50,8 +50,8 @@ int initial_syncSL(PHY_VARS_UE *ue) {
&
index
,
&
psslevel
,
&
avglevel
);
printf
(
"index %d, psslevel %
lld dB avglevel %ll
d dB => %d sample offset
\n
"
,
index
,
dB_fixed
(
psslevel
),
dB_fixed
(
avglevel
),
ue
->
rx_offsetSL
);
printf
(
"index %d, psslevel %
d dB avglevel %
d dB => %d sample offset
\n
"
,
index
,
dB_fixed
64
((
uint64_t
)
psslevel
),
dB_fixed64
((
uint64_t
)
avglevel
),
ue
->
rx_offsetSL
);
if
(
ue
->
rx_offsetSL
>=
0
)
{
int32_t
sss_metric
;
int32_t
phase_max
;
...
...
@@ -60,13 +60,11 @@ int initial_syncSL(PHY_VARS_UE *ue) {
if
(
rx_psbch
(
ue
)
==
-
1
)
{
ue
->
slbch_errors
++
;
/*
write_output
(
"rxsig0.m"
,
"rxs0"
,
&
ue
->
common_vars
.
rxdata_syncSL
[
0
][
0
],
40
*
ue
->
frame_parms
.
samples_per_tti
,
1
,
1
);
write_output
(
"corr0.m"
,
"rxsync0"
,
sync_corr_ue0
,
40
*
ue
->
frame_parms
.
samples_per_tti
,
1
,
2
);
write_output
(
"corr1.m"
,
"rxsync1"
,
sync_corr_ue1
,
40
*
ue
->
frame_parms
.
samples_per_tti
,
1
,
2
);
exit
(
-
1
);
*/
return
(
-
1
);
}
else
{
...
...
openair1/PHY/LTE_TRANSPORT/slsss.c
View file @
40338296
...
...
@@ -359,10 +359,10 @@ int rx_slsss(PHY_VARS_UE *ue,int32_t *tot_metric,uint8_t *phase_max,int Nid2)
0
);
// write_output("rxdataF0.m","rxF0",&rxdataF[0][0],2*14*ue->frame_parms.ofdm_symbol_size,1,1);
/*
write_output("pss0_ext.m","pss0ext",pss0_ext,72,1,1);
write_output
(
"pss0_ext.m"
,
"pss0ext"
,
pss0_ext
,
72
,
1
,
1
);
write_output
(
"sss0_ext.m"
,
"sss0ext"
,
sss0_ext
,
72
,
1
,
1
);
write_output
(
"pss1_ext.m"
,
"pss1ext"
,
pss1_ext
,
72
,
1
,
1
);
write_output("sss1_ext.m","sss1ext",sss1_ext,72,1,1);
*/
write_output
(
"sss1_ext.m"
,
"sss1ext"
,
sss1_ext
,
72
,
1
,
1
);
...
...
@@ -400,9 +400,10 @@ int rx_slsss(PHY_VARS_UE *ue,int32_t *tot_metric,uint8_t *phase_max,int Nid2)
sss0_comp16
[
i
]
=
(
int16_t
)(
sss0comp
[
i
]
>>
shift
);
sss1_comp16
[
i
]
=
(
int16_t
)(
sss1comp
[
i
]
>>
shift
);
}
/*write_output("sss0_comp0.m","sss0comp0",sss0_comp16,72,1,1);
write_output("sss1_comp0.m","sss1comp0",sss1_comp16,72,1,1);*/
// exit(-1);
/*
write_output("sss0_comp0.m","sss0comp0",sss0_comp16,72,1,1);
write_output("sss1_comp0.m","sss1comp0",sss1_comp16,72,1,1);
exit(-1); */
// now do the SSS detection based on the precomputed sequences in PHY/LTE_TRANSPORT/sss.h
*
tot_metric
=
-
99999999
;
...
...
openair1/PHY/TOOLS/cdot_prod.c
View file @
40338296
...
...
@@ -21,7 +21,7 @@
#include "defs.h"
#include "PHY/sse_intrin.h"
#include <stdio.h>
// returns the complex dot product of x and y
#ifdef MAIN
...
...
@@ -30,7 +30,7 @@ void print_shorts(char *s,__m128i *x);
void
print_bytes
(
char
*
s
,
__m128i
*
x
);
#endif
int
32
_t
dot_product
(
int16_t
*
x
,
int
64
_t
dot_product
(
int16_t
*
x
,
int16_t
*
y
,
uint32_t
N
,
//must be a multiple of 8
uint8_t
output_shift
)
...
...
@@ -40,7 +40,6 @@ int32_t dot_product(int16_t *x,
#if defined(__x86_64__) || defined(__i386__)
__m128i
*
x128
,
*
y128
,
mmtmp1
,
mmtmp2
,
mmtmp3
,
mmcumul
,
mmcumul_re
,
mmcumul_im
;
__m64
mmtmp7
;
__m128i
minus_i
=
_mm_set_epi16
(
-
1
,
1
,
-
1
,
1
,
-
1
,
1
,
-
1
,
1
);
int32_t
result
;
...
...
@@ -52,37 +51,37 @@ int32_t dot_product(int16_t *x,
for
(
n
=
0
;
n
<
(
N
>>
2
);
n
++
)
{
//
printf("n=%d, x128=%p, y128=%p\n",n,x128,y128);
//
printf("n=%d, x128=%p, y128=%p\n",n,x128,y128);
// print_shorts("x",&x128[0]);
// print_shorts("y",&y128[0]);
// this computes Re(z) = Re(x)*Re(y) + Im(x)*Im(y)
mmtmp1
=
_mm_madd_epi16
(
x128
[
0
],
y128
[
0
]);
// print_ints("re
",&mmtmp1);
// print_ints("retmp
",&mmtmp1);
// mmtmp1 contains real part of 4 consecutive outputs (32-bit)
// shift and accumulate results
mmtmp1
=
_mm_srai_epi32
(
mmtmp1
,
output_shift
);
mmcumul_re
=
_mm_add_epi32
(
mmcumul_re
,
mmtmp1
);
//
print_ints("re",&mmcumul_re);
//
print_ints("re",&mmcumul_re);
// this computes Im(z) = Re(x)*Im(y) - Re(y)*Im(x)
mmtmp2
=
_mm_shufflelo_epi16
(
y128
[
0
],
_MM_SHUFFLE
(
2
,
3
,
0
,
1
));
//
print_shorts("y",&mmtmp2);
//
print_shorts("y",&mmtmp2);
mmtmp2
=
_mm_shufflehi_epi16
(
mmtmp2
,
_MM_SHUFFLE
(
2
,
3
,
0
,
1
));
//
print_shorts("y",&mmtmp2);
//
print_shorts("y",&mmtmp2);
mmtmp2
=
_mm_sign_epi16
(
mmtmp2
,
minus_i
);
// print_shorts("y",&mmtmp2);
mmtmp3
=
_mm_madd_epi16
(
x128
[
0
],
mmtmp2
);
// print_ints("im
",&mmtmp3);
//print_ints("imtmp
",&mmtmp3);
// mmtmp3 contains imag part of 4 consecutive outputs (32-bit)
// shift and accumulate results
mmtmp3
=
_mm_srai_epi32
(
mmtmp3
,
output_shift
);
mmcumul_im
=
_mm_add_epi32
(
mmcumul_im
,
mmtmp3
);
//
print_ints("im",&mmcumul_im);
//
print_ints("im",&mmcumul_im);
x128
++
;
y128
++
;
...
...
@@ -90,24 +89,18 @@ int32_t dot_product(int16_t *x,
// this gives Re Re Im Im
mmcumul
=
_mm_hadd_epi32
(
mmcumul_re
,
mmcumul_im
);
//
print_ints("cumul1",&mmcumul);
//
print_ints("cumul1",&mmcumul);
// this gives Re Im Re Im
mmcumul
=
_mm_hadd_epi32
(
mmcumul
,
mmcumul
);
//
print_ints("cumul2",&mmcumul);
//
print_ints("cumul2",&mmcumul);
//mmcumul = _mm_srai_epi32(mmcumul,output_shift);
// extract the lower half
mmtmp7
=
_mm_movepi64_pi64
(
mmcumul
);
// print_ints("mmtmp7",&mmtmp7);
// pack the result
mmtmp7
=
_mm_packs_pi32
(
mmtmp7
,
mmtmp7
);
// print_shorts("mmtmp7",&mmtmp7);
// convert back to integer
result
=
_mm_cvtsi64_si32
(
mmtmp7
);
result
=
_mm_extract_epi64
(
mmcumul
,
0
);
//printf("result: (%d,%d)\n",((int32_t*)&result)[0],((int32_t*)&result)[1]);
_mm_empty
();
_m_empty
();
...
...
openair1/PHY/TOOLS/dB_routines.c
View file @
40338296
...
...
@@ -23,7 +23,7 @@
// Approximate 10*log10(x) in fixed point : x = 0...(2^32)-1
int8_t
dB_table
[
256
]
=
{
u
int8_t
dB_table
[
256
]
=
{
0
,
3
,
5
,
...
...
@@ -282,7 +282,7 @@ int8_t dB_table[256] = {
24
};
int16_t
dB_table_times10
[
256
]
=
{
u
int16_t
dB_table_times10
[
256
]
=
{
0
,
30
,
47
,
...
...
@@ -571,9 +571,9 @@ int8_t dB_fixed(int x) {
}
*/
int16_t
dB_fixed_times10
(
uint32_t
x
)
u
int16_t
dB_fixed_times10
(
uint32_t
x
)
{
int16
_t
dB_power
=
0
;
uint8
_t
dB_power
=
0
;
if
(
x
==
0
)
{
...
...
@@ -597,10 +597,17 @@ int16_t dB_fixed_times10(uint32_t x)
return
dB_power
;
}
int8_t
dB_fixed
(
uint32
_t
x
)
uint8_t
dB_fixed64
(
uint64
_t
x
)
{
int8_t
dB_power
=
0
;
if
(
x
<
(((
uint64_t
)
1
)
<<
32
))
return
(
dB_fixed
((
uint32_t
)
x
));
else
return
(
4
*
dB_table
[
255
]
+
dB_fixed
(
x
>>
32
));
}
uint8_t
dB_fixed
(
uint32_t
x
)
{
uint8_t
dB_power
=
0
;
if
(
x
==
0
)
{
...
...
@@ -624,7 +631,7 @@ int8_t dB_fixed(uint32_t x)
return
dB_power
;
}
int8_t
dB_fixed2
(
uint32_t
x
,
uint32_t
y
)
u
int8_t
dB_fixed2
(
uint32_t
x
,
uint32_t
y
)
{
if
((
x
>
0
)
&&
(
y
>
0
)
)
...
...
openair1/PHY/TOOLS/defs.h
View file @
40338296
...
...
@@ -347,16 +347,18 @@ Compensate the phase rotation of the RF. WARNING: This function is currently unu
*/
int8_t
dB_fixed
(
uint32_t
x
);
u
int8_t
dB_fixed
(
uint32_t
x
);
int8_t
dB_fixed2
(
uint32_t
x
,
uint32_t
y
);
u
int8_t
dB_fixed2
(
uint32_t
x
,
uint32_t
y
);
int16_t
dB_fixed_times10
(
uint32_t
x
);
uint8_t
dB_fixed64
(
uint64_t
x
);
uint16_t
dB_fixed_times10
(
uint32_t
x
);
int32_t
phy_phase_compensation_top
(
uint32_t
pilot_type
,
uint32_t
initial_pilot
,
uint32_t
last_pilot
,
int32_t
ignore_prefix
);
int
32
_t
dot_product
(
int16_t
*
x
,
int
64
_t
dot_product
(
int16_t
*
x
,
int16_t
*
y
,
uint32_t
N
,
//must be a multiple of 8
uint8_t
output_shift
);
...
...
openair1/PHY/extern.h
View file @
40338296
...
...
@@ -60,11 +60,11 @@ extern short primary_synch1SL[144];
extern
unsigned
char
primary_synch0_tab
[
72
];
extern
unsigned
char
primary_synch1_tab
[
72
];
extern
unsigned
char
primary_synch2_tab
[
72
];
extern
const
int16_t
*
primary_synch0_time
;
//!< index: [0..ofdm_symbol_size*2[
extern
const
int16_t
*
primary_synch1_time
;
//!< index: [0..ofdm_symbol_size*2[
extern
const
int16_t
*
primary_synch2_time
;
//!< index: [0..ofdm_symbol_size*2[
extern
const
int16_t
*
primary_synch0SL_time
;
extern
const
int16_t
*
primary_synch1SL_time
;
extern
int16_t
*
primary_synch0_time
;
//!< index: [0..ofdm_symbol_size*2[
extern
int16_t
*
primary_synch1_time
;
//!< index: [0..ofdm_symbol_size*2[
extern
int16_t
*
primary_synch2_time
;
//!< index: [0..ofdm_symbol_size*2[
extern
int16_t
*
primary_synch0SL_time
;
extern
int16_t
*
primary_synch1SL_time
;
extern
int16_t
*
primary_synch0SL_time_rx
;
extern
int16_t
*
primary_synch1SL_time_rx
;
...
...
openair1/PHY/vars.h
View file @
40338296
...
...
@@ -33,13 +33,13 @@ char* namepointer_log2;
#include "PHY/LTE_REFSIG/primary_synch.h"
#include "PHY/LTE_REFSIG/primary_synch_SL.h"
const
int16_t
*
primary_synch0_time
;
const
int16_t
*
primary_synch1_time
;
const
int16_t
*
primary_synch2_time
;
int16_t
*
primary_synch0_time
;
int16_t
*
primary_synch1_time
;
int16_t
*
primary_synch2_time
;
const
int16_t
*
primary_synch0SL_time
;
const
int16_t
*
primary_synch1SL_time
;
int16_t
*
primary_synch0SL_time
;
int16_t
*
primary_synch1SL_time
;
int16_t
*
primary_synch0SL_time_rx
;
int16_t
*
primary_synch1SL_time_rx
;
...
...
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