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
spbro
OpenXG-RAN
Commits
b2ae5502
Commit
b2ae5502
authored
Aug 29, 2022
by
Sagar Parsawar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Harmonizing abs32, abs64, absF, angle64 functions across LTE/NR
parent
502b4d59
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
56 deletions
+41
-56
openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
+0
-14
openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
+19
-24
openair1/PHY/NR_UE_TRANSPORT/pss_nr.c
openair1/PHY/NR_UE_TRANSPORT/pss_nr.c
+0
-18
openair1/PHY/defs_common.h
openair1/PHY/defs_common.h
+22
-0
No files found.
openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
View file @
b2ae5502
...
...
@@ -131,14 +131,6 @@ void lte_sync_time_free(void) {
}
static
inline
int
abs32
(
int
x
)
{
return
(((
int
)((
short
*
)
&
x
)[
0
])
*
((
int
)((
short
*
)
&
x
)[
0
])
+
((
int
)((
short
*
)
&
x
)[
1
])
*
((
int
)((
short
*
)
&
x
)[
1
]));
}
static
inline
double
absF
(
struct
complexd
x
)
{
return
x
.
r
*
x
.
r
+
x
.
i
*
x
.
i
;
}
#define complexNull(c) bzero((void*) &(c), sizeof(c))
#define SHIFT 17
...
...
@@ -368,12 +360,6 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain
}
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
]));
}
int
ru_sync_time
(
RU_t
*
ru
,
int64_t
*
lev
,
int64_t
*
avg
)
{
...
...
openair1/PHY/NR_UE_ESTIMATION/nr_dl_channel_estimation.c
View file @
b2ae5502
...
...
@@ -35,16 +35,11 @@
//#define DEBUG_PDSCH
//#define DEBUG_PDCCH
//#define DEBUG_CH
//#define DEBUG_PRS_CHEST
//#define DEBUG_PRS_PRINTS
//#define DEBUG_
PB
CH
//#define DEBUG_PRS_CHEST
// To enable PRS Matlab dumps
//#define DEBUG_PRS_PRINTS
// To enable PRS channel estimation debug logs
extern
short
nr_qpsk_mod_table
[
8
];
static
inline
int
abs32
(
int
x
)
{
return
(((
int
)((
short
*
)
&
x
)[
0
])
*
((
int
)((
short
*
)
&
x
)[
0
])
+
((
int
)((
short
*
)
&
x
)[
1
])
*
((
int
)((
short
*
)
&
x
)[
1
]));
}
int
nr_prs_channel_estimation
(
uint8_t
gNB_id
,
uint8_t
rsc_id
,
uint8_t
rep_num
,
...
...
@@ -613,7 +608,7 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
k
=
nushift
;
#ifdef DEBUG_CH
#ifdef DEBUG_
PB
CH
printf
(
"PBCH DMRS Correlation : ThreadId %d, gNB_id %d , OFDM size %d, Ncp=%d, Ns=%d, k=%d symbol %d
\n
"
,
proc
->
thread_id
,
gNB_id
,
ue
->
frame_parms
.
ofdm_symbol_size
,
ue
->
frame_parms
.
Ncp
,
Ns
,
k
,
symbol
);
#endif
...
...
@@ -627,7 +622,7 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
pil
=
(
int16_t
*
)
&
pilot
[
0
];
rxF
=
(
int16_t
*
)
&
rxdataF
[
aarx
][(
symbol_offset
+
k
+
re_offset
)];
#ifdef DEBUG_CH
#ifdef DEBUG_
PB
CH
printf
(
"pbch ch est pilot addr %p RB_DL %d
\n
"
,
&
pilot
[
0
],
ue
->
frame_parms
.
N_RB_DL
);
printf
(
"k %d, first_carrier %d
\n
"
,
k
,
ue
->
frame_parms
.
first_carrier_offset
);
printf
(
"rxF addr %p
\n
"
,
rxF
);
...
...
@@ -641,7 +636,7 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
current_ssb
->
c_re
+=
ch
[
0
];
current_ssb
->
c_im
+=
ch
[
1
];
#ifdef DEBUG_CH
#ifdef DEBUG_
PB
CH
printf
(
"ch 0 %d
\n
"
,((
int32_t
)
pil
[
0
]
*
rxF
[
0
]
-
(
int32_t
)
pil
[
1
]
*
rxF
[
1
]));
printf
(
"pilot 0 : rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d)
\n
"
,
rxF
[
0
],
rxF
[
1
],
&
rxF
[
0
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
#endif
...
...
@@ -657,7 +652,7 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
current_ssb
->
c_re
+=
ch
[
0
];
current_ssb
->
c_im
+=
ch
[
1
];
#ifdef DEBUG_CH
#ifdef DEBUG_
PB
CH
printf
(
"pilot 1 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d)
\n
"
,
rxF
[
0
],
rxF
[
1
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
#endif
...
...
@@ -668,7 +663,7 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
current_ssb
->
c_re
+=
ch
[
0
];
current_ssb
->
c_im
+=
ch
[
1
];
#ifdef DEBUG_CH
#ifdef DEBUG_
PB
CH
printf
(
"pilot 2 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d)
\n
"
,
rxF
[
0
],
rxF
[
1
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
#endif
...
...
@@ -693,7 +688,7 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
current_ssb
->
c_re
+=
ch
[
0
];
current_ssb
->
c_im
+=
ch
[
1
];
#ifdef DEBUG_CH
#ifdef DEBUG_
PB
CH
printf
(
"pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d)
\n
"
,
pilot_cnt
,
rxF
[
0
],
rxF
[
1
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
#endif
...
...
@@ -708,7 +703,7 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
current_ssb
->
c_re
+=
ch
[
0
];
current_ssb
->
c_im
+=
ch
[
1
];
#ifdef DEBUG_CH
#ifdef DEBUG_
PB
CH
printf
(
"pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d)
\n
"
,
pilot_cnt
+
1
,
rxF
[
0
],
rxF
[
1
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
#endif
pil
+=
2
;
...
...
@@ -722,7 +717,7 @@ int nr_pbch_dmrs_correlation(PHY_VARS_NR_UE *ue,
current_ssb
->
c_re
+=
ch
[
0
];
current_ssb
->
c_im
+=
ch
[
1
];
#ifdef DEBUG_CH
#ifdef DEBUG_
PB
CH
printf
(
"pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d)
\n
"
,
pilot_cnt
+
2
,
rxF
[
0
],
rxF
[
1
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
#endif
...
...
@@ -778,7 +773,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
k
=
nushift
;
#ifdef DEBUG_CH
#ifdef DEBUG_
PB
CH
printf
(
"PBCH Channel Estimation : ThreadId %d, gNB_id %d ch_offset %d, OFDM size %d, Ncp=%d, Ns=%d, k=%d symbol %d
\n
"
,
proc
->
thread_id
,
gNB_id
,
ch_offset
,
ue
->
frame_parms
.
ofdm_symbol_size
,
ue
->
frame_parms
.
Ncp
,
Ns
,
k
,
symbol
);
#endif
...
...
@@ -870,7 +865,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
memset
(
dl_ch
,
0
,
sizeof
(
struct
complex16
)
*
(
ue
->
frame_parms
.
ofdm_symbol_size
));
#ifdef DEBUG_CH
#ifdef DEBUG_
PB
CH
printf
(
"pbch ch est pilot addr %p RB_DL %d
\n
"
,
&
pilot
[
0
],
ue
->
frame_parms
.
N_RB_DL
);
printf
(
"k %d, first_carrier %d
\n
"
,
k
,
ue
->
frame_parms
.
first_carrier_offset
);
printf
(
"rxF addr %p
\n
"
,
rxF
);
...
...
@@ -882,7 +877,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
ch
[
0
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
0
]
-
(
int32_t
)
pil
[
1
]
*
rxF
[
1
])
>>
15
);
ch
[
1
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
1
]
+
(
int32_t
)
pil
[
1
]
*
rxF
[
0
])
>>
15
);
#ifdef DEBUG_CH
#ifdef DEBUG_
PB
CH
printf
(
"ch 0 %d
\n
"
,((
int32_t
)
pil
[
0
]
*
rxF
[
0
]
-
(
int32_t
)
pil
[
1
]
*
rxF
[
1
]));
printf
(
"pilot 0 : rxF - > (%d,%d) addr %p ch -> (%d,%d), pil -> (%d,%d)
\n
"
,
rxF
[
0
],
rxF
[
1
],
&
rxF
[
0
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
#endif
...
...
@@ -901,7 +896,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
ch
[
1
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
1
]
+
(
int32_t
)
pil
[
1
]
*
rxF
[
0
])
>>
15
);
#ifdef DEBUG_CH
#ifdef DEBUG_
PB
CH
printf
(
"pilot 1 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d)
\n
"
,
rxF
[
0
],
rxF
[
1
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
#endif
multadd_real_vector_complex_scalar
(
fm
,
...
...
@@ -915,7 +910,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
ch
[
0
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
0
]
-
(
int32_t
)
pil
[
1
]
*
rxF
[
1
])
>>
15
);
ch
[
1
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
1
]
+
(
int32_t
)
pil
[
1
]
*
rxF
[
0
])
>>
15
);
#ifdef DEBUG_CH
#ifdef DEBUG_
PB
CH
printf
(
"pilot 2 : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d)
\n
"
,
rxF
[
0
],
rxF
[
1
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
#endif
...
...
@@ -943,7 +938,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
ch
[
0
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
0
]
-
(
int32_t
)
pil
[
1
]
*
rxF
[
1
])
>>
15
);
ch
[
1
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
1
]
+
(
int32_t
)
pil
[
1
]
*
rxF
[
0
])
>>
15
);
#ifdef DEBUG_CH
#ifdef DEBUG_
PB
CH
printf
(
"pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d)
\n
"
,
pilot_cnt
,
rxF
[
0
],
rxF
[
1
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
#endif
multadd_real_vector_complex_scalar
(
fl
,
...
...
@@ -962,7 +957,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
ch
[
0
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
0
]
-
(
int32_t
)
pil
[
1
]
*
rxF
[
1
])
>>
15
);
ch
[
1
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
1
]
+
(
int32_t
)
pil
[
1
]
*
rxF
[
0
])
>>
15
);
#ifdef DEBUG_CH
#ifdef DEBUG_
PB
CH
printf
(
"pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d)
\n
"
,
pilot_cnt
+
1
,
rxF
[
0
],
rxF
[
1
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
#endif
multadd_real_vector_complex_scalar
(
fm
,
...
...
@@ -976,7 +971,7 @@ int nr_pbch_channel_estimation(PHY_VARS_NR_UE *ue,
ch
[
0
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
0
]
-
(
int32_t
)
pil
[
1
]
*
rxF
[
1
])
>>
15
);
ch
[
1
]
=
(
int16_t
)(((
int32_t
)
pil
[
0
]
*
rxF
[
1
]
+
(
int32_t
)
pil
[
1
]
*
rxF
[
0
])
>>
15
);
#ifdef DEBUG_CH
#ifdef DEBUG_
PB
CH
printf
(
"pilot %u : rxF - > (%d,%d) ch -> (%d,%d), pil -> (%d,%d)
\n
"
,
pilot_cnt
+
2
,
rxF
[
0
],
rxF
[
1
],
ch
[
0
],
ch
[
1
],
pil
[
0
],
pil
[
1
]);
#endif
...
...
openair1/PHY/NR_UE_TRANSPORT/pss_nr.c
View file @
b2ae5502
...
...
@@ -600,24 +600,6 @@ int pss_synchro_nr(PHY_VARS_NR_UE *PHY_vars_UE, int is, int rate_change)
}
static
inline
int
abs32
(
int
x
)
{
return
(((
int
)((
short
*
)
&
x
)[
0
])
*
((
int
)((
short
*
)
&
x
)[
0
])
+
((
int
)((
short
*
)
&
x
)[
1
])
*
((
int
)((
short
*
)
&
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
]));
}
static
inline
double
angle64
(
int64_t
x
)
{
double
re
=
((
int32_t
*
)
&
x
)[
0
];
double
im
=
((
int32_t
*
)
&
x
)[
1
];
return
(
atan2
(
im
,
re
));
}
/*******************************************************************
*
...
...
openair1/PHY/defs_common.h
View file @
b2ae5502
...
...
@@ -1113,4 +1113,26 @@ static inline int release_thread(pthread_mutex_t *mutex,
return
(
0
);
}
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
]));
}
static
inline
double
absF
(
struct
complexd
x
)
{
return
x
.
r
*
x
.
r
+
x
.
i
*
x
.
i
;
}
static
inline
double
angle64
(
int64_t
x
)
{
double
re
=
((
int32_t
*
)
&
x
)[
0
];
double
im
=
((
int32_t
*
)
&
x
)[
1
];
return
(
atan2
(
im
,
re
));
}
#endif // __PHY_DEFS_COMMON_H__
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