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
ed05c94c
Commit
ed05c94c
authored
Jul 30, 2024
by
Bartosz Podrygajlo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix signal_energy_nodc for lengths that are not multiples of 4
parent
0ed8fb72
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
117 additions
and
115 deletions
+117
-115
openair1/PHY/CMakeLists.txt
openair1/PHY/CMakeLists.txt
+1
-6
openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c
openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c
+9
-9
openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c
openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c
+6
-6
openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c
openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c
+1
-1
openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c
openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c
+3
-3
openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c
openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c
+3
-3
openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c
openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c
+1
-1
openair1/PHY/NR_TRANSPORT/pucch_rx.c
openair1/PHY/NR_TRANSPORT/pucch_rx.c
+2
-2
openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c
openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c
+1
-1
openair1/PHY/TOOLS/CMakeLists.txt
openair1/PHY/TOOLS/CMakeLists.txt
+29
-21
openair1/PHY/TOOLS/signal_energy.c
openair1/PHY/TOOLS/signal_energy.c
+20
-57
openair1/PHY/TOOLS/tests/CMakeLists.txt
openair1/PHY/TOOLS/tests/CMakeLists.txt
+5
-0
openair1/PHY/TOOLS/tests/test_signal_energy.cpp
openair1/PHY/TOOLS/tests/test_signal_energy.cpp
+31
-0
openair1/PHY/TOOLS/tools_defs.h
openair1/PHY/TOOLS/tools_defs.h
+1
-1
openair1/SCHED/ru_procedures.c
openair1/SCHED/ru_procedures.c
+1
-1
openair1/SCHED_NR/nr_ru_procedures.c
openair1/SCHED_NR/nr_ru_procedures.c
+1
-1
openair1/SCHED_NR/phy_procedures_nr_gNB.c
openair1/SCHED_NR/phy_procedures_nr_gNB.c
+2
-2
No files found.
openair1/PHY/CMakeLists.txt
View file @
ed05c94c
add_boolean_option
(
ENABLE_UESCOPE OFF
"Whether to build the lte uescope"
OFF
)
add_boolean_option
(
ENABLE_ENBSCOPE OFF
"Whether to build the lte enbcope"
OFF
)
add_boolean_option
(
ENABLE_NRSCOPE OFF
"Whether to build the 5G scope"
OFF
)
if
(
ENABLE_UESCOPE OR ENABLE_ENBSCOPE OR ENABLE_NRSCOPE
)
add_subdirectory
(
TOOLS
)
endif
()
add_subdirectory
(
nr_phy_common
)
add_subdirectory
(
TOOLS
)
openair1/PHY/LTE_ESTIMATION/lte_eNB_measurements.c
View file @
ed05c94c
...
...
@@ -69,7 +69,7 @@ void lte_eNB_I0_measurements(PHY_VARS_eNB *eNB,
uint32_t
aarx
/* ,rx_power_correction */
;
uint32_t
rb
;
int32
_t
*
ul_ch
;
c16
_t
*
ul_ch
;
int32_t
n0_power_tot
;
int64_t
n0_power_tot2
;
int
len
;
...
...
@@ -112,9 +112,9 @@ void lte_eNB_I0_measurements(PHY_VARS_eNB *eNB,
for
(
aarx
=
0
;
aarx
<
frame_parms
->
nb_antennas_rx
;
aarx
++
)
{
measurements
->
n0_subband_power
[
aarx
][
rb
]
=
0
;
for
(
int
s
=
0
;
s
<
(
14
-
(
frame_parms
->
Ncp
<<
1
));
s
++
)
{
offset
=
offset0
+
(
s
*
frame_parms
->
ofdm_symbol_size
);
ul_ch
=
&
common_vars
->
rxdataF
[
aarx
][
offset
];
len
=
12
;
offset
=
offset0
+
(
s
*
frame_parms
->
ofdm_symbol_size
);
ul_ch
=
(
c16_t
*
)
&
common_vars
->
rxdataF
[
aarx
][
offset
];
len
=
12
;
// just do first half of middle PRB for odd number of PRBs
if
(((
frame_parms
->
N_RB_UL
&
1
)
==
1
)
&&
(
rb
==
(
frame_parms
->
N_RB_UL
>>
1
)))
{
...
...
@@ -154,7 +154,7 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
int32_t
aarx
,
rx_power_correction
;
int32_t
rx_power
;
uint32_t
rb
;
int32
_t
*
ul_ch
;
c16
_t
*
ul_ch
;
//printf("Running eNB_srs_measurements for eNB_id %d\n",eNB_id);
...
...
@@ -176,9 +176,9 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
measurements
->
rx_spatial_power
[
srs_id
][
0
][
aarx
]
=
((
signal_energy_nodc
(
&
srs_vars
->
srs_ch_estimates
[
aarx
][
frame_parms
->
first_carrier_offset
],
((
signal_energy_nodc
(
(
c16_t
*
)
&
srs_vars
->
srs_ch_estimates
[
aarx
][
frame_parms
->
first_carrier_offset
],
(
frame_parms
->
N_RB_DL
*
6
))
+
signal_energy_nodc
(
&
srs_vars
->
srs_ch_estimates
[
aarx
][
1
],
signal_energy_nodc
(
(
c16_t
*
)
&
srs_vars
->
srs_ch_estimates
[
aarx
][
1
],
(
frame_parms
->
N_RB_DL
*
6
)))
*
rx_power_correction
)
-
measurements
->
n0_power
[
aarx
];
...
...
@@ -219,9 +219,9 @@ void lte_eNB_srs_measurements(PHY_VARS_eNB *eNB,
// printf("common_vars->srs_ch_estimates[0] => %x\n",common_vars->srs_ch_estimates[0]);
if
(
rb
<
12
)
ul_ch
=
&
srs_vars
->
srs_ch_estimates
[
aarx
][
frame_parms
->
first_carrier_offset
+
(
rb
*
12
)];
ul_ch
=
(
c16_t
*
)
&
srs_vars
->
srs_ch_estimates
[
aarx
][
frame_parms
->
first_carrier_offset
+
(
rb
*
12
)];
else
if
(
rb
>
12
)
ul_ch
=
&
srs_vars
->
srs_ch_estimates
[
aarx
][
6
+
(
rb
-
13
)
*
12
];
ul_ch
=
(
c16_t
*
)
&
srs_vars
->
srs_ch_estimates
[
aarx
][
6
+
(
rb
-
13
)
*
12
];
else
{
measurements
->
subband_cqi_dB
[
srs_id
][
aarx
][
rb
]
=
0
;
continue
;
...
...
openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c
View file @
ed05c94c
...
...
@@ -1062,7 +1062,7 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
for
(
aarx
=
0
;
aarx
<
frame_parms
->
nb_antennas_rx
;
aarx
++
)
{
for
(
aatx
=
0
;
aatx
<
frame_parms
->
nb_antenna_ports_eNB
;
aatx
++
)
{
ue
->
measurements
.
rx_spatial_power
[
eNB_id
][
aatx
][
aarx
]
=
(
signal_energy_nodc
(
&
ue
->
common_vars
.
common_vars_rx_data_per_thread
[
ue
->
current_thread_id
[
subframe
]].
dl_ch_estimates
[
eNB_id
][(
aatx
<<
1
)
+
aarx
][
0
],
(
signal_energy_nodc
(
(
c16_t
*
)
&
ue
->
common_vars
.
common_vars_rx_data_per_thread
[
ue
->
current_thread_id
[
subframe
]].
dl_ch_estimates
[
eNB_id
][(
aatx
<<
1
)
+
aarx
][
0
],
(
N_RB_DL
*
12
)));
//- ue->measurements.n0_power[aarx];
...
...
@@ -1169,7 +1169,7 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
msg("subband %d (%d) : %d,%d\n",subband,i,((short *)dl_ch0)[2*i],((short *)dl_ch0)[1+(2*i)]);
*/
ue
->
measurements
.
subband_cqi
[
eNB_id
][
aarx
][
subband
]
=
(
signal_energy_nodc
(
dl_ch0
,
subband_size
)
+
signal_energy_nodc
(
dl_ch1
,
subband_size
));
(
signal_energy_nodc
(
(
c16_t
*
)
dl_ch0
,
subband_size
)
+
signal_energy_nodc
((
c16_t
*
)
dl_ch1
,
subband_size
));
if
(
ue
->
measurements
.
subband_cqi
[
eNB_id
][
aarx
][
subband
]
<
0
)
ue
->
measurements
.
subband_cqi
[
eNB_id
][
aarx
][
subband
]
=
0
;
...
...
@@ -1185,8 +1185,8 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
}
else
{
// this is for the last subband which is smaller in size
// for (i=0;i<12;i++)
// printf("subband %d (%d) : %d,%d\n",subband,i,((short *)dl_ch0)[2*i],((short *)dl_ch0)[1+(2*i)]);
ue
->
measurements
.
subband_cqi
[
eNB_id
][
aarx
][
subband
]
=
(
signal_energy_nodc
(
dl_ch0
,
last_subband_size
)
+
signal_energy_nodc
(
dl_ch1
,
last_subband_size
));
// - ue->measurements.n0_power[aarx];
ue
->
measurements
.
subband_cqi
[
eNB_id
][
aarx
][
subband
]
=
(
signal_energy_nodc
(
(
c16_t
*
)
dl_ch0
,
last_subband_size
)
+
signal_energy_nodc
(
(
c16_t
*
)
dl_ch1
,
last_subband_size
));
// - ue->measurements.n0_power[aarx];
ue
->
measurements
.
subband_cqi_tot
[
eNB_id
][
subband
]
+=
ue
->
measurements
.
subband_cqi
[
eNB_id
][
aarx
][
subband
];
ue
->
measurements
.
subband_cqi_dB
[
eNB_id
][
aarx
][
subband
]
=
dB_fixed2
(
ue
->
measurements
.
subband_cqi
[
eNB_id
][
aarx
][
subband
],
ue
->
measurements
.
n0_power
[
aarx
]);
...
...
@@ -1297,7 +1297,7 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
// for (i=0;i<48;i++)
// printf("subband %d (%d) : %d,%d\n",subband,i,((short *)dl_ch0)[2*i],((short *)dl_ch0)[1+(2*i)]);
ue
->
measurements
.
subband_cqi
[
eNB_id
][
aarx
][
subband
]
=
(
signal_energy_nodc
(
dl_ch0
,
48
)
)
-
ue
->
measurements
.
n0_power
[
aarx
];
(
signal_energy_nodc
(
(
c16_t
*
)
dl_ch0
,
48
)
)
-
ue
->
measurements
.
n0_power
[
aarx
];
ue
->
measurements
.
subband_cqi_tot
[
eNB_id
][
subband
]
+=
ue
->
measurements
.
subband_cqi
[
eNB_id
][
aarx
][
subband
];
ue
->
measurements
.
subband_cqi_dB
[
eNB_id
][
aarx
][
subband
]
=
dB_fixed2
(
ue
->
measurements
.
subband_cqi
[
eNB_id
][
aarx
][
subband
],
...
...
@@ -1305,7 +1305,7 @@ void lte_ue_measurements(PHY_VARS_UE *ue,
}
else
{
// for (i=0;i<12;i++)
// printf("subband %d (%d) : %d,%d\n",subband,i,((short *)dl_ch0)[2*i],((short *)dl_ch0)[1+(2*i)]);
ue
->
measurements
.
subband_cqi
[
eNB_id
][
aarx
][
subband
]
=
(
signal_energy_nodc
(
dl_ch0
,
12
)
)
-
ue
->
measurements
.
n0_power
[
aarx
];
ue
->
measurements
.
subband_cqi
[
eNB_id
][
aarx
][
subband
]
=
(
signal_energy_nodc
(
(
c16_t
*
)
dl_ch0
,
12
)
)
-
ue
->
measurements
.
n0_power
[
aarx
];
ue
->
measurements
.
subband_cqi_tot
[
eNB_id
][
subband
]
+=
ue
->
measurements
.
subband_cqi
[
eNB_id
][
aarx
][
subband
];
ue
->
measurements
.
subband_cqi_dB
[
eNB_id
][
aarx
][
subband
]
=
dB_fixed2
(
ue
->
measurements
.
subband_cqi
[
eNB_id
][
aarx
][
subband
],
ue
->
measurements
.
n0_power
[
aarx
]);
...
...
openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c
View file @
ed05c94c
...
...
@@ -843,7 +843,7 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
}
for
(
i
=
0
;
i
<
frame_parms
->
nb_antennas_rx
;
i
++
)
{
pusch_vars
->
ulsch_power
[
i
]
=
signal_energy_nodc
(
pusch_vars
->
drs_ch_estimates
[
i
],
pusch_vars
->
ulsch_power
[
i
]
=
signal_energy_nodc
(
(
c16_t
*
)
pusch_vars
->
drs_ch_estimates
[
i
],
ulsch
[
UE_id
]
->
harq_processes
[
harq_pid
]
->
nb_rb
*
12
)
/
correction_factor
;
LOG_D
(
PHY
,
"%4.4d.%d power harq_pid %d rb %2.2d TBS %2.2d (MPR_times_Ks %d correction %d) power %d dBtimes10
\n
"
,
proc
->
frame_rx
,
proc
->
subframe_rx
,
harq_pid
,
ulsch
[
UE_id
]
->
harq_processes
[
harq_pid
]
->
nb_rb
,
ulsch
[
UE_id
]
->
harq_processes
[
harq_pid
]
->
TBS
,
MPR_times_100Ks
,
correction_factor
,
dB_fixed_x10
(
pusch_vars
->
ulsch_power
[
i
]));
...
...
openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c
View file @
ed05c94c
...
...
@@ -1955,7 +1955,7 @@ void dlsch_channel_compensation_TM56(int **rxdataF_ext,
}
Nre
=
(
pilots
==
0
)
?
12
:
8
;
precoded_signal_strength
+=
((
signal_energy_nodc
(
&
dl_ch_estimates_ext
[
aarx
][
symbol
*
frame_parms
->
N_RB_DL
*
Nre
],
precoded_signal_strength
+=
((
signal_energy_nodc
(
(
c16_t
*
)
&
dl_ch_estimates_ext
[
aarx
][
symbol
*
frame_parms
->
N_RB_DL
*
Nre
],
(
nb_rb
*
Nre
)))
-
(
measurements
->
n0_power
[
aarx
]));
}
// rx_antennas
...
...
@@ -2349,9 +2349,9 @@ void dlsch_channel_compensation_TM34(LTE_DL_FRAME_PARMS *frame_parms,
}
// rb loop
Nre
=
(
pilots
==
0
)
?
12
:
8
;
precoded_signal_strength0
+=
((
signal_energy_nodc
(
&
dl_ch_estimates_ext
[
aarx
][
symbol
*
frame_parms
->
N_RB_DL
*
Nre
],
precoded_signal_strength0
+=
((
signal_energy_nodc
(
(
c16_t
*
)
&
dl_ch_estimates_ext
[
aarx
][
symbol
*
frame_parms
->
N_RB_DL
*
Nre
],
(
nb_rb
*
Nre
))
*
rx_power_correction
)
-
(
measurements
->
n0_power
[
aarx
]));
precoded_signal_strength1
+=
((
signal_energy_nodc
(
&
dl_ch_estimates_ext
[
aarx
+
2
][
symbol
*
frame_parms
->
N_RB_DL
*
Nre
],
precoded_signal_strength1
+=
((
signal_energy_nodc
(
(
c16_t
*
)
&
dl_ch_estimates_ext
[
aarx
+
2
][
symbol
*
frame_parms
->
N_RB_DL
*
Nre
],
(
nb_rb
*
Nre
))
*
rx_power_correction
)
-
(
measurements
->
n0_power
[
aarx
]));
}
// rx_antennas
...
...
openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c
View file @
ed05c94c
...
...
@@ -143,12 +143,12 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB, int slot, int first_symb, int num_sy
int
offset
=
offset0
+
(
frame_parms
->
first_carrier_offset
+
(
rb
*
12
))
%
frame_parms
->
ofdm_symbol_size
;
nb_symb
[
rb
]
++
;
for
(
int
aarx
=
0
;
aarx
<
frame_parms
->
nb_antennas_rx
;
aarx
++
)
{
int32_t
*
ul_ch
=
(
int32_t
*
)
&
common_vars
->
rxdataF
[
aarx
][
offset
];
c16_t
*
ul_ch
=
&
common_vars
->
rxdataF
[
aarx
][
offset
];
int32_t
signal_energy
;
if
(((
frame_parms
->
N_RB_UL
&
1
)
==
1
)
&&
(
rb
==
(
frame_parms
->
N_RB_UL
>>
1
)))
{
signal_energy
=
signal_energy_nodc
(
ul_ch
,
6
);
ul_ch
=
(
int32_t
*
)
&
common_vars
->
rxdataF
[
aarx
][
offset0
];
ul_ch
=
&
common_vars
->
rxdataF
[
aarx
][
offset0
];
signal_energy
+=
signal_energy_nodc
(
ul_ch
,
6
);
}
else
{
signal_energy
=
signal_energy_nodc
(
ul_ch
,
12
);
...
...
@@ -229,7 +229,7 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB,
for
(
int
aatx
=
0
;
aatx
<
nrOfLayers
;
aatx
++
){
rx_spatial_power
[
aatx
][
aarx
]
=
(
signal_energy_nodc
(
&
pusch_vars
->
ul_ch_estimates
[
aatx
*
fp
->
nb_antennas_rx
+
aarx
][
ch_offset
],
(
signal_energy_nodc
(
(
c16_t
*
)
&
pusch_vars
->
ul_ch_estimates
[
aatx
*
fp
->
nb_antennas_rx
+
aarx
][
ch_offset
],
N_RB_UL
*
NR_NB_SC_PER_RB
));
if
(
rx_spatial_power
[
aatx
][
aarx
]
<
0
)
{
...
...
openair1/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c
View file @
ed05c94c
...
...
@@ -1522,7 +1522,7 @@ int nr_rx_pusch_tp(PHY_VARS_gNB *gNB,
}
for
(
int
aatx
=
0
;
aatx
<
rel15_ul
->
nrOfLayers
;
aatx
++
)
{
pusch_vars
->
ulsch_power
[
aarx
]
+=
signal_energy_nodc
(
&
pusch_vars
->
ul_ch_estimates
[
aatx
*
gNB
->
frame_parms
.
nb_antennas_rx
+
aarx
][
symbol
*
frame_parms
->
ofdm_symbol_size
],
(
c16_t
*
)
&
pusch_vars
->
ul_ch_estimates
[
aatx
*
gNB
->
frame_parms
.
nb_antennas_rx
+
aarx
][
symbol
*
frame_parms
->
ofdm_symbol_size
],
rel15_ul
->
rb_size
*
12
);
}
for
(
int
rb
=
0
;
rb
<
rel15_ul
->
rb_size
;
rb
++
)
...
...
openair1/PHY/NR_TRANSPORT/pucch_rx.c
View file @
ed05c94c
...
...
@@ -266,7 +266,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
printf
(
"x (%d,%d), xr (%ld,%ld)
\n
"
,
x_re
[
l
][
n
],
x_im
[
l
][
n
],
xr
[
aa
][
l
][
n
].
r
,
xr
[
aa
][
l
][
n
].
i
);
#endif
}
int
energ
=
signal_energy_nodc
(
(
int32_t
*
)
rp
,
nb_re_pucch
);
int
energ
=
signal_energy_nodc
(
rp
,
nb_re_pucch
);
signal_energy
+=
energ
;
if
(
aa
==
0
)
signal_energy_ant0
+=
energ
;
...
...
@@ -1629,7 +1629,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
uci_pdu
->
pucch_format
=
0
;
uci_pdu
->
ul_cqi
=
cqi
;
uci_pdu
->
timing_advance
=
0xffff
;
// currently not valid
uci_pdu
->
rssi
=
1280
-
(
10
*
dB_fixed
(
32767
*
32767
)
-
dB_fixed_times10
(
signal_energy_nodc
(
(
int32_t
*
)
&
rxdataF
[
0
][
soffset
+
(
l2
*
frame_parms
->
ofdm_symbol_size
)
+
re_offset
[
0
]],
12
*
pucch_pdu
->
prb_size
)));
uci_pdu
->
rssi
=
1280
-
(
10
*
dB_fixed
(
32767
*
32767
)
-
dB_fixed_times10
(
signal_energy_nodc
(
&
rxdataF
[
0
][
soffset
+
(
l2
*
frame_parms
->
ofdm_symbol_size
)
+
re_offset
[
0
]],
12
*
pucch_pdu
->
prb_size
)));
if
(
pucch_pdu
->
bit_len_harq
>
0
)
{
int
harq_bytes
=
pucch_pdu
->
bit_len_harq
>>
3
;
if
((
pucch_pdu
->
bit_len_harq
&
7
)
>
0
)
harq_bytes
++
;
...
...
openair1/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c
View file @
ed05c94c
...
...
@@ -113,7 +113,7 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue,
ue
->
measurements
.
rx_power
[
gNB_id
][
aarx
]
=
0
;
for
(
aatx
=
0
;
aatx
<
frame_parms
->
nb_antenna_ports_gNB
;
aatx
++
){
const
int
z
=
signal_energy_nodc
(
&
dl_ch_estimates
[
gNB_id
][
ch_offset
],
N_RB_DL
*
NR_NB_SC_PER_RB
);
const
int
z
=
signal_energy_nodc
(
(
c16_t
*
)
&
dl_ch_estimates
[
gNB_id
][
ch_offset
],
N_RB_DL
*
NR_NB_SC_PER_RB
);
rx_spatial_power
[
gNB_id
][
aatx
][
aarx
]
=
z
;
if
(
rx_spatial_power
[
gNB_id
][
aatx
][
aarx
]
<
0
)
...
...
openair1/PHY/TOOLS/CMakeLists.txt
View file @
ed05c94c
...
...
@@ -29,29 +29,37 @@
#* \warning
#*/
find_library
(
forms NAMES forms
)
if
(
NOT forms
)
message
(
FATAL_ERROR
"required library forms not found for building scopes"
)
else
()
message
(
STATUS
"libforms library, required for scopes, found at
${
forms
}
"
)
endif
()
add_boolean_option
(
ENABLE_UESCOPE OFF
"Whether to build the lte uescope"
OFF
)
add_boolean_option
(
ENABLE_ENBSCOPE OFF
"Whether to build the lte enbcope"
OFF
)
add_boolean_option
(
ENABLE_NRSCOPE OFF
"Whether to build the 5G scope"
OFF
)
if
(
ENABLE_UESCOPE OR ENABLE_ENBSCOPE OR ENABLE_NRSCOPE
)
find_library
(
forms NAMES forms
)
if
(
NOT forms
)
message
(
FATAL_ERROR
"required library forms not found for building scopes"
)
else
()
message
(
STATUS
"libforms library, required for scopes, found at
${
forms
}
"
)
endif
()
include_directories
(
"/usr/include/X11"
)
add_library
(
xforms_common OBJECT
lte_phy_scope.c
../../../executables/stats.c
)
target_link_libraries
(
xforms_common PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs
)
include_directories
(
"/usr/include/X11"
)
add_library
(
xforms_common OBJECT
lte_phy_scope.c
../../../executables/stats.c
)
target_link_libraries
(
xforms_common PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs
)
add_library
(
enbscope MODULE lte_enb_scope.c $<TARGET_OBJECTS:xforms_common>
)
target_link_libraries
(
enbscope PUBLIC forms PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs
)
add_library
(
enbscope MODULE lte_enb_scope.c $<TARGET_OBJECTS:xforms_common>
)
target_link_libraries
(
enbscope PUBLIC forms PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs
)
add_library
(
uescope MODULE lte_ue_scope.c $<TARGET_OBJECTS:xforms_common>
)
target_link_libraries
(
uescope PUBLIC forms PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs
)
add_library
(
uescope MODULE lte_ue_scope.c $<TARGET_OBJECTS:xforms_common>
)
target_link_libraries
(
uescope PUBLIC forms PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs
)
add_library
(
nrscope MODULE nr_phy_scope.c
)
target_link_libraries
(
nrscope PUBLIC forms PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs
)
add_library
(
nrscope MODULE nr_phy_scope.c
)
target_link_libraries
(
nrscope PUBLIC forms PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs
)
# all libraries should be written to root build dir (default creates the same hierarchie under build as existing for sources)
set_target_properties
(
enbscope uescope nrscope
PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../../..
)
# all libraries should be written to root build dir (default creates the same hierarchie under build as existing for sources)
set_target_properties
(
enbscope uescope nrscope
PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../../..
)
endif
()
if
(
ENABLE_TESTS
)
add_subdirectory
(
tests
)
endif
()
openair1/PHY/TOOLS/signal_energy.c
View file @
ed05c94c
...
...
@@ -112,30 +112,32 @@ int32_t signal_energy_amp_shift(int32_t *input,uint32_t length)
return
((
temp
>
0
)
?
temp
:
1
);
}
int32_t
signal_energy_nodc
(
int32_t
*
input
,
uint32_t
length
)
int32_t
signal_energy_nodc
(
const
c16_t
*
input
,
uint32_t
length
)
{
int32_t
i
;
int32_t
temp
;
simde__m128i
in
;
simde__m128
mm0
;
// init
simde__m128
mm0
=
simde_mm_setzero_ps
();
//init
mm0
=
simde_mm_setzero_ps
();
//Acc
for
(
i
=
0
;
i
<
(
length
>>
2
);
i
++
)
{
in
=
simde_mm_loadu_si128
((
simde__m128i
*
)
input
);
mm0
=
simde_mm_add_ps
(
mm0
,
simde_mm_cvtepi32_ps
(
simde_mm_madd_epi16
(
in
,
in
)));
// Acc
for
(
int32_t
i
=
0
;
i
<
(
length
>>
2
);
i
++
)
{
simde__m128i
in
=
simde_mm_loadu_si128
((
simde__m128i
*
)
input
);
mm0
=
simde_mm_add_ps
(
mm0
,
simde_mm_cvtepi32_ps
(
simde_mm_madd_epi16
(
in
,
in
)));
input
+=
4
;
}
//Ave
temp
=
(
int
)((((
float
*
)
&
mm0
)[
0
]
+
((
float
*
)
&
mm0
)[
1
]
+
((
float
*
)
&
mm0
)[
2
]
+
((
float
*
)
&
mm0
)[
3
])
/
(
float
)
length
);
return
temp
;
// leftover
float
leftover_sum
=
0
;
c16_t
*
leftover_input
=
(
c16_t
*
)
input
;
uint16_t
lefover_count
=
length
-
((
length
>>
2
)
<<
2
);
for
(
int32_t
i
=
0
;
i
<
lefover_count
;
i
++
)
{
leftover_sum
+=
leftover_input
[
i
].
r
*
leftover_input
[
i
].
r
+
leftover_input
[
i
].
i
*
leftover_input
[
i
].
i
;
}
// Ave
float
sums
[
4
];
simde_mm_store_ps
(
sums
,
mm0
);
return
(
int
)((
sums
[
0
]
+
sums
[
1
]
+
sums
[
2
]
+
sums
[
3
]
+
leftover_sum
)
/
(
float
)
length
);
}
double
signal_energy_fp
(
double
*
s_re
[
2
],
double
*
s_im
[
2
],
uint32_t
nb_antennas
,
uint32_t
length
,
uint32_t
offset
)
{
...
...
@@ -164,45 +166,6 @@ double signal_energy_fp2(struct complexd *s,uint32_t length)
}
return
(
V
/
length
);
}
//
#ifdef MAIN
#define LENGTH 256
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
main
(
int
argc
,
char
**
argv
)
{
int
input
[
LENGTH
];
int
energy
=
0
,
dc_r
=
0
,
dc_i
=
0
;
int16_t
s
=
1
,
i
;
int
amp
;
amp
=
atoi
(
argv
[
1
]);
// arguments to integer
if
(
argc
>
1
)
printf
(
"Amp = %d
\n
"
,
amp
);
for
(
i
=
0
;
i
<
LENGTH
;
i
++
)
{
s
=
-
s
;
((
int16_t
*
)
input
)[
2
*
i
]
=
31
+
(
int16_t
)(
amp
*
sin
(
2
*
M_PI
*
i
/
LENGTH
));
((
int16_t
*
)
input
)[
1
+
(
2
*
i
)]
=
30
+
(
int16_t
)(
amp
*
cos
(
2
*
M_PI
*
i
/
LENGTH
));
energy
+=
(((
int16_t
*
)
input
)[
2
*
i
]
*
((
int16_t
*
)
input
)[
2
*
i
])
+
(((
int16_t
*
)
input
)[
1
+
(
2
*
i
)]
*
((
int16_t
*
)
input
)[
1
+
(
2
*
i
)]);
dc_r
+=
((
int16_t
*
)
input
)[
2
*
i
];
dc_i
+=
((
int16_t
*
)
input
)[
1
+
(
2
*
i
)];
}
energy
/=
LENGTH
;
dc_r
/=
LENGTH
;
dc_i
/=
LENGTH
;
printf
(
"signal_energy = %d dB(%d,%d,%d,%d)
\n
"
,
dB_fixed
(
signal_energy
(
input
,
LENGTH
)),
signal_energy
(
input
,
LENGTH
),
energy
-
(
dc_r
*
dc_r
+
dc_i
*
dc_i
),
energy
,(
dc_r
*
dc_r
+
dc_i
*
dc_i
));
printf
(
"dc = (%d,%d)
\n
"
,
dc_r
,
dc_i
);
}
#endif
int32_t
signal_power
(
int32_t
*
input
,
uint32_t
length
)
{
...
...
openair1/PHY/TOOLS/tests/CMakeLists.txt
0 → 100644
View file @
ed05c94c
add_executable
(
test_signal_energy test_signal_energy.cpp ../signal_energy.c
)
target_link_libraries
(
test_signal_energy PRIVATE GTest::gtest UTIL
)
add_dependencies
(
tests test_signal_energy
)
add_test
(
NAME test_signal_energy
COMMAND ./test_signal_energy
)
openair1/PHY/TOOLS/tests/test_signal_energy.cpp
0 → 100644
View file @
ed05c94c
#include <gtest/gtest.h>
extern
"C"
{
#include "openair1/PHY/TOOLS/tools_defs.h"
extern
int32_t
signal_energy_nodc
(
const
c16_t
*
input
,
uint32_t
length
);
}
#include <vector>
#include <algorithm>
int32_t
signal_energy_nodc_ref
(
const
c16_t
*
input
,
uint32_t
length
)
{
float
sum
=
0
;
for
(
auto
i
=
0U
;
i
<
length
;
i
++
)
{
sum
+=
input
[
i
].
r
*
input
[
i
].
r
+
input
[
i
].
i
*
input
[
i
].
i
;
}
return
sum
/
length
;
}
TEST
(
signal_energy_nodc
,
size_6
)
{
std
::
vector
<
c16_t
>
input
;
input
.
resize
(
6
);
std
::
fill
(
input
.
begin
(),
input
.
end
(),
(
c16_t
){
42
,
42
});
EXPECT_EQ
(
signal_energy_nodc
(
input
.
data
(),
input
.
size
()),
signal_energy_nodc_ref
(
input
.
data
(),
input
.
size
()));
}
int
main
(
int
argc
,
char
**
argv
)
{
testing
::
InitGoogleTest
(
&
argc
,
argv
);
return
RUN_ALL_TESTS
();
}
openair1/PHY/TOOLS/tools_defs.h
View file @
ed05c94c
...
...
@@ -761,7 +761,7 @@ int32_t subcarrier_energy(int32_t *,uint32_t, int32_t *subcarrier_energy, uint16
/*!\fn int32_t signal_energy_nodc(int32_t *,uint32_t);
\brief Computes the signal energy per subcarrier, without DC removal
*/
int32_t
signal_energy_nodc
(
int32_t
*
,
uint32_t
);
int32_t
signal_energy_nodc
(
const
c16_t
*
input
,
uint32_t
length
);
int32_t
signal_power
(
int32_t
*
,
uint32_t
);
int32_t
interference_power
(
int32_t
*
,
uint32_t
);
...
...
openair1/SCHED/ru_procedures.c
View file @
ed05c94c
...
...
@@ -444,7 +444,7 @@ void feptx_ofdm(RU_t *ru,
stop_meas
(
&
ru
->
ofdm_mod_stats
);
LOG_D
(
PHY
,
"feptx_ofdm (TXPATH): frame %d, subframe %d: txp (time %p) %d dB, txp (freq) %d dB
\n
"
,
frame
,
subframe
,
txdata
,
dB_fixed
(
signal_energy
((
int32_t
*
)
txdata
,
fp
->
samples_per_tti
)),
dB_fixed
(
signal_energy_nodc
(
ru
->
common
.
txdataF_BF
[
aa
],
2
*
slot_sizeF
)));
dB_fixed
(
signal_energy_nodc
(
(
c16_t
*
)
ru
->
common
.
txdataF_BF
[
aa
],
2
*
slot_sizeF
)));
}
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM
+
ru
->
idx
,
0
);
...
...
openair1/SCHED_NR/nr_ru_procedures.c
View file @
ed05c94c
...
...
@@ -166,7 +166,7 @@ void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx) {
LOG_D
(
PHY
,
"feptx_ofdm (TXPATH): frame %d, slot %d: txp (time %p) %d dB, txp (freq) %d dB
\n
"
,
frame_tx
,
slot
,
txdata
,
dB_fixed
(
signal_energy
((
int32_t
*
)
txdata
,
fp
->
get_samples_per_slot
(
slot
,
fp
))),
dB_fixed
(
signal_energy_nodc
(
ru
->
common
.
txdataF_BF
[
aa
],
2
*
slot_sizeF
)));
slot
,
fp
))),
dB_fixed
(
signal_energy_nodc
(
(
c16_t
*
)
ru
->
common
.
txdataF_BF
[
aa
],
2
*
slot_sizeF
)));
}
...
...
openair1/SCHED_NR/phy_procedures_nr_gNB.c
View file @
ed05c94c
...
...
@@ -746,7 +746,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
"frame %d, slot %d: UL signal energy %d
\n
"
,
frame_rx
,
slot_rx
,
signal_energy_nodc
(
(
int32_t
*
)
&
gNB
->
common_vars
.
rxdataF
[
0
][
soffset
+
offset
+
(
47
*
12
)],
12
*
18
));
signal_energy_nodc
(
&
gNB
->
common_vars
.
rxdataF
[
0
][
soffset
+
offset
+
(
47
*
12
)],
12
*
18
));
start_meas
(
&
gNB
->
phy_proc_rx
);
...
...
@@ -778,7 +778,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
"frame %d, slot %d: PUCCH signal energy %d
\n
"
,
frame_rx
,
slot_rx
,
signal_energy_nodc
(
(
int32_t
*
)
&
gNB
->
common_vars
.
rxdataF
[
0
][
soffset
+
offset
],
12
));
signal_energy_nodc
(
&
gNB
->
common_vars
.
rxdataF
[
0
][
soffset
+
offset
],
12
));
nr_decode_pucch0
(
gNB
,
frame_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