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
7e009781
Commit
7e009781
authored
Oct 03, 2024
by
francescomani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moving out CSI mapping parameters from nr_generate_csi_rs
parent
ad96697d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
128 additions
and
216 deletions
+128
-216
openair1/PHY/NR_REFSIG/nr_refsig.h
openair1/PHY/NR_REFSIG/nr_refsig.h
+2
-8
openair1/PHY/NR_TRANSPORT/nr_csi_rs.c
openair1/PHY/NR_TRANSPORT/nr_csi_rs.c
+14
-83
openair1/PHY/NR_UE_TRANSPORT/csi_rx.c
openair1/PHY/NR_UE_TRANSPORT/csi_rx.c
+83
-117
openair1/PHY/nr_phy_common/inc/nr_phy_common.h
openair1/PHY/nr_phy_common/inc/nr_phy_common.h
+1
-0
openair1/PHY/nr_phy_common/src/nr_phy_common.c
openair1/PHY/nr_phy_common/src/nr_phy_common.c
+23
-0
openair1/SCHED_NR/phy_procedures_nr_gNB.c
openair1/SCHED_NR/phy_procedures_nr_gNB.c
+5
-8
No files found.
openair1/PHY/NR_REFSIG/nr_refsig.h
View file @
7e009781
...
...
@@ -26,6 +26,7 @@
#include "PHY/defs_gNB.h"
#include "openair1/PHY/NR_REFSIG/nr_refsig_common.h"
#include "PHY/nr_phy_common/inc/nr_phy_common.h"
int
nr_pusch_dmrs_rx
(
PHY_VARS_gNB
*
gNB
,
unsigned
int
Ns
,
...
...
@@ -43,14 +44,7 @@ void nr_generate_csi_rs(const NR_DL_FRAME_PARMS *frame_parms,
nr_csi_info_t
*
nr_csi_info
,
const
nfapi_nr_dl_tti_csi_rs_pdu_rel15_t
*
csi_params
,
const
int
slot
,
uint8_t
*
N_cdm_groups
,
uint8_t
*
CDM_group_size
,
uint8_t
*
k_prime
,
uint8_t
*
l_prime
,
uint8_t
*
N_ports
,
uint8_t
*
j_cdm
,
uint8_t
*
k_overline
,
uint8_t
*
l_overline
);
const
csi_mapping_parms_t
*
phy_csi_parms
);
void
init_scrambling_luts
(
void
);
void
nr_generate_modulation_table
(
void
);
...
...
openair1/PHY/NR_TRANSPORT/nr_csi_rs.c
View file @
7e009781
...
...
@@ -21,7 +21,6 @@
#include "PHY/MODULATION/nr_modulation.h"
#include "PHY/NR_REFSIG/nr_refsig.h"
#include "PHY/nr_phy_common/inc/nr_phy_common.h"
//#define NR_CSIRS_DEBUG
...
...
@@ -31,14 +30,7 @@ void nr_generate_csi_rs(const NR_DL_FRAME_PARMS *frame_parms,
nr_csi_info_t
*
nr_csi_info
,
const
nfapi_nr_dl_tti_csi_rs_pdu_rel15_t
*
csi_params
,
const
int
slot
,
uint8_t
*
N_cdm_groups
,
uint8_t
*
CDM_group_size
,
uint8_t
*
k_prime
,
uint8_t
*
l_prime
,
uint8_t
*
N_ports
,
uint8_t
*
j_cdm
,
uint8_t
*
k_overline
,
uint8_t
*
l_overline
)
const
csi_mapping_parms_t
*
phy_csi_parms
)
{
#ifdef NR_CSIRS_DEBUG
LOG_I
(
NR_PHY
,
"csi_params->subcarrier_spacing = %i
\n
"
,
csi_params
->
subcarrier_spacing
);
...
...
@@ -64,11 +56,6 @@ void nr_generate_csi_rs(const NR_DL_FRAME_PARMS *frame_parms,
uint32_t
beta
=
amp
;
nr_csi_info
->
csi_rs_generated_signal_bits
=
log2_approx
(
amp
);
csi_mapping_parms_t
phy_csi_parms
=
get_csi_mapping_parms
(
csi_params
->
row
,
csi_params
->
freq_domain
,
csi_params
->
symb_l0
,
csi_params
->
symb_l1
);
// setting the frequency density from its index
double
rho
=
0
;
switch
(
csi_params
->
freq_density
)
{
...
...
@@ -89,7 +76,7 @@ void nr_generate_csi_rs(const NR_DL_FRAME_PARMS *frame_parms,
}
double
alpha
=
0
;
if
(
phy_csi_parms
.
ports
==
1
)
if
(
phy_csi_parms
->
ports
==
1
)
alpha
=
rho
;
else
alpha
=
2
*
rho
;
...
...
@@ -99,25 +86,9 @@ void nr_generate_csi_rs(const NR_DL_FRAME_PARMS *frame_parms,
#endif
// CDM group size from CDM type index
int
gs
=
0
;
switch
(
csi_params
->
cdm_type
)
{
case
0
:
gs
=
1
;
break
;
case
1
:
gs
=
2
;
break
;
case
2
:
gs
=
4
;
break
;
case
3
:
gs
=
8
;
break
;
default:
AssertFatal
(
false
,
"Invalid cdm type index for CSI
\n
"
);
}
int
gs
=
get_cdm_group_size
(
csi_params
->
cdm_type
);
int
kprime
=
phy_csi_parms
.
kprime
;
int
kprime
=
phy_csi_parms
->
kprime
;
int
csi_length
;
if
(
rho
<
1
)
{
if
(
csi_params
->
freq_density
==
0
)
{
...
...
@@ -133,59 +104,19 @@ void nr_generate_csi_rs(const NR_DL_FRAME_PARMS *frame_parms,
printf
(
" start rb %d, nr of rbs %d, csi length %d
\n
"
,
csi_params
->
start_rb
,
csi_params
->
nr_of_rbs
,
csi_length
);
#endif
if
(
N_cdm_groups
)
*
N_cdm_groups
=
phy_csi_parms
.
size
;
if
(
CDM_group_size
)
*
CDM_group_size
=
gs
;
if
(
k_prime
)
*
k_prime
=
kprime
;
if
(
l_prime
)
*
l_prime
=
phy_csi_parms
.
lprime
;
if
(
N_ports
)
*
N_ports
=
phy_csi_parms
.
ports
;
if
(
j_cdm
)
memcpy
(
j_cdm
,
phy_csi_parms
.
j
,
16
*
sizeof
(
uint8_t
));
if
(
k_overline
)
memcpy
(
k_overline
,
phy_csi_parms
.
koverline
,
16
*
sizeof
(
uint8_t
));
if
(
l_overline
)
memcpy
(
l_overline
,
phy_csi_parms
.
loverline
,
16
*
sizeof
(
uint8_t
));
#ifdef NR_CSIRS_DEBUG
if
(
N_ports
)
LOG_I
(
NR_PHY
,
"nr_csi_info->N_ports = %d
\n
"
,
*
N_ports
);
if
(
N_cdm_groups
)
LOG_I
(
NR_PHY
,
"nr_csi_info->N_cdm_groups = %d
\n
"
,
*
N_cdm_groups
);
if
(
CDM_group_size
)
LOG_I
(
NR_PHY
,
"nr_csi_info->CDM_group_size = %d
\n
"
,
*
CDM_group_size
);
if
(
k_prime
)
LOG_I
(
NR_PHY
,
"nr_csi_info->kprime = %d
\n
"
,
*
k_prime
);
if
(
l_prime
)
LOG_I
(
NR_PHY
,
"nr_csi_info->lprime = %d
\n
"
,
*
l_prime
);
if
(
N_cdm_groups
)
{
for
(
int
ji
=
0
;
ji
<
*
N_cdm_groups
;
ji
++
)
{
LOG_I
(
NR_PHY
,
"(CDM group %d) j = %d, koverline = %d, loverline = %d
\n
"
,
ji
,
phy_csi_parms
.
j
[
ji
],
phy_csi_parms
.
koverline
[
ji
],
phy_csi_parms
.
loverline
[
ji
]);
}
}
#endif
if
(
csi_params
->
csi_type
==
2
)
// ZP-CSI
return
;
// assuming amp is the amplitude of SSB channels
switch
(
csi_params
->
power_control_offset_ss
)
{
case
0
:
beta
=
(
amp
*
ONE_OVER_SQRT2_Q15
)
>>
15
;
beta
=
(
amp
*
ONE_OVER_SQRT2_Q15
)
>>
15
;
break
;
case
1
:
beta
=
amp
;
break
;
case
2
:
beta
=
(
amp
*
ONE_OVER_SQRT2_Q15
)
>>
14
;
beta
=
(
amp
*
ONE_OVER_SQRT2_Q15
)
>>
14
;
break
;
case
3
:
beta
=
amp
<<
1
;
...
...
@@ -194,7 +125,7 @@ void nr_generate_csi_rs(const NR_DL_FRAME_PARMS *frame_parms,
AssertFatal
(
false
,
"Invalid SS power offset density index for CSI
\n
"
);
}
for
(
int
lp
=
0
;
lp
<=
phy_csi_parms
.
lprime
;
lp
++
)
{
for
(
int
lp
=
0
;
lp
<=
phy_csi_parms
->
lprime
;
lp
++
)
{
int
symb
=
csi_params
->
symb_l0
;
const
uint32_t
*
gold
=
nr_gold_csi_rs
(
frame_parms
->
N_RB_DL
,
frame_parms
->
symbols_per_slot
,
slot
,
symb
+
lp
,
csi_params
->
scramb_id
);
...
...
@@ -222,25 +153,25 @@ void nr_generate_csi_rs(const NR_DL_FRAME_PARMS *frame_parms,
// resource mapping according to 38.211 7.4.1.5.3
for
(
int
n
=
csi_params
->
start_rb
;
n
<
(
csi_params
->
start_rb
+
csi_params
->
nr_of_rbs
);
n
++
)
{
if
((
csi_params
->
freq_density
>
1
)
||
(
csi_params
->
freq_density
==
(
n
%
2
)))
{
// for freq density 0.5 checks if even or odd RB
for
(
int
ji
=
0
;
ji
<
phy_csi_parms
.
size
;
ji
++
)
{
// loop over CDM groups
for
(
int
ji
=
0
;
ji
<
phy_csi_parms
->
size
;
ji
++
)
{
// loop over CDM groups
for
(
int
s
=
0
;
s
<
gs
;
s
++
)
{
// loop over each CDM group size
int
p
=
s
+
phy_csi_parms
.
j
[
ji
]
*
gs
;
// port index
int
p
=
s
+
phy_csi_parms
->
j
[
ji
]
*
gs
;
// port index
for
(
int
kp
=
0
;
kp
<=
kprime
;
kp
++
)
{
// loop over frequency resource elements within a group
// frequency index of current resource element
int
k
=
(
start_sc
+
(
n
*
NR_NB_SC_PER_RB
)
+
phy_csi_parms
.
koverline
[
ji
]
+
kp
)
%
(
frame_parms
->
ofdm_symbol_size
);
int
k
=
(
start_sc
+
(
n
*
NR_NB_SC_PER_RB
)
+
phy_csi_parms
->
koverline
[
ji
]
+
kp
)
%
(
frame_parms
->
ofdm_symbol_size
);
// wf according to tables 7.4.5.3-2 to 7.4.5.3-5
int
wf
=
kp
==
0
?
1
:
(
-
2
*
(
s
%
2
)
+
1
);
int
na
=
n
*
alpha
;
int
kpn
=
(
rho
*
phy_csi_parms
.
koverline
[
ji
])
/
NR_NB_SC_PER_RB
;
int
kpn
=
(
rho
*
phy_csi_parms
->
koverline
[
ji
])
/
NR_NB_SC_PER_RB
;
int
mprime
=
na
+
kp
+
kpn
;
// sequence index
for
(
int
lp
=
0
;
lp
<=
phy_csi_parms
.
lprime
;
lp
++
)
{
// loop over frequency resource elements within a group
int
l
=
lp
+
phy_csi_parms
.
loverline
[
ji
];
for
(
int
lp
=
0
;
lp
<=
phy_csi_parms
->
lprime
;
lp
++
)
{
// loop over frequency resource elements within a group
int
l
=
lp
+
phy_csi_parms
->
loverline
[
ji
];
// wt according to tables 7.4.5.3-2 to 7.4.5.3-5
int
wt
;
if
(
s
<
2
)
wt
=
1
;
else
if
(
s
<
4
)
wt
=
-
2
*
(
lp
%
2
)
+
1
;
wt
=
-
2
*
(
lp
%
2
)
+
1
;
else
if
(
s
<
6
)
wt
=
-
2
*
(
lp
/
2
)
+
1
;
else
{
...
...
openair1/PHY/NR_UE_TRANSPORT/csi_rx.c
View file @
7e009781
...
...
@@ -177,21 +177,16 @@ bool is_csi_rs_in_symbol(const fapi_nr_dl_config_csirs_pdu_rel15_t csirs_config_
return
ret
;
}
int
nr_get_csi_rs_signal
(
const
PHY_VARS_NR_UE
*
ue
,
const
UE_nr_rxtx_proc_t
*
proc
,
const
fapi_nr_dl_config_csirs_pdu_rel15_t
*
csirs_config_pdu
,
const
nr_csi_info_t
*
nr_csi_info
,
const
uint8_t
N_cdm_groups
,
const
uint8_t
CDM_group_size
,
const
uint8_t
k_prime
,
const
uint8_t
l_prime
,
const
uint8_t
*
j_cdm
,
const
uint8_t
*
k_overline
,
const
uint8_t
*
l_overline
,
int32_t
csi_rs_received_signal
[][
ue
->
frame_parms
.
samples_per_slot_wCP
],
uint32_t
*
rsrp
,
int
*
rsrp_dBm
,
c16_t
rxdataF
[][
ue
->
frame_parms
.
samples_per_slot_wCP
])
static
int
nr_get_csi_rs_signal
(
const
PHY_VARS_NR_UE
*
ue
,
const
UE_nr_rxtx_proc_t
*
proc
,
const
fapi_nr_dl_config_csirs_pdu_rel15_t
*
csirs_config_pdu
,
const
nr_csi_info_t
*
nr_csi_info
,
const
csi_mapping_parms_t
*
csi_mapping
,
const
int
CDM_group_size
,
int32_t
csi_rs_received_signal
[][
ue
->
frame_parms
.
samples_per_slot_wCP
],
uint32_t
*
rsrp
,
int
*
rsrp_dBm
,
c16_t
rxdataF
[][
ue
->
frame_parms
.
samples_per_slot_wCP
])
{
const
NR_DL_FRAME_PARMS
*
fp
=
&
ue
->
frame_parms
;
uint16_t
meas_count
=
0
;
...
...
@@ -206,17 +201,17 @@ int nr_get_csi_rs_signal(const PHY_VARS_NR_UE *ue,
continue
;
}
for
(
int
cdm_id
=
0
;
cdm_id
<
N_cdm_groups
;
cdm_id
++
)
{
for
(
int
cdm_id
=
0
;
cdm_id
<
csi_mapping
->
size
;
cdm_id
++
)
{
for
(
int
s
=
0
;
s
<
CDM_group_size
;
s
++
)
{
// loop over frequency resource elements within a group
for
(
int
kp
=
0
;
kp
<=
k_
prime
;
kp
++
)
{
for
(
int
kp
=
0
;
kp
<=
csi_mapping
->
k
prime
;
kp
++
)
{
uint16_t
k
=
(
fp
->
first_carrier_offset
+
(
rb
*
NR_NB_SC_PER_RB
)
+
k_
overline
[
cdm_id
]
+
kp
)
%
fp
->
ofdm_symbol_size
;
uint16_t
k
=
(
fp
->
first_carrier_offset
+
(
rb
*
NR_NB_SC_PER_RB
)
+
csi_mapping
->
k
overline
[
cdm_id
]
+
kp
)
%
fp
->
ofdm_symbol_size
;
// loop over time resource elements within a group
for
(
int
lp
=
0
;
lp
<=
l_
prime
;
lp
++
)
{
uint16_t
symb
=
lp
+
l_
overline
[
cdm_id
];
for
(
int
lp
=
0
;
lp
<=
csi_mapping
->
l
prime
;
lp
++
)
{
uint16_t
symb
=
lp
+
csi_mapping
->
l
overline
[
cdm_id
];
uint64_t
symbol_offset
=
symb
*
fp
->
ofdm_symbol_size
;
c16_t
*
rx_signal
=
&
rxdataF
[
ant_rx
][
symbol_offset
];
c16_t
*
rx_csi_rs_signal
=
(
c16_t
*
)
&
csi_rs_received_signal
[
ant_rx
][
symbol_offset
];
...
...
@@ -230,7 +225,7 @@ int nr_get_csi_rs_signal(const PHY_VARS_NR_UE *ue,
#ifdef NR_CSIRS_DEBUG
int
dataF_offset
=
proc
->
nr_slot_rx
*
fp
->
samples_per_slot_wCP
;
uint16_t
port_tx
=
s
+
j_cdm
[
cdm_id
]
*
CDM_group_size
;
uint16_t
port_tx
=
s
+
csi_mapping
->
j
[
cdm_id
]
*
CDM_group_size
;
c16_t
*
tx_csi_rs_signal
=
(
c16_t
*
)
&
nr_csi_info
->
csi_rs_generated_signal
[
port_tx
][
symbol_offset
+
dataF_offset
];
LOG_I
(
NR_PHY
,
"l,k (%2d,%4d) |
\t
port_tx %d (%4d,%4d)
\t
ant_rx %d (%4d,%4d)
\n
"
,
...
...
@@ -278,39 +273,32 @@ uint32_t calc_power_csirs(const uint16_t *x, const fapi_nr_dl_config_csirs_pdu_r
return
sum_x2
/
size
-
(
sum_x
/
size
)
*
(
sum_x
/
size
);
}
int
nr_csi_rs_channel_estimation
(
const
PHY_VARS_NR_UE
*
ue
,
const
UE_nr_rxtx_proc_t
*
proc
,
const
fapi_nr_dl_config_csirs_pdu_rel15_t
*
csirs_config_pdu
,
const
nr_csi_info_t
*
nr_csi_info
,
const
int32_t
**
csi_rs_generated_signal
,
const
int32_t
csi_rs_received_signal
[][
ue
->
frame_parms
.
samples_per_slot_wCP
],
const
uint8_t
N_cdm_groups
,
const
uint8_t
CDM_group_size
,
const
uint8_t
k_prime
,
const
uint8_t
l_prime
,
const
uint8_t
N_ports
,
const
uint8_t
*
j_cdm
,
const
uint8_t
*
k_overline
,
const
uint8_t
*
l_overline
,
uint8_t
mem_offset
,
int32_t
csi_rs_ls_estimated_channel
[][
N_ports
][
ue
->
frame_parms
.
ofdm_symbol_size
],
int32_t
csi_rs_estimated_channel_freq
[][
N_ports
][
ue
->
frame_parms
.
ofdm_symbol_size
+
FILTER_MARGIN
],
int16_t
*
log2_re
,
int16_t
*
log2_maxh
,
uint32_t
*
noise_power
)
{
const
NR_DL_FRAME_PARMS
*
frame_parms
=
&
ue
->
frame_parms
;
const
int
dataF_offset
=
proc
->
nr_slot_rx
*
ue
->
frame_parms
.
samples_per_slot_wCP
;
static
int
nr_csi_rs_channel_estimation
(
const
NR_DL_FRAME_PARMS
*
fp
,
const
UE_nr_rxtx_proc_t
*
proc
,
const
fapi_nr_dl_config_csirs_pdu_rel15_t
*
csirs_config_pdu
,
const
nr_csi_info_t
*
nr_csi_info
,
const
int32_t
**
csi_rs_generated_signal
,
const
int32_t
csi_rs_received_signal
[][
fp
->
samples_per_slot_wCP
],
const
csi_mapping_parms_t
*
csi_mapping
,
const
int
CDM_group_size
,
uint8_t
mem_offset
,
int32_t
csi_rs_ls_estimated_channel
[][
csi_mapping
->
ports
][
fp
->
ofdm_symbol_size
],
int32_t
csi_rs_estimated_channel_freq
[][
csi_mapping
->
ports
][
fp
->
ofdm_symbol_size
+
FILTER_MARGIN
],
int16_t
*
log2_re
,
int16_t
*
log2_maxh
,
uint32_t
*
noise_power
)
{
const
int
dataF_offset
=
proc
->
nr_slot_rx
*
fp
->
samples_per_slot_wCP
;
*
noise_power
=
0
;
int
maxh
=
0
;
int
count
=
0
;
for
(
int
ant_rx
=
0
;
ant_rx
<
f
rame_parms
->
nb_antennas_rx
;
ant_rx
++
)
{
for
(
int
ant_rx
=
0
;
ant_rx
<
f
p
->
nb_antennas_rx
;
ant_rx
++
)
{
/// LS channel estimation
for
(
uint16_t
port_tx
=
0
;
port_tx
<
N_
ports
;
port_tx
++
)
{
memset
(
csi_rs_ls_estimated_channel
[
ant_rx
][
port_tx
],
0
,
f
rame_parms
->
ofdm_symbol_size
*
sizeof
(
int32_t
));
for
(
uint16_t
port_tx
=
0
;
port_tx
<
csi_mapping
->
ports
;
port_tx
++
)
{
memset
(
csi_rs_ls_estimated_channel
[
ant_rx
][
port_tx
],
0
,
f
p
->
ofdm_symbol_size
*
sizeof
(
int32_t
));
}
for
(
int
rb
=
csirs_config_pdu
->
start_rb
;
rb
<
(
csirs_config_pdu
->
start_rb
+
csirs_config_pdu
->
nr_of_rbs
);
rb
++
)
{
...
...
@@ -320,21 +308,21 @@ int nr_csi_rs_channel_estimation(const PHY_VARS_NR_UE *ue,
continue
;
}
for
(
int
cdm_id
=
0
;
cdm_id
<
N_cdm_groups
;
cdm_id
++
)
{
for
(
int
cdm_id
=
0
;
cdm_id
<
csi_mapping
->
size
;
cdm_id
++
)
{
for
(
int
s
=
0
;
s
<
CDM_group_size
;
s
++
)
{
uint16_t
port_tx
=
s
+
j_cdm
[
cdm_id
]
*
CDM_group_size
;
uint16_t
port_tx
=
s
+
csi_mapping
->
j
[
cdm_id
]
*
CDM_group_size
;
// loop over frequency resource elements within a group
for
(
int
kp
=
0
;
kp
<=
k_
prime
;
kp
++
)
{
for
(
int
kp
=
0
;
kp
<=
csi_mapping
->
k
prime
;
kp
++
)
{
uint16_t
kinit
=
(
f
rame_parms
->
first_carrier_offset
+
rb
*
NR_NB_SC_PER_RB
)
%
frame_parms
->
ofdm_symbol_size
;
uint16_t
k
=
kinit
+
k_
overline
[
cdm_id
]
+
kp
;
uint16_t
kinit
=
(
f
p
->
first_carrier_offset
+
rb
*
NR_NB_SC_PER_RB
)
%
fp
->
ofdm_symbol_size
;
uint16_t
k
=
kinit
+
csi_mapping
->
k
overline
[
cdm_id
]
+
kp
;
// loop over time resource elements within a group
for
(
int
lp
=
0
;
lp
<=
l_
prime
;
lp
++
)
{
uint16_t
symb
=
lp
+
l_
overline
[
cdm_id
];
uint64_t
symbol_offset
=
symb
*
frame_parms
->
ofdm_symbol_size
;
for
(
int
lp
=
0
;
lp
<=
csi_mapping
->
l
prime
;
lp
++
)
{
uint16_t
symb
=
lp
+
csi_mapping
->
l
overline
[
cdm_id
];
uint64_t
symbol_offset
=
symb
*
fp
->
ofdm_symbol_size
;
c16_t
*
tx_csi_rs_signal
=
(
c16_t
*
)
&
csi_rs_generated_signal
[
port_tx
][
symbol_offset
+
dataF_offset
];
c16_t
*
rx_csi_rs_signal
=
(
c16_t
*
)
&
csi_rs_received_signal
[
ant_rx
][
symbol_offset
];
c16_t
*
csi_rs_ls_estimated_channel16
=
(
c16_t
*
)
&
csi_rs_ls_estimated_channel
[
ant_rx
][
port_tx
][
0
];
...
...
@@ -357,10 +345,10 @@ int nr_csi_rs_channel_estimation(const PHY_VARS_NR_UE *ue,
if
(
!
is_csi_rs_in_symbol
(
*
csirs_config_pdu
,
symb
))
{
continue
;
}
for
(
int
k
=
0
;
k
<
frame_parms
->
ofdm_symbol_size
;
k
++
)
{
for
(
int
k
=
0
;
k
<
fp
->
ofdm_symbol_size
;
k
++
)
{
LOG_I
(
NR_PHY
,
"l,k (%2d,%4d) | "
,
symb
,
k
);
for
(
uint16_t
port_tx
=
0
;
port_tx
<
N_
ports
;
port_tx
++
)
{
uint64_t
symbol_offset
=
symb
*
frame_parms
->
ofdm_symbol_size
;
for
(
uint16_t
port_tx
=
0
;
port_tx
<
csi_mapping
->
ports
;
port_tx
++
)
{
uint64_t
symbol_offset
=
symb
*
fp
->
ofdm_symbol_size
;
c16_t
*
tx_csi_rs_signal
=
(
c16_t
*
)
&
csi_rs_generated_signal
[
port_tx
][
symbol_offset
+
dataF_offset
];
c16_t
*
rx_csi_rs_signal
=
(
c16_t
*
)
&
csi_rs_received_signal
[
ant_rx
][
symbol_offset
];
c16_t
*
csi_rs_ls_estimated_channel16
=
(
c16_t
*
)
&
csi_rs_ls_estimated_channel
[
ant_rx
][
port_tx
][
0
];
...
...
@@ -377,8 +365,8 @@ int nr_csi_rs_channel_estimation(const PHY_VARS_NR_UE *ue,
/// Channel interpolation
for
(
uint16_t
port_tx
=
0
;
port_tx
<
N_
ports
;
port_tx
++
)
{
memset
(
csi_rs_estimated_channel_freq
[
ant_rx
][
port_tx
],
0
,
(
f
rame_parms
->
ofdm_symbol_size
+
FILTER_MARGIN
)
*
sizeof
(
int32_t
));
for
(
uint16_t
port_tx
=
0
;
port_tx
<
csi_mapping
->
ports
;
port_tx
++
)
{
memset
(
csi_rs_estimated_channel_freq
[
ant_rx
][
port_tx
],
0
,
(
f
p
->
ofdm_symbol_size
+
FILTER_MARGIN
)
*
sizeof
(
int32_t
));
}
for
(
int
rb
=
csirs_config_pdu
->
start_rb
;
rb
<
(
csirs_config_pdu
->
start_rb
+
csirs_config_pdu
->
nr_of_rbs
);
rb
++
)
{
...
...
@@ -390,15 +378,15 @@ int nr_csi_rs_channel_estimation(const PHY_VARS_NR_UE *ue,
count
++
;
uint16_t
k
=
(
f
rame_parms
->
first_carrier_offset
+
rb
*
NR_NB_SC_PER_RB
)
%
frame_parms
->
ofdm_symbol_size
;
uint16_t
k
=
(
f
p
->
first_carrier_offset
+
rb
*
NR_NB_SC_PER_RB
)
%
fp
->
ofdm_symbol_size
;
uint16_t
k_offset
=
k
+
mem_offset
;
for
(
uint16_t
port_tx
=
0
;
port_tx
<
N_
ports
;
port_tx
++
)
{
for
(
uint16_t
port_tx
=
0
;
port_tx
<
csi_mapping
->
ports
;
port_tx
++
)
{
int16_t
*
csi_rs_ls_estimated_channel16
=
(
int16_t
*
)
&
csi_rs_ls_estimated_channel
[
ant_rx
][
port_tx
][
k
];
int16_t
*
csi_rs_estimated_channel16
=
(
int16_t
*
)
&
csi_rs_estimated_channel_freq
[
ant_rx
][
port_tx
][
k_offset
];
if
(
(
k
==
0
)
||
(
k
==
f
rame_parms
->
first_carrier_offset
)
)
{
// Start of OFDM symbol case or first occupied subcarrier case
if
(
(
k
==
0
)
||
(
k
==
f
p
->
first_carrier_offset
)
)
{
// Start of OFDM symbol case or first occupied subcarrier case
multadd_real_vector_complex_scalar
(
filt24_start
,
csi_rs_ls_estimated_channel16
,
csi_rs_estimated_channel16
,
24
);
}
else
if
(
(
(
k
+
NR_NB_SC_PER_RB
)
>=
frame_parms
->
ofdm_symbol_size
)
||
(
rb
==
(
csirs_config_pdu
->
start_rb
+
csirs_config_pdu
->
nr_of_rbs
-
1
))
)
{
// End of OFDM symbol case or Last occupied subcarrier case
}
else
if
(
((
k
+
NR_NB_SC_PER_RB
)
>=
fp
->
ofdm_symbol_size
)
||
(
rb
==
(
csirs_config_pdu
->
start_rb
+
csirs_config_pdu
->
nr_of_rbs
-
1
)))
{
// End of OFDM symbol case or Last occupied subcarrier case
multadd_real_vector_complex_scalar
(
filt24_end
,
csi_rs_ls_estimated_channel16
,
csi_rs_estimated_channel16
-
3
*
sizeof
(
uint64_t
),
24
);
}
else
{
// Middle case
multadd_real_vector_complex_scalar
(
filt24_middle
,
csi_rs_ls_estimated_channel16
,
csi_rs_estimated_channel16
-
3
*
sizeof
(
uint64_t
),
24
);
...
...
@@ -408,15 +396,15 @@ int nr_csi_rs_channel_estimation(const PHY_VARS_NR_UE *ue,
/// Power noise estimation
AssertFatal
(
csirs_config_pdu
->
nr_of_rbs
>
0
,
" nr_of_rbs needs to be greater than 0
\n
"
);
uint16_t
noise_real
[
f
rame_parms
->
nb_antennas_rx
][
N_
ports
][
csirs_config_pdu
->
nr_of_rbs
];
uint16_t
noise_imag
[
f
rame_parms
->
nb_antennas_rx
][
N_
ports
][
csirs_config_pdu
->
nr_of_rbs
];
uint16_t
noise_real
[
f
p
->
nb_antennas_rx
][
csi_mapping
->
ports
][
csirs_config_pdu
->
nr_of_rbs
];
uint16_t
noise_imag
[
f
p
->
nb_antennas_rx
][
csi_mapping
->
ports
][
csirs_config_pdu
->
nr_of_rbs
];
for
(
int
rb
=
csirs_config_pdu
->
start_rb
;
rb
<
(
csirs_config_pdu
->
start_rb
+
csirs_config_pdu
->
nr_of_rbs
);
rb
++
)
{
if
(
csirs_config_pdu
->
freq_density
<=
1
&&
csirs_config_pdu
->
freq_density
!=
(
rb
%
2
))
{
continue
;
}
uint16_t
k
=
(
f
rame_parms
->
first_carrier_offset
+
rb
*
NR_NB_SC_PER_RB
)
%
frame_parms
->
ofdm_symbol_size
;
uint16_t
k
=
(
f
p
->
first_carrier_offset
+
rb
*
NR_NB_SC_PER_RB
)
%
fp
->
ofdm_symbol_size
;
uint16_t
k_offset
=
k
+
mem_offset
;
for
(
uint16_t
port_tx
=
0
;
port_tx
<
N_
ports
;
port_tx
++
)
{
for
(
uint16_t
port_tx
=
0
;
port_tx
<
csi_mapping
->
ports
;
port_tx
++
)
{
c16_t
*
csi_rs_ls_estimated_channel16
=
(
c16_t
*
)
&
csi_rs_ls_estimated_channel
[
ant_rx
][
port_tx
][
k
];
c16_t
*
csi_rs_estimated_channel16
=
(
c16_t
*
)
&
csi_rs_estimated_channel_freq
[
ant_rx
][
port_tx
][
k_offset
];
noise_real
[
ant_rx
][
port_tx
][
rb
-
csirs_config_pdu
->
start_rb
]
=
abs
(
csi_rs_ls_estimated_channel16
->
r
-
csi_rs_estimated_channel16
->
r
);
...
...
@@ -424,17 +412,17 @@ int nr_csi_rs_channel_estimation(const PHY_VARS_NR_UE *ue,
maxh
=
cmax3
(
maxh
,
abs
(
csi_rs_estimated_channel16
->
r
),
abs
(
csi_rs_estimated_channel16
->
i
));
}
}
for
(
uint16_t
port_tx
=
0
;
port_tx
<
N_
ports
;
port_tx
++
)
{
for
(
uint16_t
port_tx
=
0
;
port_tx
<
csi_mapping
->
ports
;
port_tx
++
)
{
*
noise_power
+=
(
calc_power_csirs
(
noise_real
[
ant_rx
][
port_tx
],
csirs_config_pdu
)
+
calc_power_csirs
(
noise_imag
[
ant_rx
][
port_tx
],
csirs_config_pdu
));
}
#ifdef NR_CSIRS_DEBUG
for
(
int
k
=
0
;
k
<
frame_parms
->
ofdm_symbol_size
;
k
++
)
{
int
rb
=
k
>=
f
rame_parms
->
first_carrier_offset
?
(
k
-
f
rame_parms
->
first_carrier_offset
)
/
NR_NB_SC_PER_RB
:
(
k
+
f
rame_parms
->
ofdm_symbol_size
-
frame_parms
->
first_carrier_offset
)
/
NR_NB_SC_PER_RB
;
for
(
int
k
=
0
;
k
<
fp
->
ofdm_symbol_size
;
k
++
)
{
int
rb
=
k
>=
f
p
->
first_carrier_offset
?
(
k
-
f
p
->
first_carrier_offset
)
/
NR_NB_SC_PER_RB
:
(
k
+
f
p
->
ofdm_symbol_size
-
fp
->
first_carrier_offset
)
/
NR_NB_SC_PER_RB
;
LOG_I
(
NR_PHY
,
"(k = %4d) |
\t
"
,
k
);
for
(
uint16_t
port_tx
=
0
;
port_tx
<
N_
ports
;
port_tx
++
)
{
for
(
uint16_t
port_tx
=
0
;
port_tx
<
csi_mapping
->
ports
;
port_tx
++
)
{
c16_t
*
csi_rs_ls_estimated_channel16
=
(
c16_t
*
)
&
csi_rs_ls_estimated_channel
[
ant_rx
][
port_tx
][
0
];
c16_t
*
csi_rs_estimated_channel16
=
(
c16_t
*
)
&
csi_rs_estimated_channel_freq
[
ant_rx
][
port_tx
][
mem_offset
];
printf
(
"Channel port_tx %d --> ant_rx %d : ls (%4d,%4d), int (%4d,%4d), noise (%4d,%4d) | "
,
...
...
@@ -450,14 +438,13 @@ int nr_csi_rs_channel_estimation(const PHY_VARS_NR_UE *ue,
}
*
noise_power
/=
(
f
rame_parms
->
nb_antennas_rx
*
N_
ports
);
*
log2_maxh
=
log2_approx
(
maxh
-
1
);
*
log2_re
=
log2_approx
(
count
-
1
);
*
noise_power
/=
(
f
p
->
nb_antennas_rx
*
csi_mapping
->
ports
);
*
log2_maxh
=
log2_approx
(
maxh
-
1
);
*
log2_re
=
log2_approx
(
count
-
1
);
#ifdef NR_CSIRS_DEBUG
LOG_I
(
NR_PHY
,
"Noise power estimation based on CSI-RS: %i
\n
"
,
*
noise_power
);
#endif
return
0
;
}
...
...
@@ -884,14 +871,6 @@ void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue,
const
NR_DL_FRAME_PARMS
*
frame_parms
=
&
ue
->
frame_parms
;
int32_t
csi_rs_received_signal
[
frame_parms
->
nb_antennas_rx
][
frame_parms
->
samples_per_slot_wCP
];
uint8_t
N_cdm_groups
=
0
;
uint8_t
CDM_group_size
=
0
;
uint8_t
k_prime
=
0
;
uint8_t
l_prime
=
0
;
uint8_t
N_ports
=
0
;
uint8_t
j_cdm
[
16
];
uint8_t
k_overline
[
16
];
uint8_t
l_overline
[
16
];
int16_t
log2_re
=
0
;
int16_t
log2_maxh
=
0
;
uint32_t
rsrp
=
0
;
...
...
@@ -903,40 +882,33 @@ void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue,
uint8_t
i1
[
3
]
=
{
0
};
uint8_t
i2
[
1
]
=
{
0
};
nfapi_nr_dl_tti_csi_rs_pdu_rel15_t
csi_params
=
convert_csirs_pdu
(
csirs_config_pdu
);
csi_mapping_parms_t
mapping_parms
=
get_csi_mapping_parms
(
csirs_config_pdu
->
row
,
csirs_config_pdu
->
freq_domain
,
csirs_config_pdu
->
symb_l0
,
csirs_config_pdu
->
symb_l1
);
nr_generate_csi_rs
(
frame_parms
,
ue
->
nr_csi_info
->
csi_rs_generated_signal
,
AMP
,
ue
->
nr_csi_info
,
&
csi_params
,
proc
->
nr_slot_rx
,
&
N_cdm_groups
,
&
CDM_group_size
,
&
k_prime
,
&
l_prime
,
&
N_ports
,
j_cdm
,
k_overline
,
l_overline
);
int32_t
csi_rs_ls_estimated_channel
[
frame_parms
->
nb_antennas_rx
][
N_ports
][
frame_parms
->
ofdm_symbol_size
];
int32_t
csi_rs_estimated_channel_freq
[
frame_parms
->
nb_antennas_rx
][
N_ports
][
frame_parms
->
ofdm_symbol_size
+
FILTER_MARGIN
];
// (long)&csi_rs_estimated_channel_freq[0][0][frame_parms->first_carrier_offset] & 0x1F gives us the remainder of the integer division by 32 of the memory address
&
mapping_parms
);
int32_t
csi_rs_ls_estimated_channel
[
frame_parms
->
nb_antennas_rx
][
mapping_parms
.
ports
][
frame_parms
->
ofdm_symbol_size
];
int32_t
csi_rs_estimated_channel_freq
[
frame_parms
->
nb_antennas_rx
][
mapping_parms
.
ports
][
frame_parms
->
ofdm_symbol_size
+
FILTER_MARGIN
];
// (long)&csi_rs_estimated_channel_freq[0][0][frame_parms->first_carrier_offset] & 0x1F
// gives us the remainder of the integer division by 32 of the memory address
// By subtracting the previous value of 32, we know how much is left to have a multiple of 32.
// Doing >> 2 <=> /sizeof(int32_t), we know what is the index offset of the array.
uint8_t
mem_offset
=
(((
32
-
((
long
)
&
csi_rs_estimated_channel_freq
[
0
][
0
][
frame_parms
->
first_carrier_offset
]))
&
0x1F
)
>>
2
);
int
CDM_group_size
=
get_cdm_group_size
(
csirs_config_pdu
->
cdm_type
);
nr_get_csi_rs_signal
(
ue
,
proc
,
csirs_config_pdu
,
ue
->
nr_csi_info
,
N_cdm_group
s
,
&
mapping_parm
s
,
CDM_group_size
,
k_prime
,
l_prime
,
j_cdm
,
k_overline
,
l_overline
,
csi_rs_received_signal
,
&
rsrp
,
&
rsrp_dBm
,
...
...
@@ -945,20 +917,14 @@ void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue,
// if we need to measure only RSRP no need to do channel estimation
if
(
csirs_config_pdu
->
measurement_bitmap
>
1
)
nr_csi_rs_channel_estimation
(
ue
,
nr_csi_rs_channel_estimation
(
frame_parms
,
proc
,
csirs_config_pdu
,
ue
->
nr_csi_info
,
(
const
int32_t
**
)
ue
->
nr_csi_info
->
csi_rs_generated_signal
,
csi_rs_received_signal
,
N_cdm_group
s
,
&
mapping_parm
s
,
CDM_group_size
,
k_prime
,
l_prime
,
N_ports
,
j_cdm
,
k_overline
,
l_overline
,
mem_offset
,
csi_rs_ls_estimated_channel
,
csi_rs_estimated_channel_freq
,
...
...
@@ -971,7 +937,7 @@ void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue,
nr_csi_rs_ri_estimation
(
ue
,
csirs_config_pdu
,
ue
->
nr_csi_info
,
N_
ports
,
mapping_parms
.
ports
,
mem_offset
,
csi_rs_estimated_channel_freq
,
log2_maxh
,
...
...
@@ -983,7 +949,7 @@ void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue,
nr_csi_rs_pmi_estimation
(
ue
,
csirs_config_pdu
,
ue
->
nr_csi_info
,
N_
ports
,
mapping_parms
.
ports
,
mem_offset
,
csi_rs_estimated_channel_freq
,
ue
->
nr_csi_info
->
csi_im_meas_computed
?
ue
->
nr_csi_info
->
interference_plus_noise_power
:
noise_power
,
...
...
openair1/PHY/nr_phy_common/inc/nr_phy_common.h
View file @
7e009781
...
...
@@ -34,6 +34,7 @@ typedef struct {
int
loverline
[
16
];
}
csi_mapping_parms_t
;
csi_mapping_parms_t
get_csi_mapping_parms
(
int
row
,
int
b
,
int
l0
,
int
l1
);
int
get_cdm_group_size
(
int
cdm_type
);
void
nr_qpsk_llr
(
int32_t
*
rxdataF_comp
,
int16_t
*
llr
,
uint32_t
nb_re
);
void
nr_16qam_llr
(
int32_t
*
rxdataF_comp
,
int32_t
*
ch_mag_in
,
int16_t
*
llr
,
uint32_t
nb_re
);
void
nr_64qam_llr
(
int32_t
*
rxdataF_comp
,
int32_t
*
ch_mag
,
int32_t
*
ch_mag2
,
int16_t
*
llr
,
uint32_t
nb_re
);
...
...
openair1/PHY/nr_phy_common/src/nr_phy_common.c
View file @
7e009781
...
...
@@ -354,6 +354,29 @@ void nr_256qam_llr(int32_t *rxdataF_comp, int32_t *ch_mag, int32_t *ch_mag2, int
simde_mm_empty
();
}
int
get_cdm_group_size
(
int
cdm_type
)
{
// CDM group size from CDM type index
int
gs
=
0
;
switch
(
cdm_type
)
{
case
0
:
gs
=
1
;
break
;
case
1
:
gs
=
2
;
break
;
case
2
:
gs
=
4
;
break
;
case
3
:
gs
=
8
;
break
;
default:
AssertFatal
(
false
,
"Invalid cdm type index for CSI
\n
"
);
}
return
gs
;
}
csi_mapping_parms_t
get_csi_mapping_parms
(
int
row
,
int
b
,
int
l0
,
int
l1
)
{
AssertFatal
(
b
!=
0
,
"Invalid CSI frequency domain mapping: no bit selected in bitmap
\n
"
);
...
...
openair1/SCHED_NR/phy_procedures_nr_gNB.c
View file @
7e009781
...
...
@@ -220,20 +220,17 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
if
(
csirs
->
active
==
1
)
{
LOG_D
(
PHY
,
"CSI-RS generation started in frame %d.%d
\n
"
,
frame
,
slot
);
nfapi_nr_dl_tti_csi_rs_pdu_rel15_t
*
csi_params
=
&
csirs
->
csirs_pdu
.
csi_rs_pdu_rel15
;
csi_mapping_parms_t
mapping_parms
=
get_csi_mapping_parms
(
csi_params
->
row
,
csi_params
->
freq_domain
,
csi_params
->
symb_l0
,
csi_params
->
symb_l1
);
nr_generate_csi_rs
(
&
gNB
->
frame_parms
,
(
int32_t
**
)
gNB
->
common_vars
.
txdataF
,
gNB
->
TX_AMP
,
gNB
->
nr_csi_info
,
csi_params
,
slot
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
&
mapping_parms
);
csirs
->
active
=
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