Merge remote-tracking branch 'origin/csi-generate-common-func' into integration_2025_w20 (!3418)
Use common function to generate CSI-RS signal Remove code duplication.
This commit is contained in:
@@ -951,7 +951,6 @@ set(PHY_SRC_UE
|
||||
${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gen_mod_table.c
|
||||
${OPENAIR1_DIR}/PHY/NR_REFSIG/dmrs_nr.c
|
||||
${OPENAIR1_DIR}/PHY/NR_REFSIG/ptrs_nr.c
|
||||
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_csi_rs.c
|
||||
${OPENAIR1_DIR}/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c
|
||||
${OPENAIR1_DIR}/PHY/NR_ESTIMATION/nr_freq_equalization.c
|
||||
${OPENAIR1_DIR}/PHY/NR_ESTIMATION/nr_measurements_gNB.c
|
||||
|
||||
@@ -261,9 +261,10 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
|
||||
|
||||
// ceil((NB_RB*8(max allocation per RB)*2(QPSK))/32)
|
||||
ue->nr_csi_info = malloc16_clear(sizeof(nr_csi_info_t));
|
||||
ue->nr_csi_info->csi_rs_generated_signal = malloc16(NR_MAX_NB_PORTS * sizeof(int32_t *));
|
||||
ue->nr_csi_info->csi_rs_generated_signal = malloc16(NR_MAX_NB_PORTS * sizeof(*ue->nr_csi_info->csi_rs_generated_signal));
|
||||
for (int i = 0; i < NR_MAX_NB_PORTS; i++) {
|
||||
ue->nr_csi_info->csi_rs_generated_signal[i] = malloc16_clear(fp->samples_per_frame_wCP * sizeof(int32_t));
|
||||
ue->nr_csi_info->csi_rs_generated_signal[i] =
|
||||
malloc16_clear(fp->samples_per_frame_wCP * sizeof(**ue->nr_csi_info->csi_rs_generated_signal));
|
||||
}
|
||||
|
||||
ue->nr_srs_info = malloc16_clear(sizeof(nr_srs_info_t));
|
||||
|
||||
@@ -39,13 +39,6 @@ int nr_pusch_dmrs_rx(PHY_VARS_gNB *gNB,
|
||||
uint8_t dmrs_type,
|
||||
int16_t dmrs_scaling);
|
||||
|
||||
void nr_generate_csi_rs(const NR_DL_FRAME_PARMS *frame_parms,
|
||||
int32_t **dataF,
|
||||
const int16_t amp,
|
||||
const nfapi_nr_dl_tti_csi_rs_pdu_rel15_t *csi_params,
|
||||
const int slot,
|
||||
const csi_mapping_parms_t *phy_csi_parms);
|
||||
|
||||
void nr_generate_modulation_table(void);
|
||||
|
||||
extern simde__m128i byte2m128i[256];
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
#include "PHY/MODULATION/nr_modulation.h"
|
||||
#include "PHY/NR_REFSIG/nr_refsig.h"
|
||||
|
||||
//#define NR_CSIRS_DEBUG
|
||||
|
||||
void nr_generate_csi_rs(const NR_DL_FRAME_PARMS *frame_parms,
|
||||
int32_t **dataF,
|
||||
const int16_t amp,
|
||||
const nfapi_nr_dl_tti_csi_rs_pdu_rel15_t *csi_params,
|
||||
const int slot,
|
||||
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);
|
||||
LOG_I(NR_PHY, "csi_params->cyclic_prefix = %i\n", csi_params->cyclic_prefix);
|
||||
LOG_I(NR_PHY, "csi_params->start_rb = %i\n", csi_params->start_rb);
|
||||
LOG_I(NR_PHY, "csi_params->nr_of_rbs = %i\n", csi_params->nr_of_rbs);
|
||||
LOG_I(NR_PHY, "csi_params->csi_type = %i (0:TRS, 1:CSI-RS NZP, 2:CSI-RS ZP)\n", csi_params->csi_type);
|
||||
LOG_I(NR_PHY, "csi_params->row = %i\n", csi_params->row);
|
||||
LOG_I(NR_PHY, "csi_params->freq_domain = %i\n", csi_params->freq_domain);
|
||||
LOG_I(NR_PHY, "csi_params->symb_l0 = %i\n", csi_params->symb_l0);
|
||||
LOG_I(NR_PHY, "csi_params->symb_l1 = %i\n", csi_params->symb_l1);
|
||||
LOG_I(NR_PHY, "csi_params->cdm_type = %i\n", csi_params->cdm_type);
|
||||
LOG_I(NR_PHY, "csi_params->freq_density = %i (0: dot5 (even RB), 1: dot5 (odd RB), 2: one, 3: three)\n", csi_params->freq_density);
|
||||
LOG_I(NR_PHY, "csi_params->scramb_id = %i\n", csi_params->scramb_id);
|
||||
LOG_I(NR_PHY, "csi_params->power_control_offset = %i\n", csi_params->power_control_offset);
|
||||
LOG_I(NR_PHY, "csi_params->power_control_offset_ss = %i\n", csi_params->power_control_offset_ss);
|
||||
#endif
|
||||
|
||||
// setting the frequency density from its index
|
||||
double rho = get_csi_rho(csi_params->freq_density);
|
||||
int csi_length = get_csi_modulation_length(rho,
|
||||
csi_params->freq_density,
|
||||
phy_csi_parms->kprime,
|
||||
csi_params->start_rb,
|
||||
csi_params->nr_of_rbs);
|
||||
|
||||
#ifdef NR_CSIRS_DEBUG
|
||||
printf(" start rb %d, nr of rbs %d, csi length %d\n", csi_params->start_rb, csi_params->nr_of_rbs, csi_length);
|
||||
#endif
|
||||
|
||||
//*8(max allocation per RB)*2(QPSK))
|
||||
int16_t mod_csi[frame_parms->symbols_per_slot][(frame_parms->N_RB_DL << 4) >> 1] __attribute__((aligned(16)));
|
||||
get_modulated_csi_symbols(frame_parms->symbols_per_slot,
|
||||
slot,
|
||||
frame_parms->N_RB_DL,
|
||||
csi_length,
|
||||
mod_csi,
|
||||
phy_csi_parms->lprime,
|
||||
csi_params->symb_l0,
|
||||
csi_params->symb_l1,
|
||||
csi_params->row,
|
||||
csi_params->scramb_id);
|
||||
|
||||
uint32_t beta = get_csi_beta_amplitude(amp, csi_params->power_control_offset_ss);
|
||||
double alpha = 0;
|
||||
if (phy_csi_parms->ports == 1)
|
||||
alpha = rho;
|
||||
else
|
||||
alpha = 2 * rho;
|
||||
|
||||
#ifdef NR_CSIRS_DEBUG
|
||||
printf(" rho %f, alpha %f\n", rho, alpha);
|
||||
#endif
|
||||
|
||||
// CDM group size from CDM type index
|
||||
int gs = get_cdm_group_size(csi_params->cdm_type);
|
||||
|
||||
int dataF_offset = slot * frame_parms->samples_per_slot_wCP;
|
||||
|
||||
csi_rs_resource_mapping(dataF,
|
||||
frame_parms->N_RB_DL << 4,
|
||||
mod_csi,
|
||||
frame_parms->ofdm_symbol_size,
|
||||
dataF_offset,
|
||||
frame_parms->first_carrier_offset,
|
||||
phy_csi_parms,
|
||||
csi_params->start_rb,
|
||||
csi_params->nr_of_rbs,
|
||||
alpha,
|
||||
beta,
|
||||
rho,
|
||||
gs,
|
||||
csi_params->freq_density);
|
||||
}
|
||||
@@ -173,10 +173,10 @@ static int nr_get_csi_rs_signal(const PHY_VARS_NR_UE *ue,
|
||||
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],
|
||||
c16_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 c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP])
|
||||
{
|
||||
const NR_DL_FRAME_PARMS *fp = &ue->frame_parms;
|
||||
uint16_t meas_count = 0;
|
||||
@@ -203,8 +203,8 @@ static int nr_get_csi_rs_signal(const PHY_VARS_NR_UE *ue,
|
||||
for (int lp = 0; lp <= csi_mapping->lprime; lp++) {
|
||||
uint16_t symb = lp + csi_mapping->loverline[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];
|
||||
const c16_t *rx_signal = &rxdataF[ant_rx][symbol_offset];
|
||||
c16_t *rx_csi_rs_signal = &csi_rs_received_signal[ant_rx][symbol_offset];
|
||||
rx_csi_rs_signal[k].r = rx_signal[k].r;
|
||||
rx_csi_rs_signal[k].i = rx_signal[k].i;
|
||||
|
||||
@@ -216,7 +216,7 @@ static 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 + 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];
|
||||
c16_t *tx_csi_rs_signal = &nr_csi_info->csi_rs_generated_signal[port_tx][symbol_offset + dataF_offset];
|
||||
LOG_I(NR_PHY,
|
||||
"l,k (%2d,%4d) |\tport_tx %d (%4d,%4d)\tant_rx %d (%4d,%4d)\n",
|
||||
symb,
|
||||
@@ -268,8 +268,8 @@ static int nr_csi_rs_channel_estimation(
|
||||
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 c16_t **csi_rs_generated_signal,
|
||||
const c16_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,
|
||||
@@ -314,8 +314,8 @@ static int nr_csi_rs_channel_estimation(
|
||||
for (int lp = 0; lp <= csi_mapping->lprime; lp++) {
|
||||
uint16_t symb = lp + csi_mapping->loverline[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];
|
||||
const c16_t *tx_csi_rs_signal = &csi_rs_generated_signal[port_tx][symbol_offset+dataF_offset];
|
||||
const c16_t *rx_csi_rs_signal = &csi_rs_received_signal[ant_rx][symbol_offset];
|
||||
c16_t tmp = c16MulConjShift(tx_csi_rs_signal[k], rx_csi_rs_signal[k], nr_csi_info->csi_rs_generated_signal_bits);
|
||||
// This is not just the LS estimation for each (k,l), but also the sum of the different contributions
|
||||
// for the sake of optimizing the memory used.
|
||||
@@ -705,7 +705,7 @@ static void nr_csi_im_power_estimation(const PHY_VARS_NR_UE *ue,
|
||||
const UE_nr_rxtx_proc_t *proc,
|
||||
const fapi_nr_dl_config_csiim_pdu_rel15_t *csiim_config_pdu,
|
||||
uint32_t *interference_plus_noise_power,
|
||||
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP])
|
||||
const c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP])
|
||||
{
|
||||
const NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
|
||||
|
||||
@@ -739,7 +739,7 @@ static void nr_csi_im_power_estimation(const PHY_VARS_NR_UE *ue,
|
||||
|
||||
for (int ant_rx = 0; ant_rx < frame_parms->nb_antennas_rx; ant_rx++) {
|
||||
|
||||
c16_t *rx_signal = &rxdataF[ant_rx][symbol_offset];
|
||||
const c16_t *rx_signal = &rxdataF[ant_rx][symbol_offset];
|
||||
|
||||
for (int rb = csiim_config_pdu->start_rb; rb < end_rb; rb++) {
|
||||
|
||||
@@ -778,7 +778,7 @@ static void nr_csi_im_power_estimation(const PHY_VARS_NR_UE *ue,
|
||||
|
||||
void nr_ue_csi_im_procedures(PHY_VARS_NR_UE *ue,
|
||||
const UE_nr_rxtx_proc_t *proc,
|
||||
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP],
|
||||
const c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP],
|
||||
const fapi_nr_dl_config_csiim_pdu_rel15_t *csiim_config_pdu)
|
||||
{
|
||||
|
||||
@@ -796,69 +796,9 @@ void nr_ue_csi_im_procedures(PHY_VARS_NR_UE *ue,
|
||||
ue->nr_csi_info->csi_im_meas_computed = true;
|
||||
}
|
||||
|
||||
static void nr_ue_generate_csi_rs(const fapi_nr_dl_config_csirs_pdu_rel15_t *csi_params,
|
||||
const csi_mapping_parms_t *mapping_parms,
|
||||
const NR_DL_FRAME_PARMS *frame_parms,
|
||||
const int16_t amp,
|
||||
const int slot,
|
||||
int32_t **dataF)
|
||||
{
|
||||
// setting the frequency density from its index
|
||||
double rho = get_csi_rho(csi_params->freq_density);
|
||||
int csi_length = get_csi_modulation_length(rho,
|
||||
csi_params->freq_density,
|
||||
mapping_parms->kprime,
|
||||
csi_params->start_rb,
|
||||
csi_params->nr_of_rbs);
|
||||
|
||||
//*8(max allocation per RB)*2(QPSK))
|
||||
int16_t mod_csi[frame_parms->symbols_per_slot][(frame_parms->N_RB_DL << 4) >> 1] __attribute__((aligned(16)));
|
||||
get_modulated_csi_symbols(frame_parms->symbols_per_slot,
|
||||
slot,
|
||||
frame_parms->N_RB_DL,
|
||||
csi_length,
|
||||
mod_csi,
|
||||
mapping_parms->lprime,
|
||||
csi_params->symb_l0,
|
||||
csi_params->symb_l1,
|
||||
csi_params->row,
|
||||
csi_params->scramb_id);
|
||||
|
||||
uint32_t beta = get_csi_beta_amplitude(amp, csi_params->power_control_offset_ss);
|
||||
double alpha = 0;
|
||||
if (mapping_parms->ports == 1)
|
||||
alpha = rho;
|
||||
else
|
||||
alpha = 2 * rho;
|
||||
|
||||
#ifdef NR_CSIRS_DEBUG
|
||||
printf(" rho %f, alpha %f\n", rho, alpha);
|
||||
#endif
|
||||
|
||||
// CDM group size from CDM type index
|
||||
int gs = get_cdm_group_size(csi_params->cdm_type);
|
||||
|
||||
int dataF_offset = slot * frame_parms->samples_per_slot_wCP;
|
||||
|
||||
csi_rs_resource_mapping(dataF,
|
||||
frame_parms->N_RB_DL << 4,
|
||||
mod_csi,
|
||||
frame_parms->ofdm_symbol_size,
|
||||
dataF_offset,
|
||||
frame_parms->first_carrier_offset,
|
||||
mapping_parms,
|
||||
csi_params->start_rb,
|
||||
csi_params->nr_of_rbs,
|
||||
alpha,
|
||||
beta,
|
||||
rho,
|
||||
gs,
|
||||
csi_params->freq_density);
|
||||
}
|
||||
|
||||
void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue,
|
||||
const UE_nr_rxtx_proc_t *proc,
|
||||
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP],
|
||||
const c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP],
|
||||
fapi_nr_dl_config_csirs_pdu_rel15_t *csirs_config_pdu)
|
||||
{
|
||||
|
||||
@@ -895,12 +835,20 @@ void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue,
|
||||
csirs_config_pdu->symb_l0,
|
||||
csirs_config_pdu->symb_l1);
|
||||
nr_csi_info_t *csi_info = ue->nr_csi_info;
|
||||
nr_ue_generate_csi_rs(csirs_config_pdu,
|
||||
&mapping_parms,
|
||||
frame_parms,
|
||||
AMP,
|
||||
proc->nr_slot_rx,
|
||||
csi_info->csi_rs_generated_signal);
|
||||
nr_generate_csi_rs(frame_parms,
|
||||
&mapping_parms,
|
||||
AMP,
|
||||
proc->nr_slot_rx,
|
||||
csirs_config_pdu->freq_density,
|
||||
csirs_config_pdu->start_rb,
|
||||
csirs_config_pdu->nr_of_rbs,
|
||||
csirs_config_pdu->symb_l0,
|
||||
csirs_config_pdu->symb_l1,
|
||||
csirs_config_pdu->row,
|
||||
csirs_config_pdu->scramb_id,
|
||||
csirs_config_pdu->power_control_offset_ss,
|
||||
csirs_config_pdu->cdm_type,
|
||||
csi_info->csi_rs_generated_signal);
|
||||
|
||||
csi_info->csi_rs_generated_signal_bits = log2_approx(AMP);
|
||||
|
||||
@@ -914,7 +862,7 @@ void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue,
|
||||
// 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);
|
||||
int32_t csi_rs_received_signal[frame_parms->nb_antennas_rx][frame_parms->samples_per_slot_wCP];
|
||||
c16_t csi_rs_received_signal[frame_parms->nb_antennas_rx][frame_parms->samples_per_slot_wCP];
|
||||
uint32_t rsrp = 0;
|
||||
int rsrp_dBm = 0;
|
||||
nr_get_csi_rs_signal(ue,
|
||||
@@ -938,7 +886,7 @@ void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue,
|
||||
proc,
|
||||
csirs_config_pdu,
|
||||
csi_info,
|
||||
(const int32_t **) csi_info->csi_rs_generated_signal,
|
||||
(const c16_t **)csi_info->csi_rs_generated_signal,
|
||||
csi_rs_received_signal,
|
||||
&mapping_parms,
|
||||
CDM_group_size,
|
||||
|
||||
@@ -314,7 +314,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
uint8_t csi_rs_generated_signal_bits;
|
||||
int32_t **csi_rs_generated_signal;
|
||||
c16_t **csi_rs_generated_signal;
|
||||
bool csi_im_meas_computed;
|
||||
uint32_t interference_plus_noise_power;
|
||||
} nr_csi_info_t;
|
||||
|
||||
@@ -44,35 +44,8 @@ typedef struct {
|
||||
int koverline[16];
|
||||
int loverline[16];
|
||||
} csi_mapping_parms_t;
|
||||
void get_modulated_csi_symbols(int symbols_per_slot,
|
||||
int slot,
|
||||
int N_RB_DL,
|
||||
int mod_length,
|
||||
int16_t mod_csi[][(N_RB_DL << 4) >> 1],
|
||||
int lprime,
|
||||
int l0,
|
||||
int l1,
|
||||
int row,
|
||||
int scramb_id);
|
||||
void csi_rs_resource_mapping(int32_t **dataF,
|
||||
int csi_rs_length,
|
||||
int16_t mod_csi[][csi_rs_length >> 1],
|
||||
int ofdm_symbol_size,
|
||||
int dataF_offset,
|
||||
int start_sc,
|
||||
const csi_mapping_parms_t *mapping_parms,
|
||||
int start_rb,
|
||||
int nb_rbs,
|
||||
double alpha,
|
||||
int beta,
|
||||
double rho,
|
||||
int gs,
|
||||
int freq_density);
|
||||
csi_mapping_parms_t get_csi_mapping_parms(int row, int b, int l0, int l1);
|
||||
int get_cdm_group_size(int cdm_type);
|
||||
double get_csi_rho(int freq_density);
|
||||
uint32_t get_csi_beta_amplitude(const int16_t amp, int power_control_offset_ss);
|
||||
int get_csi_modulation_length(double rho, int freq_density, int kprime, int start_rb, int nb_rbs);
|
||||
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);
|
||||
@@ -81,5 +54,19 @@ void freq2time(uint16_t ofdm_symbol_size, int16_t *freq_signal, int16_t *time_si
|
||||
void nr_est_delay(int ofdm_symbol_size, const c16_t *ls_est, c16_t *ch_estimates_time, delay_t *delay);
|
||||
unsigned int nr_get_tx_amp(int power_dBm, int power_max_dBm, int total_nb_rb, int nb_rb);
|
||||
void nr_fo_compensation(double fo_Hz, int samples_per_ms, int sample_offset, const c16_t *rxdata_in, c16_t *rxdata_out, int size);
|
||||
void nr_generate_csi_rs(const NR_DL_FRAME_PARMS *frame_parms,
|
||||
const csi_mapping_parms_t *phy_csi_parms,
|
||||
const int16_t amp,
|
||||
const int slot,
|
||||
const uint8_t freq_density,
|
||||
const uint16_t start_rb,
|
||||
const uint16_t nr_of_rbs,
|
||||
const uint8_t symb_l0,
|
||||
const uint8_t symb_l1,
|
||||
const uint8_t row,
|
||||
const uint16_t scramb_id,
|
||||
const uint8_t power_control_offset_ss,
|
||||
const uint8_t cdm_type,
|
||||
c16_t **dataF);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -21,20 +21,20 @@
|
||||
|
||||
#include "PHY/nr_phy_common/inc/nr_phy_common.h"
|
||||
|
||||
void csi_rs_resource_mapping(int32_t **dataF,
|
||||
int csi_rs_length,
|
||||
int16_t mod_csi[][csi_rs_length >> 1],
|
||||
int ofdm_symbol_size,
|
||||
int dataF_offset,
|
||||
int start_sc,
|
||||
const csi_mapping_parms_t *mapping_parms,
|
||||
int start_rb,
|
||||
int nb_rbs,
|
||||
double alpha,
|
||||
int beta,
|
||||
double rho,
|
||||
int gs,
|
||||
int freq_density)
|
||||
static void csi_rs_resource_mapping(c16_t **dataF,
|
||||
int csi_rs_length,
|
||||
int16_t mod_csi[][csi_rs_length >> 1],
|
||||
int ofdm_symbol_size,
|
||||
int dataF_offset,
|
||||
int start_sc,
|
||||
const csi_mapping_parms_t *mapping_parms,
|
||||
int start_rb,
|
||||
int nb_rbs,
|
||||
double alpha,
|
||||
int beta,
|
||||
double rho,
|
||||
int gs,
|
||||
int freq_density)
|
||||
{
|
||||
// resource mapping according to 38.211 7.4.1.5.3
|
||||
for (int n = start_rb; n < (start_rb + nb_rbs); n++) {
|
||||
@@ -66,17 +66,17 @@ void csi_rs_resource_mapping(int32_t **dataF,
|
||||
else
|
||||
wt = -1;
|
||||
}
|
||||
int index = ((l * ofdm_symbol_size + k) << 1) + (2 * dataF_offset);
|
||||
((int16_t*)dataF[p])[index] = (beta * wt * wf * mod_csi[l][mprime << 1]) >> 15;
|
||||
((int16_t*)dataF[p])[index + 1] = (beta * wt * wf * mod_csi[l][(mprime << 1) + 1]) >> 15;
|
||||
int index = (l * ofdm_symbol_size + k) + dataF_offset;
|
||||
dataF[p][index].r = (beta * wt * wf * mod_csi[l][mprime << 1]) >> 15;
|
||||
dataF[p][index].i = (beta * wt * wf * mod_csi[l][(mprime << 1) + 1]) >> 15;
|
||||
LOG_D(PHY,
|
||||
"l,k (%d,%d) seq. index %d \t port %d \t (%d,%d)\n",
|
||||
l,
|
||||
k,
|
||||
mprime,
|
||||
p + 3000,
|
||||
((int16_t*)dataF[p])[index],
|
||||
((int16_t*)dataF[p])[index + 1]);
|
||||
dataF[p][index].r,
|
||||
dataF[p][index].i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -85,16 +85,16 @@ void csi_rs_resource_mapping(int32_t **dataF,
|
||||
}
|
||||
}
|
||||
|
||||
void get_modulated_csi_symbols(int symbols_per_slot,
|
||||
int slot,
|
||||
int N_RB_DL,
|
||||
int mod_length,
|
||||
int16_t mod_csi[][(N_RB_DL << 4) >> 1],
|
||||
int lprime,
|
||||
int l0,
|
||||
int l1,
|
||||
int row,
|
||||
int scramb_id)
|
||||
static void get_modulated_csi_symbols(int symbols_per_slot,
|
||||
int slot,
|
||||
int N_RB_DL,
|
||||
int mod_length,
|
||||
int16_t mod_csi[][(N_RB_DL << 4) >> 1],
|
||||
int lprime,
|
||||
int l0,
|
||||
int l1,
|
||||
int row,
|
||||
int scramb_id)
|
||||
{
|
||||
for (int lp = 0; lp <= lprime; lp++) {
|
||||
int symb = l0;
|
||||
@@ -120,7 +120,7 @@ void get_modulated_csi_symbols(int symbols_per_slot,
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t get_csi_beta_amplitude(const int16_t amp, int power_control_offset_ss)
|
||||
static uint32_t get_csi_beta_amplitude(const int16_t amp, int power_control_offset_ss)
|
||||
{
|
||||
uint32_t beta = amp;
|
||||
// assuming amp is the amplitude of SSB channels
|
||||
@@ -143,7 +143,7 @@ uint32_t get_csi_beta_amplitude(const int16_t amp, int power_control_offset_ss)
|
||||
return beta;
|
||||
}
|
||||
|
||||
int get_csi_modulation_length(double rho, int freq_density, int kprime, int start_rb, int nr_rbs)
|
||||
static int get_csi_modulation_length(double rho, int freq_density, int kprime, int start_rb, int nr_rbs)
|
||||
{
|
||||
int csi_length = 0;
|
||||
if (rho < 1) {
|
||||
@@ -158,7 +158,7 @@ int get_csi_modulation_length(double rho, int freq_density, int kprime, int star
|
||||
return csi_length;
|
||||
}
|
||||
|
||||
double get_csi_rho(int freq_density)
|
||||
static double get_csi_rho(int freq_density)
|
||||
{
|
||||
// setting the frequency density from its index
|
||||
double rho = 0;
|
||||
@@ -561,3 +561,81 @@ csi_mapping_parms_t get_csi_mapping_parms(int row, int b, int l0, int l1)
|
||||
return csi_parms;
|
||||
}
|
||||
|
||||
void nr_generate_csi_rs(const NR_DL_FRAME_PARMS *frame_parms,
|
||||
const csi_mapping_parms_t *phy_csi_parms,
|
||||
const int16_t amp,
|
||||
const int slot,
|
||||
const uint8_t freq_density,
|
||||
const uint16_t start_rb,
|
||||
const uint16_t nr_of_rbs,
|
||||
const uint8_t symb_l0,
|
||||
const uint8_t symb_l1,
|
||||
const uint8_t row,
|
||||
const uint16_t scramb_id,
|
||||
const uint8_t power_control_offset_ss,
|
||||
const uint8_t cdm_type,
|
||||
c16_t **dataF)
|
||||
{
|
||||
#ifdef NR_CSIRS_DEBUG
|
||||
LOG_I(NR_PHY,
|
||||
"CSI Params: start_rb = %i, nr_of_rbs = %i, row = %i, symb_l0 = %i, symb_l1 = %i, cdm_type = %i, freq_density = %i (0: "
|
||||
"dot5 (even RB), 1: dot5 (odd RB), 2: one, 3: three), scramb_id = %i, power_control_offset_ss = %i\n",
|
||||
start_rb,
|
||||
nr_of_rbs,
|
||||
row,
|
||||
symb_l0,
|
||||
symb_l1,
|
||||
cdm_type,
|
||||
freq_density,
|
||||
scramb_id,
|
||||
power_control_offset_ss);
|
||||
#endif
|
||||
|
||||
// setting the frequency density from its index
|
||||
const double rho = get_csi_rho(freq_density);
|
||||
const int csi_length = get_csi_modulation_length(rho, freq_density, phy_csi_parms->kprime, start_rb, nr_of_rbs);
|
||||
|
||||
#ifdef NR_CSIRS_DEBUG
|
||||
printf(" start rb %d, nr of rbs %d, csi length %d\n", start_rb, nr_of_rbs, csi_length);
|
||||
#endif
|
||||
|
||||
//*8(max allocation per RB)*2(QPSK))
|
||||
int16_t mod_csi[frame_parms->symbols_per_slot][(frame_parms->N_RB_DL << 4) >> 1] __attribute__((aligned(16)));
|
||||
get_modulated_csi_symbols(frame_parms->symbols_per_slot,
|
||||
slot,
|
||||
frame_parms->N_RB_DL,
|
||||
csi_length,
|
||||
mod_csi,
|
||||
phy_csi_parms->lprime,
|
||||
symb_l0,
|
||||
symb_l1,
|
||||
row,
|
||||
scramb_id);
|
||||
|
||||
const uint32_t beta = get_csi_beta_amplitude(amp, power_control_offset_ss);
|
||||
const double alpha = (phy_csi_parms->ports == 1) ? rho : 2 * rho;
|
||||
|
||||
#ifdef NR_CSIRS_DEBUG
|
||||
printf(" rho %f, alpha %f\n", rho, alpha);
|
||||
#endif
|
||||
|
||||
// CDM group size from CDM type index
|
||||
const int gs = get_cdm_group_size(cdm_type);
|
||||
|
||||
const int dataF_offset = slot * frame_parms->samples_per_slot_wCP;
|
||||
|
||||
csi_rs_resource_mapping(dataF,
|
||||
frame_parms->N_RB_DL << 4,
|
||||
mod_csi,
|
||||
frame_parms->ofdm_symbol_size,
|
||||
dataF_offset,
|
||||
frame_parms->first_carrier_offset,
|
||||
phy_csi_parms,
|
||||
start_rb,
|
||||
nr_of_rbs,
|
||||
alpha,
|
||||
beta,
|
||||
rho,
|
||||
gs,
|
||||
freq_density);
|
||||
}
|
||||
|
||||
@@ -279,11 +279,19 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
|
||||
csi_bitmap);
|
||||
|
||||
nr_generate_csi_rs(&gNB->frame_parms,
|
||||
(int32_t **)gNB->common_vars.txdataF[beam_nb],
|
||||
&mapping_parms,
|
||||
gNB->TX_AMP,
|
||||
csi_params,
|
||||
slot,
|
||||
&mapping_parms);
|
||||
csi_params->freq_density,
|
||||
csi_params->start_rb,
|
||||
csi_params->nr_of_rbs,
|
||||
csi_params->symb_l0,
|
||||
csi_params->symb_l1,
|
||||
csi_params->row,
|
||||
csi_params->scramb_id,
|
||||
csi_params->power_control_offset_ss,
|
||||
csi_params->cdm_type,
|
||||
gNB->common_vars.txdataF[beam_nb]);
|
||||
csirs->active = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,12 +147,12 @@ int nr_ue_pdcch_procedures(PHY_VARS_NR_UE *ue,
|
||||
|
||||
void nr_ue_csi_im_procedures(PHY_VARS_NR_UE *ue,
|
||||
const UE_nr_rxtx_proc_t *proc,
|
||||
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP],
|
||||
const c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP],
|
||||
const fapi_nr_dl_config_csiim_pdu_rel15_t *csiim_config_pdu);
|
||||
|
||||
void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue,
|
||||
const UE_nr_rxtx_proc_t *proc,
|
||||
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP],
|
||||
const c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP],
|
||||
fapi_nr_dl_config_csirs_pdu_rel15_t *csirs_config_pdu);
|
||||
|
||||
int psbch_pscch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_data_t *phy_data);
|
||||
|
||||
Reference in New Issue
Block a user