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
99463054
Commit
99463054
authored
Jan 31, 2023
by
Marwan Hammouda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[develop] Added: LUT for sin/cos and function nr_apply_Doppler()
parent
a903ec64
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
1 deletion
+62
-1
common/utils/nr/nr_common.c
common/utils/nr/nr_common.c
+7
-0
common/utils/nr/nr_common.h
common/utils/nr/nr_common.h
+6
-0
executables/nr-ru.c
executables/nr-ru.c
+1
-1
openair1/PHY/MODULATION/nr_modulation.h
openair1/PHY/MODULATION/nr_modulation.h
+5
-0
openair1/PHY/MODULATION/slot_fep_nr.c
openair1/PHY/MODULATION/slot_fep_nr.c
+43
-0
No files found.
common/utils/nr/nr_common.c
View file @
99463054
...
...
@@ -738,3 +738,10 @@ uint32_t get_ssb_offset_to_pointA(uint32_t absoluteFrequencySSB,
AssertFatal
(
sco
%
scs_scaling
==
0
,
"ssb offset %d can create frequency offset
\n
"
,
sco
);
return
ssb_offset_point_a
;
}
uint16_t
LUTSin
[
ResolSinCos
+
1
];
void
InitSinLUT
(
void
)
{
for
(
int
i
=
0
;
i
<
(
ResolSinCos
+
1
);
i
++
)
{
LUTSin
[
i
]
=
sin
((
double
)
M_PI
/
2
/
ResolSinCos
*
i
)
*
(
1
<<
14
);
//Format: Q14
}
}
common/utils/nr/nr_common.h
View file @
99463054
...
...
@@ -131,4 +131,10 @@ int get_ssb_subcarrier_offset(uint32_t absoluteFrequencySSB, uint32_t absoluteFr
#define min(a,b) cmin(a,b)
#endif
//look-up table for the sine (cosine) function
#define ResolSinCos 100
extern
uint16_t
LUTSin
[
ResolSinCos
+
1
];
void
InitSinLUT
(
void
);
#endif
executables/nr-ru.c
View file @
99463054
...
...
@@ -1224,7 +1224,7 @@ void *ru_thread( void *param ) {
//slot_duration.tv_nsec = 0.5e6;
slot_duration
.
tv_nsec
=
0.5e6
;
InitSinLUT
();
while
(
!
oai_exit
)
{
...
...
openair1/PHY/MODULATION/nr_modulation.h
View file @
99463054
...
...
@@ -140,4 +140,9 @@ int nr_layer_precoder_cm(int16_t **datatx_F_precoding,
int
*
prec_matrix
,
uint8_t
n_layers
,
int32_t
re_offset
);
// apply frequency offset compensation
void
nr_apply_Doppler
(
void
*
in
,
uint32_t
len
,
int32_t
fDoppler
,
uint32_t
*
SampIdxDoppler
,
NR_DL_FRAME_PARMS
*
fp
);
#endif
openair1/PHY/MODULATION/slot_fep_nr.c
View file @
99463054
...
...
@@ -26,6 +26,7 @@
#include "PHY/LTE_ESTIMATION/lte_estimation.h"
#include "PHY/NR_UE_ESTIMATION/nr_estimation.h"
#include <common/utils/LOG/log.h>
#include "nr/nr_common.h"
//#define DEBUG_FEP
...
...
@@ -330,3 +331,45 @@ void apply_nr_rotation_RX(NR_DL_FRAME_PARMS *frame_parms,
}
}
}
typedef
struct
complex16
sample_t
;
// 2*16 bits complex number
//Apply the givin Doppler shift to the input signal with a fixed number of samples
void
nr_apply_Doppler
(
void
*
in
,
uint32_t
len
,
int32_t
fDoppler
,
uint32_t
*
SampIdxDoppler
,
NR_DL_FRAME_PARMS
*
fp
)
{
int16_t
SinDopper
,
CosDopper
;
// sine/cosine value from the LUT
sample_t
*
sigComp
=
(
sample_t
*
)
in
;
for
(
int
k
=
0
;
k
<
len
;
k
++
)
{
int64_t
IdxInt
=
(
int64_t
)
*
SampIdxDoppler
*
fDoppler
*
ResolSinCos
*
4
;
IdxInt
=
IdxInt
>
0
?
IdxInt
+
fp
->
samples_per_frame
*
100
/
2
:
IdxInt
-
fp
->
samples_per_frame
*
100
/
2
;
//rounding
IdxInt
=
IdxInt
/
(
fp
->
samples_per_frame
*
100
);
int16_t
IdxModulo
=
IdxInt
%
(
ResolSinCos
*
4
);
IdxModulo
=
IdxModulo
<
0
?
IdxModulo
+
ResolSinCos
*
4
:
IdxModulo
;
if
(
IdxModulo
<
2
*
ResolSinCos
)
{
if
(
IdxModulo
<
ResolSinCos
)
{
SinDopper
=
LUTSin
[
IdxModulo
];
CosDopper
=
LUTSin
[
ResolSinCos
-
IdxModulo
];
}
else
{
SinDopper
=
LUTSin
[
2
*
ResolSinCos
-
IdxModulo
];
CosDopper
=
-
LUTSin
[
IdxModulo
-
ResolSinCos
];
}
}
else
{
if
(
IdxModulo
<
3
*
ResolSinCos
)
{
SinDopper
=
-
LUTSin
[
IdxModulo
-
2
*
ResolSinCos
];
CosDopper
=
-
LUTSin
[
3
*
ResolSinCos
-
IdxModulo
];
}
else
{
SinDopper
=
-
LUTSin
[
4
*
ResolSinCos
-
IdxModulo
];
CosDopper
=
LUTSin
[
IdxModulo
-
3
*
ResolSinCos
];
}
}
sample_t
sigTmp
=
sigComp
[
k
];
sigComp
[
k
].
r
=
(
(
int32_t
)
sigTmp
.
r
*
CosDopper
-
(
int32_t
)
sigTmp
.
i
*
SinDopper
)
>>
14
;
sigComp
[
k
].
i
=
(
(
int32_t
)
sigTmp
.
i
*
CosDopper
+
(
int32_t
)
sigTmp
.
r
*
SinDopper
)
>>
14
;
(
*
SampIdxDoppler
)
++
;
}
}
\ No newline at end of file
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