Use common function to generate CSI-RS signal
The functions nr_generate_csi_rs() and nr_ue_generate_csi_rs() are identical. This commit removes nr_ue_generate_csi_rs() and moves nr_generate_csi_rs() to nr_phy_common_csirs.c so both gNB and UE can use the same function.
This commit is contained in:
@@ -939,7 +939,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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -796,66 +796,6 @@ 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],
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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,
|
||||
int32_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(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)
|
||||
{
|
||||
// resource mapping according to 38.211 7.4.1.5.3
|
||||
for (int n = start_rb; n < (start_rb + nb_rbs); n++) {
|
||||
@@ -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,
|
||||
int32_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,
|
||||
(int32_t **)gNB->common_vars.txdataF[beam_nb]);
|
||||
csirs->active = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user