Merge remote-tracking branch 'origin/NR_gNB_BF_matrix' into integration_2024_w41
This commit is contained in:
+42
-27
@@ -41,7 +41,6 @@
|
||||
#include "SCHED_NR/fapi_nr_l1.h"
|
||||
#include "PHY/NR_REFSIG/ul_ref_seq_nr.h"
|
||||
|
||||
|
||||
int l1_north_init_gNB() {
|
||||
|
||||
if (RC.nb_nr_L1_inst > 0 && RC.gNB != NULL) {
|
||||
@@ -104,7 +103,7 @@ void reset_active_stats(PHY_VARS_gNB *gNB, int frame)
|
||||
// A global var to reduce the changes size
|
||||
ldpc_interface_t ldpc_interface = {0}, ldpc_interface_offload = {0};
|
||||
|
||||
int phy_init_nr_gNB(PHY_VARS_gNB *gNB)
|
||||
void phy_init_nr_gNB(PHY_VARS_gNB *gNB)
|
||||
{
|
||||
// shortcuts
|
||||
NR_DL_FRAME_PARMS *const fp = &gNB->frame_parms;
|
||||
@@ -112,16 +111,24 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB)
|
||||
NR_gNB_COMMON *const common_vars = &gNB->common_vars;
|
||||
NR_gNB_PRACH *const prach_vars = &gNB->prach_vars;
|
||||
|
||||
int i;
|
||||
int Ptx=cfg->carrier_config.num_tx_ant.value;
|
||||
int Prx=cfg->carrier_config.num_rx_ant.value;
|
||||
common_vars->analog_bf = cfg->analog_beamforming_ve.analog_bf_vendor_ext.value;
|
||||
LOG_I(PHY, "L1 configured with%s analog beamforming\n", common_vars->analog_bf ? "" : "out");
|
||||
if (common_vars->analog_bf) {
|
||||
common_vars->num_beams_period = cfg->analog_beamforming_ve.num_beams_period_vendor_ext.value;
|
||||
LOG_I(PHY, "Max number of concurrent beams: %d\n", common_vars->num_beams_period);
|
||||
} else
|
||||
common_vars->num_beams_period = 1;
|
||||
|
||||
int Ptx = cfg->carrier_config.num_tx_ant.value;
|
||||
int Prx = cfg->carrier_config.num_rx_ant.value;
|
||||
int max_ul_mimo_layers = 4;
|
||||
|
||||
AssertFatal(Ptx>0 && Ptx<9,"Ptx %d is not supported\n",Ptx);
|
||||
AssertFatal(Prx>0 && Prx<9,"Prx %d is not supported\n",Prx);
|
||||
LOG_I(PHY,"[gNB %d] %s() About to wait for gNB to be configured\n", gNB->Mod_id, __FUNCTION__);
|
||||
AssertFatal(Ptx > 0 && Ptx < 9,"Ptx %d is not supported\n", Ptx);
|
||||
AssertFatal(Prx > 0 && Prx < 9,"Prx %d is not supported\n", Prx);
|
||||
LOG_I(PHY, "[gNB %d]About to wait for gNB to be configured\n", gNB->Mod_id);
|
||||
|
||||
while(gNB->configured == 0) usleep(10000);
|
||||
while(gNB->configured == 0)
|
||||
usleep(10000);
|
||||
|
||||
load_dftslib();
|
||||
|
||||
@@ -168,19 +175,23 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB)
|
||||
}
|
||||
}
|
||||
|
||||
common_vars->txdataF = (c16_t **)malloc16(Ptx*sizeof(c16_t*));
|
||||
common_vars->rxdataF = (c16_t **)malloc16(Prx*sizeof(c16_t*));
|
||||
/* Do NOT allocate per-antenna txdataF/rxdataF: the gNB gets a pointer to the
|
||||
/* Do NOT allocate per-antenna rxdataF: the gNB gets a pointer to the
|
||||
* RU to copy/recover freq-domain memory from there */
|
||||
common_vars->beam_id = (uint8_t **)malloc16(Ptx*sizeof(uint8_t*));
|
||||
common_vars->rxdataF = (c16_t ***)malloc16(common_vars->num_beams_period * sizeof(c16_t**));
|
||||
for (int i = 0; i < common_vars->num_beams_period; i++)
|
||||
common_vars->rxdataF[i] = (c16_t **)malloc16(Prx * sizeof(c16_t*));
|
||||
|
||||
for (i=0;i<Ptx;i++){
|
||||
common_vars->txdataF[i] = (c16_t*)malloc16_clear(fp->samples_per_frame_wCP*sizeof(c16_t)); // [hna] samples_per_frame without CP
|
||||
LOG_D(PHY,"[INIT] common_vars->txdataF[%d] = %p (%lu bytes)\n",
|
||||
i,common_vars->txdataF[i],
|
||||
fp->samples_per_frame_wCP*sizeof(c16_t));
|
||||
common_vars->beam_id[i] = (uint8_t*)malloc16_clear(fp->symbols_per_slot*fp->slots_per_frame*sizeof(uint8_t));
|
||||
memset(common_vars->beam_id[i],255,fp->symbols_per_slot*fp->slots_per_frame);
|
||||
common_vars->num_beams = cfg->dbt_config.num_dig_beams;
|
||||
if (common_vars->num_beams > 0) {
|
||||
common_vars->beam_id = (int **)malloc16(common_vars->num_beams_period * sizeof(int*));
|
||||
for (int i = 0; i < common_vars->num_beams_period; i++)
|
||||
common_vars->beam_id[i] = (int*)malloc16_clear(fp->symbols_per_slot * fp->slots_per_frame * sizeof(int));
|
||||
}
|
||||
common_vars->txdataF = (c16_t ***)malloc16(common_vars->num_beams_period * sizeof(c16_t**));
|
||||
for (int i = 0; i < common_vars->num_beams_period; i++) {
|
||||
common_vars->txdataF[i] = (c16_t**)malloc16_clear(Ptx * sizeof(c16_t*));
|
||||
for (int j = 0; j < Ptx; j++)
|
||||
common_vars->txdataF[i][j] = (c16_t*)malloc16_clear(fp->samples_per_frame_wCP * sizeof(c16_t));
|
||||
}
|
||||
common_vars->debugBuff = (int32_t*)malloc16_clear(fp->samples_per_frame*sizeof(int32_t)*100);
|
||||
common_vars->debugBuff_sample_offset = 0;
|
||||
@@ -205,14 +216,14 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB)
|
||||
pusch->ul_ch_estimates_time = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
|
||||
pusch->rxdataF_comp = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
|
||||
pusch->llr_layers = (int16_t **)malloc16(max_ul_mimo_layers * sizeof(int32_t *));
|
||||
for (i = 0; i < n_buf; i++) {
|
||||
for (int i = 0; i < n_buf; i++) {
|
||||
pusch->ul_ch_estimates[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * fp->ofdm_symbol_size * fp->symbols_per_slot);
|
||||
pusch->ul_ch_estimates_time[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * fp->ofdm_symbol_size);
|
||||
pusch->ptrs_phase_per_slot[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * fp->symbols_per_slot); // symbols per slot
|
||||
pusch->rxdataF_comp[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * fp->symbols_per_slot);
|
||||
}
|
||||
|
||||
for (i=0; i< max_ul_mimo_layers; i++) {
|
||||
for (int i = 0; i < max_ul_mimo_layers; i++) {
|
||||
pusch->llr_layers[i] = (int16_t *)malloc16_clear((8 * ((3 * 8 * 6144) + 12))
|
||||
* sizeof(int16_t)); // [hna] 6144 is LTE and (8*((3*8*6144)+12)) is not clear
|
||||
}
|
||||
@@ -220,8 +231,6 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB)
|
||||
* sizeof(int16_t)); // [hna] 6144 is LTE and (8*((3*8*6144)+12)) is not clear
|
||||
pusch->ul_valid_re_per_slot = (int16_t *)malloc16_clear(sizeof(int16_t) * fp->symbols_per_slot);
|
||||
} // ulsch_id
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
|
||||
@@ -252,13 +261,19 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
|
||||
reset_nr_transport(gNB);
|
||||
|
||||
NR_gNB_COMMON * common_vars = &gNB->common_vars;
|
||||
for (int i = 0; i < Ptx; i++) {
|
||||
free_and_zero(common_vars->txdataF[i]);
|
||||
free_and_zero(common_vars->beam_id[i]);
|
||||
for (int j = 0; j < common_vars->num_beams_period; j++) {
|
||||
if (common_vars->beam_id)
|
||||
free_and_zero(common_vars->beam_id[j]);
|
||||
for (int i = 0; i < Ptx; i++) {
|
||||
free_and_zero(common_vars->txdataF[j][i]);
|
||||
}
|
||||
free_and_zero(common_vars->txdataF[j]);
|
||||
}
|
||||
|
||||
/* Do NOT free per-antenna txdataF/rxdataF: the gNB gets a pointer to the
|
||||
* RU's txdataF/rxdataF, and the RU will free that */
|
||||
for (int j = 0; j < common_vars->num_beams_period; j++)
|
||||
free_and_zero(common_vars->rxdataF[j]);
|
||||
free_and_zero(common_vars->txdataF);
|
||||
free_and_zero(common_vars->rxdataF);
|
||||
free_and_zero(common_vars->beam_id);
|
||||
|
||||
@@ -29,31 +29,35 @@
|
||||
|
||||
void init_prach_ru_list(RU_t *ru);
|
||||
|
||||
int nr_phy_init_RU(RU_t *ru) {
|
||||
|
||||
int nr_phy_init_RU(RU_t *ru)
|
||||
{
|
||||
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
|
||||
int i,j;
|
||||
int p;
|
||||
int re;
|
||||
|
||||
LOG_I(PHY,"Initializing RU signal buffers (if_south %s) nb_tx %d, nb_rx %d\n",ru_if_types[ru->if_south],ru->nb_tx, ru->nb_rx);
|
||||
|
||||
nfapi_nr_config_request_scf_t *cfg;
|
||||
ru->nb_log_antennas=0;
|
||||
for (int n=0;n<ru->num_gNB;n++) {
|
||||
cfg = &ru->config;
|
||||
if (cfg->carrier_config.num_tx_ant.value > ru->nb_log_antennas) ru->nb_log_antennas = cfg->carrier_config.num_tx_ant.value;
|
||||
nfapi_nr_config_request_scf_t *cfg = &ru->config;
|
||||
ru->nb_log_antennas = 0;
|
||||
for (int n = 0; n < ru->num_gNB; n++) {
|
||||
if (cfg->carrier_config.num_tx_ant.value > ru->nb_log_antennas)
|
||||
ru->nb_log_antennas = cfg->carrier_config.num_tx_ant.value;
|
||||
}
|
||||
// copy configuration from gNB[0] in to RU, assume that all gNB instances sharing RU use the same configuration (at least the parts that are needed by the RU, numerology and PRACH)
|
||||
|
||||
// copy configuration from gNB[0] in to RU, assume that all gNB instances sharing RU use the same configuration
|
||||
// (at least the parts that are needed by the RU, numerology and PRACH)
|
||||
|
||||
AssertFatal(ru->nb_log_antennas > 0 && ru->nb_log_antennas < 13, "ru->nb_log_antennas %d ! \n",ru->nb_log_antennas);
|
||||
|
||||
ru->common.beam_id = malloc16_clear(MAX_NUM_BEAM_PERIODS * sizeof(int*));
|
||||
for(int i = 0; i < MAX_NUM_BEAM_PERIODS; i++)
|
||||
ru->common.beam_id[i] = malloc16_clear(fp->symbols_per_slot * fp->slots_per_frame * sizeof(int));
|
||||
|
||||
if (ru->if_south <= REMOTE_IF5) { // this means REMOTE_IF5 or LOCAL_RF, so allocate memory for time-domain signals
|
||||
// Time-domain signals
|
||||
ru->common.txdata = (int32_t**)malloc16(ru->nb_tx*sizeof(int32_t*));
|
||||
ru->common.rxdata = (int32_t**)malloc16(ru->nb_rx*sizeof(int32_t*) );
|
||||
|
||||
|
||||
for (i=0; i<ru->nb_tx; i++) {
|
||||
for (int i = 0; i < ru->nb_tx; i++) {
|
||||
// Allocate 10 subframes of I/Q TX signal data (time) if not
|
||||
ru->common.txdata[i] = (int32_t*)malloc16_clear((ru->sf_extension + fp->samples_per_frame)*sizeof(int32_t));
|
||||
LOG_I(PHY,"[INIT] common.txdata[%d] = %p (%lu bytes,sf_extension %d)\n",i,ru->common.txdata[i],
|
||||
@@ -63,7 +67,7 @@ int nr_phy_init_RU(RU_t *ru) {
|
||||
LOG_I(PHY,"[INIT] common.txdata[%d] = %p \n",i,ru->common.txdata[i]);
|
||||
|
||||
}
|
||||
for (i=0;i<ru->nb_rx;i++) {
|
||||
for (int i = 0; i < ru->nb_rx; i++) {
|
||||
ru->common.rxdata[i] = (int32_t*)malloc16_clear( fp->samples_per_frame*sizeof(int32_t) );
|
||||
}
|
||||
} // IF5 or local RF
|
||||
@@ -76,7 +80,7 @@ int nr_phy_init_RU(RU_t *ru) {
|
||||
if (ru->function != NGFI_RRU_IF5) { // we need to do RX/TX RU processing
|
||||
LOG_I(PHY,"nb_tx %d\n",ru->nb_tx);
|
||||
ru->common.rxdata_7_5kHz = (int32_t**)malloc16(ru->nb_rx*sizeof(int32_t*) );
|
||||
for (i=0;i<ru->nb_rx;i++) {
|
||||
for (int i = 0; i < ru->nb_rx; i++) {
|
||||
ru->common.rxdata_7_5kHz[i] = (int32_t*)malloc16_clear( 2*fp->samples_per_subframe*2*sizeof(int32_t) );
|
||||
LOG_I(PHY,"rxdata_7_5kHz[%d] %p for RU %d\n",i,ru->common.rxdata_7_5kHz[i],ru->idx);
|
||||
}
|
||||
@@ -84,31 +88,33 @@ int nr_phy_init_RU(RU_t *ru) {
|
||||
|
||||
// allocate precoding input buffers (TX)
|
||||
ru->common.txdataF = (int32_t **)malloc16(ru->nb_tx*sizeof(int32_t*));
|
||||
for(i=0; i< ru->nb_tx; ++i) ru->common.txdataF[i] = (int32_t*)malloc16_clear(fp->samples_per_frame_wCP*sizeof(int32_t)); // [hna] samples_per_frame without CP
|
||||
// [hna] samples_per_frame without CP
|
||||
for(int i = 0; i < ru->nb_tx; ++i)
|
||||
ru->common.txdataF[i] = (int32_t*)malloc16_clear(fp->samples_per_frame_wCP * sizeof(int32_t));
|
||||
|
||||
// allocate IFFT input buffers (TX)
|
||||
ru->common.txdataF_BF = (int32_t **)malloc16(ru->nb_tx*sizeof(int32_t*));
|
||||
LOG_I(PHY,"[INIT] common.txdata_BF= %p (%lu bytes)\n",ru->common.txdataF_BF,
|
||||
ru->nb_tx*sizeof(int32_t*));
|
||||
for (i=0; i<ru->nb_tx; i++) {
|
||||
LOG_I(PHY,"[INIT] common.txdata_BF= %p (%lu bytes)\n", ru->common.txdataF_BF, ru->nb_tx*sizeof(int32_t*));
|
||||
for (int i = 0; i < ru->nb_tx; i++) {
|
||||
ru->common.txdataF_BF[i] = (int32_t*)malloc16_clear(fp->samples_per_subframe_wCP*sizeof(int32_t) );
|
||||
LOG_I(PHY,"txdataF_BF[%d] %p for RU %d\n",i,ru->common.txdataF_BF[i],ru->idx);
|
||||
}
|
||||
// allocate FFT output buffers (RX)
|
||||
ru->common.rxdataF = (int32_t**)malloc16(ru->nb_rx*sizeof(int32_t*) );
|
||||
for (i=0; i<ru->nb_rx; i++) {
|
||||
for (int i = 0; i < ru->nb_rx; i++) {
|
||||
// allocate 4 slots of I/Q signal data (frequency)
|
||||
ru->common.rxdataF[i] = (int32_t*)malloc16_clear(sizeof(**ru->common.rxdataF)*(RU_RX_SLOT_DEPTH*fp->symbols_per_slot*fp->ofdm_symbol_size) );
|
||||
int size = RU_RX_SLOT_DEPTH * fp->symbols_per_slot * fp->ofdm_symbol_size;
|
||||
ru->common.rxdataF[i] = (int32_t*)malloc16_clear(sizeof(**ru->common.rxdataF) * size);
|
||||
LOG_I(PHY,"rxdataF[%d] %p for RU %d\n",i,ru->common.rxdataF[i],ru->idx);
|
||||
}
|
||||
|
||||
/* number of elements of an array X is computed as sizeof(X) / sizeof(X[0]) */
|
||||
// AssertFatal(ru->nb_rx <= sizeof(ru->prach_rxsigF) / sizeof(ru->prach_rxsigF[0]),
|
||||
// "nb_antennas_rx too large");
|
||||
for (j=0;j<NUMBER_OF_NR_RU_PRACH_OCCASIONS_MAX;j++) {
|
||||
for (int j = 0; j < NUMBER_OF_NR_RU_PRACH_OCCASIONS_MAX; j++) {
|
||||
ru->prach_rxsigF[j] = (int16_t**)malloc(ru->nb_rx * sizeof(int16_t*));
|
||||
|
||||
for (i=0; i<ru->nb_rx; i++) {
|
||||
for (int i = 0; i < ru->nb_rx; i++) {
|
||||
// largest size for PRACH FFT is 4x98304 (16*24576)
|
||||
ru->prach_rxsigF[j][i] = (int16_t*)malloc16_clear( 4*98304*2*sizeof(int16_t) );
|
||||
LOG_D(PHY,"[INIT] prach_vars->rxsigF[%d] = %p\n",i,ru->prach_rxsigF[j][i]);
|
||||
@@ -120,44 +126,8 @@ int nr_phy_init_RU(RU_t *ru) {
|
||||
|
||||
LOG_I(PHY,"[INIT] %s() ru->num_gNB:%d \n", __FUNCTION__, ru->num_gNB);
|
||||
|
||||
if (ru->do_precoding == 1) {
|
||||
int beam_count = 0;
|
||||
if (ru->nb_tx>1) { //Enable beamforming when nb_tx > 1
|
||||
|
||||
for (p=0;p<ru->nb_log_antennas;p++) {
|
||||
//if ((fp->L_ssb >> (63-p)) & 0x01)//64 bit-map with the MSB @2⁶³ corresponds to SSB ssb_index 0
|
||||
beam_count++;
|
||||
}
|
||||
AssertFatal(ru->nb_bfw==(beam_count*ru->nb_tx),"Number of beam weights from config file is %d while the expected number is %d",ru->nb_bfw,(beam_count*ru->nb_tx));
|
||||
|
||||
for (i=0; i<ru->num_gNB; i++) {
|
||||
int l_ind = 0;
|
||||
for (p=0;p<ru->nb_log_antennas;p++) {
|
||||
//if ((fp->L_ssb >> (63-p)) & 0x01) {
|
||||
ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*));
|
||||
for (j=0; j<ru->nb_tx; j++) {
|
||||
ru->beam_weights[i][p][j] = (int32_t *)malloc16_clear(fp->ofdm_symbol_size*sizeof(int32_t));
|
||||
AssertFatal(ru->bw_list[i],"ru->bw_list[%d] is null\n",i);
|
||||
for (re=0; re<fp->ofdm_symbol_size; re++)
|
||||
ru->beam_weights[i][p][j][re] = ru->bw_list[i][l_ind];
|
||||
//printf("Beam Weight %08x for beam %d and tx %d\n",ru->bw_list[i][l_ind],p,j);
|
||||
l_ind++;
|
||||
} // for j
|
||||
//}
|
||||
} // for p
|
||||
} // for i
|
||||
}
|
||||
|
||||
ru->common.beam_id = (uint8_t**)malloc16_clear(ru->nb_tx*sizeof(uint8_t*));
|
||||
for(i=0; i< ru->nb_tx; ++i) {
|
||||
ru->common.beam_id[i] = (uint8_t*)malloc16_clear(fp->symbols_per_slot*fp->slots_per_frame*sizeof(uint8_t));
|
||||
memset(ru->common.beam_id[i],255,fp->symbols_per_slot*fp->slots_per_frame);
|
||||
}
|
||||
}
|
||||
} // !=IF5
|
||||
|
||||
ru->common.sync_corr = (uint32_t*)malloc16_clear( LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*sizeof(uint32_t)*fp->samples_per_subframe_wCP );
|
||||
|
||||
init_prach_ru_list(ru);
|
||||
|
||||
return(0);
|
||||
@@ -165,56 +135,48 @@ int nr_phy_init_RU(RU_t *ru) {
|
||||
|
||||
void nr_phy_free_RU(RU_t *ru)
|
||||
{
|
||||
int i,j;
|
||||
int p;
|
||||
|
||||
LOG_I(PHY, "Freeing RU signal buffers (if_south %s) nb_tx %d\n", ru_if_types[ru->if_south], ru->nb_tx);
|
||||
|
||||
if (ru->if_south <= REMOTE_IF5) { // this means REMOTE_IF5 or LOCAL_RF, so free memory for time-domain signals
|
||||
// Hack: undo what is done at allocation
|
||||
for (i = 0; i < ru->nb_tx; i++) {
|
||||
for (int i = 0; i < ru->nb_tx; i++) {
|
||||
int32_t *p = &ru->common.txdata[i][-ru->sf_extension];
|
||||
free_and_zero(p);
|
||||
}
|
||||
free_and_zero(ru->common.txdata);
|
||||
|
||||
for (i = 0; i < ru->nb_rx; i++)
|
||||
for (int i = 0; i < ru->nb_rx; i++)
|
||||
free_and_zero(ru->common.rxdata[i]);
|
||||
free_and_zero(ru->common.rxdata);
|
||||
} // else: IF5 or local RF -> nothing to free()
|
||||
|
||||
if (ru->function != NGFI_RRU_IF5) { // we need to do RX/TX RU processing
|
||||
for (i = 0; i < ru->nb_rx; i++) free_and_zero(ru->common.rxdata_7_5kHz[i]);
|
||||
for (int i = 0; i < ru->nb_rx; i++)
|
||||
free_and_zero(ru->common.rxdata_7_5kHz[i]);
|
||||
free_and_zero(ru->common.rxdata_7_5kHz);
|
||||
|
||||
// free beamforming input buffers (TX)
|
||||
for (i = 0; i < ru->nb_tx; i++) free_and_zero(ru->common.txdataF[i]);
|
||||
for (int i = 0; i < ru->nb_tx; i++)
|
||||
free_and_zero(ru->common.txdataF[i]);
|
||||
free_and_zero(ru->common.txdataF);
|
||||
|
||||
// free IFFT input buffers (TX)
|
||||
for (i = 0; i < ru->nb_tx; i++) free_and_zero(ru->common.txdataF_BF[i]);
|
||||
for (int i = 0; i < ru->nb_tx; i++)
|
||||
free_and_zero(ru->common.txdataF_BF[i]);
|
||||
free_and_zero(ru->common.txdataF_BF);
|
||||
|
||||
// free FFT output buffers (RX)
|
||||
for (i = 0; i < ru->nb_rx; i++) free_and_zero(ru->common.rxdataF[i]);
|
||||
free_and_zero(ru->common.rxdataF);
|
||||
for (int i = 0; i < ru->nb_rx; i++)
|
||||
free_and_zero(ru->common.rxdataF[i]);
|
||||
free_and_zero(ru->common.rxdataF);
|
||||
|
||||
for (j=0;j<NUMBER_OF_NR_RU_PRACH_OCCASIONS_MAX;j++) {
|
||||
for (i = 0; i < ru->nb_rx; i++)
|
||||
for (int j = 0; j < NUMBER_OF_NR_RU_PRACH_OCCASIONS_MAX; j++) {
|
||||
for (int i = 0; i < ru->nb_rx; i++)
|
||||
free_and_zero(ru->prach_rxsigF[j][i]);
|
||||
free_and_zero(ru->prach_rxsigF[j]);
|
||||
}
|
||||
if (ru->do_precoding == 1) {
|
||||
for (i = 0; i < ru->num_gNB; i++) {
|
||||
for (p = 0; p < ru->nb_log_antennas; p++) {
|
||||
for (j=0; j<ru->nb_tx; j++) free_and_zero(ru->beam_weights[i][p][j]);
|
||||
free_and_zero(ru->beam_weights[i][p]);
|
||||
}
|
||||
}
|
||||
for(i=0; i< ru->nb_tx; ++i)
|
||||
free_and_zero(ru->common.beam_id[i]);
|
||||
free_and_zero(ru->common.beam_id);
|
||||
}
|
||||
for(int i = 0; i < MAX_NUM_BEAM_PERIODS; ++i)
|
||||
free_and_zero(ru->common.beam_id[i]);
|
||||
free_and_zero(ru->common.beam_id);
|
||||
}
|
||||
free_and_zero(ru->common.sync_corr);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB);
|
||||
void init_nr_ue_transport(PHY_VARS_NR_UE *ue);
|
||||
void init_N_TA_offset(PHY_VARS_NR_UE *ue);
|
||||
void nr_dump_frame_parms(NR_DL_FRAME_PARMS *frame_parms);
|
||||
int phy_init_nr_gNB(PHY_VARS_gNB *gNB);
|
||||
void phy_init_nr_gNB(PHY_VARS_gNB *gNB);
|
||||
int init_codebook_gNB(PHY_VARS_gNB *gNB);
|
||||
void nr_phy_config_request(NR_PHY_Config_t *gNB);
|
||||
void nr_phy_config_request_sim(PHY_VARS_gNB *gNB,int N_RB_DL,int N_RB_UL,int mu,int Nid_cell,uint64_t position_in_burst);
|
||||
|
||||
@@ -137,32 +137,25 @@ int beam_precoding_one_eNB(int32_t **txdataF,
|
||||
}
|
||||
|
||||
|
||||
int nr_beam_precoding(c16_t **txdataF,
|
||||
c16_t **txdataF_BF,
|
||||
NR_DL_FRAME_PARMS *frame_parms,
|
||||
int32_t ***beam_weights,
|
||||
int slot,
|
||||
int symbol,
|
||||
int aa,
|
||||
int nb_antenna_ports,
|
||||
int offset)
|
||||
void nr_beam_precoding(c16_t **txdataF,
|
||||
c16_t **txdataF_BF,
|
||||
NR_DL_FRAME_PARMS *frame_parms,
|
||||
int32_t ***beam_weights,
|
||||
int slot,
|
||||
int symbol,
|
||||
int aa,
|
||||
int nb_antenna_ports,
|
||||
int offset)
|
||||
{
|
||||
|
||||
|
||||
uint8_t p;
|
||||
|
||||
// clear txdata_BF[aa][re] for each call of ue_spec_beamforming
|
||||
memset(&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size], 0, sizeof(c16_t) *(frame_parms->ofdm_symbol_size));
|
||||
|
||||
for (p=0; p<nb_antenna_ports; p++) {
|
||||
//if ((frame_parms->L_ssb >> (63-p)) & 0x01) {
|
||||
multadd_cpx_vector((int16_t*)&txdataF[p][(symbol*frame_parms->ofdm_symbol_size)+offset],
|
||||
(int16_t*)beam_weights[p][aa],
|
||||
(int16_t*)&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size],
|
||||
0,
|
||||
frame_parms->ofdm_symbol_size,
|
||||
15);
|
||||
//}
|
||||
for (int p = 0; p < nb_antenna_ports; p++) {
|
||||
multadd_cpx_vector((int16_t*)&txdataF[p][(symbol*frame_parms->ofdm_symbol_size)+offset],
|
||||
(int16_t*)beam_weights[p][aa],
|
||||
(int16_t*)&txdataF_BF[aa][symbol*frame_parms->ofdm_symbol_size],
|
||||
0,
|
||||
frame_parms->ofdm_symbol_size,
|
||||
15);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -95,16 +95,15 @@ int nr_slot_fep_ul(NR_DL_FRAME_PARMS *frame_parms,
|
||||
*/
|
||||
void nr_dft(c16_t *z, c16_t *d, uint32_t Msc_PUSCH);
|
||||
|
||||
int nr_beam_precoding(c16_t **txdataF,
|
||||
c16_t **txdataF_BF,
|
||||
NR_DL_FRAME_PARMS *frame_parms,
|
||||
int32_t ***beam_weights,
|
||||
int slot,
|
||||
int symbol,
|
||||
int aa,
|
||||
int nb_antenna_ports,
|
||||
int offset
|
||||
);
|
||||
void nr_beam_precoding(c16_t **txdataF,
|
||||
c16_t **txdataF_BF,
|
||||
NR_DL_FRAME_PARMS *frame_parms,
|
||||
int32_t ***beam_weights,
|
||||
int slot,
|
||||
int symbol,
|
||||
int aa,
|
||||
int nb_antenna_ports,
|
||||
int offset);
|
||||
|
||||
void apply_nr_rotation_TX(const NR_DL_FRAME_PARMS *fp,
|
||||
c16_t *txdataF,
|
||||
|
||||
@@ -119,7 +119,7 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB, int slot, int first_symb, int num_sy
|
||||
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
|
||||
NR_gNB_COMMON *common_vars = &gNB->common_vars;
|
||||
PHY_MEASUREMENTS_gNB *measurements = &gNB->measurements;
|
||||
int rb, nb_symb[275]={0};
|
||||
int nb_symb[275]={0};
|
||||
|
||||
allocCast2D(n0_subband_power,
|
||||
unsigned int,
|
||||
@@ -135,20 +135,20 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB, int slot, int first_symb, int num_sy
|
||||
frame_parms->N_RB_UL,
|
||||
false);
|
||||
|
||||
for (int s=first_symb;s<(first_symb+num_symb);s++) {
|
||||
// TODO modify the measurements to take into account concurrent beams
|
||||
for (int s = first_symb; s < first_symb + num_symb; s++) {
|
||||
int offset0 = ((slot&3)*frame_parms->symbols_per_slot + s) * frame_parms->ofdm_symbol_size;
|
||||
for (rb=0; rb<frame_parms->N_RB_UL; rb++) {
|
||||
for (int rb = 0; rb < frame_parms->N_RB_UL; rb++) {
|
||||
if ((rb_mask_ul[s][rb >> 5] & (1U << (rb & 31))) == 0 && // check that rb was not used in this subframe
|
||||
!(I0_SKIP_DC && rb == frame_parms->N_RB_UL >> 1)) { // skip middle PRB because of artificial noise possibly created by FFT
|
||||
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++) {
|
||||
c16_t *ul_ch = &common_vars->rxdataF[aarx][offset];
|
||||
for (int aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) {
|
||||
c16_t *ul_ch = &common_vars->rxdataF[0][aarx][offset];
|
||||
int32_t signal_energy;
|
||||
if (((frame_parms->N_RB_UL&1) == 1) &&
|
||||
(rb==(frame_parms->N_RB_UL>>1))) {
|
||||
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 = &common_vars->rxdataF[aarx][offset0];
|
||||
ul_ch = &common_vars->rxdataF[0][aarx][offset0];
|
||||
signal_energy += signal_energy_nodc(ul_ch, 6);
|
||||
} else {
|
||||
signal_energy = signal_energy_nodc(ul_ch, 12);
|
||||
|
||||
@@ -71,6 +71,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
unsigned short p,
|
||||
unsigned char symbol,
|
||||
int ul_id,
|
||||
int beam_nb,
|
||||
unsigned short bwp_start_subcarrier,
|
||||
nfapi_nr_pusch_pdu_t *pusch_pdu,
|
||||
int *max_ch,
|
||||
@@ -153,7 +154,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
memset(delay, 0, sizeof(*delay));
|
||||
|
||||
for (int aarx=0; aarx<gNB->frame_parms.nb_antennas_rx; aarx++) {
|
||||
c16_t *rxdataF = (c16_t *)&gNB->common_vars.rxdataF[aarx][symbol_offset + slot_offset];
|
||||
c16_t *rxdataF = (c16_t *)&gNB->common_vars.rxdataF[beam_nb][aarx][symbol_offset + slot_offset];
|
||||
c16_t *ul_ch = &ul_ch_estimates[nl * gNB->frame_parms.nb_antennas_rx + aarx][symbol_offset];
|
||||
|
||||
memset(ul_ch, 0, sizeof(*ul_ch) * symbolSize);
|
||||
|
||||
@@ -47,6 +47,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
|
||||
unsigned short p,
|
||||
unsigned char symbol,
|
||||
int ul_id,
|
||||
int beam_nb,
|
||||
unsigned short bwp_start_subcarrier,
|
||||
nfapi_nr_pusch_pdu_t *pusch_pdu,
|
||||
int *max_ch,
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "nr_sch_dmrs.h"
|
||||
#include "PHY/MODULATION/nr_modulation.h"
|
||||
#include "common/utils/nr/nr_common.h"
|
||||
#include "SCHED_NR/sched_nr.h"
|
||||
|
||||
//#define DEBUG_PDCCH_DMRS
|
||||
//#define DEBUG_DCI
|
||||
@@ -50,17 +51,12 @@ static void nr_pdcch_scrambling(uint32_t *in, uint32_t size, uint32_t Nid, uint3
|
||||
out[i] = in[i] ^ seq[i];
|
||||
}
|
||||
|
||||
void nr_generate_dci(PHY_VARS_gNB *gNB,
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
||||
int32_t *txdataF,
|
||||
int16_t amp,
|
||||
NR_DL_FRAME_PARMS *frame_parms,
|
||||
int slot) {
|
||||
|
||||
uint16_t cset_start_sc;
|
||||
uint8_t cset_start_symb, cset_nsymb;
|
||||
int k,l,k_prime,dci_idx, dmrs_idx;
|
||||
|
||||
static void nr_generate_dci(PHY_VARS_gNB *gNB,
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
|
||||
int txdataF_offset,
|
||||
NR_DL_FRAME_PARMS *frame_parms,
|
||||
int slot)
|
||||
{
|
||||
// fill reg list per symbol
|
||||
int reg_list[MAX_DCI_CORESET][NR_MAX_PDCCH_AGG_LEVEL * NR_NB_REG_PER_CCE];
|
||||
nr_fill_reg_list(reg_list, pdcch_pdu_rel15);
|
||||
@@ -68,20 +64,29 @@ void nr_generate_dci(PHY_VARS_gNB *gNB,
|
||||
int rb_offset;
|
||||
int n_rb;
|
||||
get_coreset_rballoc(pdcch_pdu_rel15->FreqDomainResource,&n_rb,&rb_offset);
|
||||
cset_start_sc = frame_parms->first_carrier_offset + (pdcch_pdu_rel15->BWPStart + rb_offset) * NR_NB_SC_PER_RB;
|
||||
uint16_t cset_start_sc = frame_parms->first_carrier_offset + (pdcch_pdu_rel15->BWPStart + rb_offset) * NR_NB_SC_PER_RB;
|
||||
int idx1 = pdcch_pdu_rel15->StartSymbolIndex+pdcch_pdu_rel15->DurationSymbols;
|
||||
int idx2 = (((n_rb + rb_offset + pdcch_pdu_rel15->BWPStart) * 6 + 15) >> 4) << 4;
|
||||
int16_t mod_dmrs[idx1][idx2] __attribute__((aligned(16)));
|
||||
|
||||
int16_t mod_dmrs[pdcch_pdu_rel15->StartSymbolIndex+pdcch_pdu_rel15->DurationSymbols][(((n_rb+rb_offset+pdcch_pdu_rel15->BWPStart)*6+15)>>4)<<4] __attribute__((aligned(16))); // 3 for the max coreset duration
|
||||
|
||||
for (int d=0;d<pdcch_pdu_rel15->numDlDci;d++) {
|
||||
for (int d = 0; d < pdcch_pdu_rel15->numDlDci; d++) {
|
||||
/*The coreset is initialised
|
||||
* in frequency: the first subcarrier is obtained by adding the first CRB overlapping the SSB and the rb_offset for coreset 0
|
||||
* or the rb_offset for other coresets
|
||||
* in time: by its first slot and its first symbol*/
|
||||
const nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu_rel15->dci_pdu[d];
|
||||
|
||||
cset_start_symb = pdcch_pdu_rel15->StartSymbolIndex;
|
||||
cset_nsymb = pdcch_pdu_rel15->DurationSymbols;
|
||||
dci_idx = 0;
|
||||
uint32_t cset_start_symb = pdcch_pdu_rel15->StartSymbolIndex;
|
||||
uint32_t cset_nsymb = pdcch_pdu_rel15->DurationSymbols;
|
||||
int dci_idx = 0;
|
||||
// multi-beam number (for concurrent beams)
|
||||
int beam_nb = beam_index_allocation(dci_pdu->precodingAndBeamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx,
|
||||
&gNB->common_vars,
|
||||
slot,
|
||||
frame_parms->symbols_per_slot,
|
||||
cset_start_symb,
|
||||
pdcch_pdu_rel15->DurationSymbols);
|
||||
|
||||
LOG_D(NR_PHY_DCI, "pdcch: Coreset rb_offset %d, nb_rb %d BWP Start %d\n", rb_offset, n_rb, pdcch_pdu_rel15->BWPStart);
|
||||
LOG_D(NR_PHY_DCI,
|
||||
"pdcch: Coreset starting subcarrier %d on symbol %d (%d symbols)\n",
|
||||
@@ -107,16 +112,18 @@ void nr_generate_dci(PHY_VARS_gNB *gNB,
|
||||
dmrs_length += rb_offset*6; // To accommodate more DMRS symbols in case of rb offset
|
||||
|
||||
/// DMRS QPSK modulation
|
||||
for (int symb=cset_start_symb; symb<cset_start_symb + pdcch_pdu_rel15->DurationSymbols; symb++) {
|
||||
for (int symb = cset_start_symb; symb < cset_start_symb + pdcch_pdu_rel15->DurationSymbols; symb++) {
|
||||
const uint32_t *gold = nr_gold_pdcch(frame_parms->N_RB_DL, frame_parms->symbols_per_slot, dci_pdu->ScramblingId, slot, symb);
|
||||
nr_modulation(gold, dmrs_length, DMRS_MOD_ORDER,
|
||||
mod_dmrs[symb]); // Qm = 2 as DMRS is QPSK modulated
|
||||
nr_modulation(gold, dmrs_length, DMRS_MOD_ORDER, mod_dmrs[symb]); // Qm = 2 as DMRS is QPSK modulated
|
||||
|
||||
#ifdef DEBUG_PDCCH_DMRS
|
||||
if(dci_pdu->RNTI!=0xFFFF) {
|
||||
for (int i=0; i<dmrs_length>>1; i++)
|
||||
printf("symb %d i %d %p gold seq 0x%08x mod_dmrs %d %d\n", symb, i,
|
||||
&gold_pdcch_dmrs[symb][i>>5],gold_pdcch_dmrs[symb][i>>5], mod_dmrs[symb][i<<1], mod_dmrs[symb][(i<<1)+1]);
|
||||
printf("symb %d i %d %p gold seq 0x%08x mod_dmrs %d %d\n",
|
||||
symb,
|
||||
i,
|
||||
&gold_pdcch_dmrs[symb][i>>5],gold_pdcch_dmrs[symb][i>>5],
|
||||
mod_dmrs[symb][i<<1], mod_dmrs[symb][(i<<1)+1]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -163,7 +170,8 @@ void nr_generate_dci(PHY_VARS_gNB *gNB,
|
||||
#endif
|
||||
|
||||
/// Resource mapping
|
||||
|
||||
uint16_t amp = gNB->TX_AMP;
|
||||
int32_t *txdataF = (int32_t *)&gNB->common_vars.txdataF[beam_nb][0][txdataF_offset];
|
||||
if (cset_start_sc >= frame_parms->ofdm_symbol_size)
|
||||
cset_start_sc -= frame_parms->ofdm_symbol_size;
|
||||
|
||||
@@ -172,20 +180,21 @@ void nr_generate_dci(PHY_VARS_gNB *gNB,
|
||||
for(int symbol_idx = 0; symbol_idx < pdcch_pdu_rel15->DurationSymbols; symbol_idx++) {
|
||||
// allocating rbs per symbol
|
||||
for (int reg_count = 0; reg_count < num_regs; reg_count++) {
|
||||
k = cset_start_sc + reg_list[d][reg_count] * NR_NB_SC_PER_RB;
|
||||
int k = cset_start_sc + reg_list[d][reg_count] * NR_NB_SC_PER_RB;
|
||||
LOG_D(NR_PHY_DCI, "REG %d k %d\n", reg_list[d][reg_count], k);
|
||||
if (k >= frame_parms->ofdm_symbol_size)
|
||||
k -= frame_parms->ofdm_symbol_size;
|
||||
|
||||
l = cset_start_symb + symbol_idx;
|
||||
int l = cset_start_symb + symbol_idx;
|
||||
|
||||
// dmrs index depends on reference point for k according to 38.211 7.4.1.3.2
|
||||
int dmrs_idx;
|
||||
if (pdcch_pdu_rel15->CoreSetType == NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG)
|
||||
dmrs_idx = (reg_list[d][reg_count] + pdcch_pdu_rel15->BWPStart) * 3;
|
||||
else
|
||||
dmrs_idx = (reg_list[d][reg_count] + rb_offset) * 3;
|
||||
|
||||
k_prime = 0;
|
||||
int k_prime = 0;
|
||||
|
||||
for (int m = 0; m < NR_NB_SC_PER_RB; m++) {
|
||||
if (m == (k_prime << 2) + 1) { // DMRS if not already mapped
|
||||
@@ -235,16 +244,13 @@ void nr_generate_dci(PHY_VARS_gNB *gNB,
|
||||
} // for (int d=0;d<pdcch_pdu_rel15->numDlDci;d++)
|
||||
}
|
||||
|
||||
void nr_generate_dci_top(processingData_L1tx_t *msgTx,
|
||||
int slot,
|
||||
int32_t *txdataF,
|
||||
int16_t amp,
|
||||
NR_DL_FRAME_PARMS *frame_parms) {
|
||||
|
||||
for (int i=0; i<msgTx->num_ul_pdcch; i++)
|
||||
nr_generate_dci(msgTx->gNB,&msgTx->ul_pdcch_pdu[i].pdcch_pdu.pdcch_pdu_rel15,txdataF,amp,frame_parms,slot);
|
||||
for (int i=0; i<msgTx->num_dl_pdcch; i++)
|
||||
nr_generate_dci(msgTx->gNB,&msgTx->pdcch_pdu[i].pdcch_pdu_rel15,txdataF,amp,frame_parms,slot);
|
||||
|
||||
void nr_generate_dci_top(processingData_L1tx_t *msgTx, int slot, int txdataF_offset)
|
||||
{
|
||||
PHY_VARS_gNB *gNB = msgTx->gNB;
|
||||
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
|
||||
for (int i = 0; i < msgTx->num_ul_pdcch; i++)
|
||||
nr_generate_dci(msgTx->gNB, &msgTx->ul_pdcch_pdu[i].pdcch_pdu.pdcch_pdu_rel15, txdataF_offset, frame_parms, slot);
|
||||
for (int i = 0; i < msgTx->num_dl_pdcch; i++)
|
||||
nr_generate_dci(msgTx->gNB, &msgTx->pdcch_pdu[i].pdcch_pdu_rel15, txdataF_offset, frame_parms, slot);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,11 +26,7 @@
|
||||
#include "PHY/NR_REFSIG/nr_refsig.h"
|
||||
#include "nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h"
|
||||
|
||||
void nr_generate_dci_top(processingData_L1tx_t *msgTx,
|
||||
int slot,
|
||||
int32_t *txdataF,
|
||||
int16_t amp,
|
||||
NR_DL_FRAME_PARMS *frame_parms);
|
||||
void nr_generate_dci_top(processingData_L1tx_t *msgTx, int slot, int txdataF_offset);
|
||||
|
||||
int16_t find_nr_pdcch(int frame,int slot, PHY_VARS_gNB *gNB,find_type_t type);
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "common/utils/nr/nr_common.h"
|
||||
#include "executables/softmodem-common.h"
|
||||
#include "SCHED_NR/sched_nr.h"
|
||||
|
||||
//#define DEBUG_DLSCH
|
||||
//#define DEBUG_DLSCH_MAPPING
|
||||
@@ -468,7 +469,16 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot)
|
||||
// The Precoding matrix:
|
||||
// The Codebook Type I
|
||||
start_meas(&gNB->dlsch_precoding_stats);
|
||||
c16_t **txdataF = gNB->common_vars.txdataF;
|
||||
nfapi_nr_tx_precoding_and_beamforming_t *pb = &rel15->precodingAndBeamforming;
|
||||
// beam number in multi-beam scenario (concurrent beams)
|
||||
int beam_nb = beam_index_allocation(pb->prgs_list[0].dig_bf_interface_list[0].beam_idx,
|
||||
&gNB->common_vars,
|
||||
slot,
|
||||
frame_parms->symbols_per_slot,
|
||||
rel15->StartSymbolIndex,
|
||||
rel15->NrOfSymbols);
|
||||
|
||||
c16_t **txdataF = gNB->common_vars.txdataF[beam_nb];
|
||||
|
||||
for (int ant = 0; ant < frame_parms->nb_antennas_tx; ant++) {
|
||||
for (int l_symbol = rel15->StartSymbolIndex; l_symbol < rel15->StartSymbolIndex + rel15->NrOfSymbols; l_symbol++) {
|
||||
@@ -477,10 +487,8 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot)
|
||||
int rb = 0;
|
||||
while(rb < rel15->rbSize) {
|
||||
//get pmi info
|
||||
const int pmi = (rel15->precodingAndBeamforming.prg_size > 0) ?
|
||||
(rel15->precodingAndBeamforming.prgs_list[(int)rb/rel15->precodingAndBeamforming.prg_size].pm_idx) : 0;
|
||||
const int pmi2 = (rb < (rel15->rbSize - 1) && rel15->precodingAndBeamforming.prg_size > 0) ?
|
||||
(rel15->precodingAndBeamforming.prgs_list[(int)(rb+1)/rel15->precodingAndBeamforming.prg_size].pm_idx) : -1;
|
||||
const int pmi = (pb->prg_size > 0) ? (pb->prgs_list[(int)rb / pb->prg_size].pm_idx) : 0;
|
||||
const int pmi2 = (rb < (rel15->rbSize - 1) && pb->prg_size > 0) ? (pb->prgs_list[(int)(rb+1)/pb->prg_size].pm_idx) : -1;
|
||||
|
||||
// If pmi of next RB and pmi of current RB are the same, we do 2 RB in a row
|
||||
// if pmi differs, or current rb is the end (rel15->rbSize - 1), than we do 1 RB in a row
|
||||
@@ -576,21 +584,6 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot)
|
||||
|
||||
stop_meas(&gNB->dlsch_precoding_stats);
|
||||
|
||||
// TODO: handle precoding
|
||||
// this maps the layers onto antenna ports
|
||||
|
||||
// handle beamforming ID
|
||||
// each antenna port is assigned a beam_index
|
||||
// since PHY can only handle BF on slot basis we set the whole slot
|
||||
|
||||
// first check if this slot has not already been allocated to another beam
|
||||
if (gNB->common_vars.beam_id[0][slot*frame_parms->symbols_per_slot]==255) {
|
||||
for (int j=0;j<frame_parms->symbols_per_slot;j++)
|
||||
gNB->common_vars.beam_id[0][slot*frame_parms->symbols_per_slot+j] = rel15->precodingAndBeamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx;
|
||||
}
|
||||
else {
|
||||
LOG_D(PHY,"beam index for PDSCH allocation already taken\n");
|
||||
}
|
||||
}// dlsch loop
|
||||
}
|
||||
|
||||
|
||||
@@ -73,13 +73,6 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch, uint16_t N_RB, const NR_DL_FRAME_PARM
|
||||
}
|
||||
free(harq->c);
|
||||
free(harq->pdu);
|
||||
|
||||
for (int layer = 0; layer < max_layers; layer++) {
|
||||
for (int aa = 0; aa < 64; aa++)
|
||||
free(dlsch->ue_spec_bf_weights[layer][aa]);
|
||||
free(dlsch->ue_spec_bf_weights[layer]);
|
||||
}
|
||||
free(dlsch->ue_spec_bf_weights);
|
||||
}
|
||||
|
||||
NR_gNB_DLSCH_t new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, uint16_t N_RB)
|
||||
@@ -96,19 +89,6 @@ NR_gNB_DLSCH_t new_gNB_dlsch(NR_DL_FRAME_PARMS *frame_parms, uint16_t N_RB)
|
||||
uint32_t dlsch_bytes = a_segments*1056; // allocated bytes per segment
|
||||
NR_gNB_DLSCH_t dlsch;
|
||||
|
||||
dlsch.ue_spec_bf_weights = (int32_t ***)malloc16(max_layers * sizeof(int32_t **));
|
||||
for (int layer=0; layer<max_layers; layer++) {
|
||||
dlsch.ue_spec_bf_weights[layer] = (int32_t **)malloc16(64 * sizeof(int32_t *));
|
||||
|
||||
for (int aa=0; aa<64; aa++) {
|
||||
dlsch.ue_spec_bf_weights[layer][aa] = (int32_t *)malloc16(OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES * sizeof(int32_t));
|
||||
|
||||
for (int re=0; re<OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES; re++) {
|
||||
dlsch.ue_spec_bf_weights[layer][aa][re] = 0x00007fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NR_DL_gNB_HARQ_t *harq = &dlsch.harq_process;
|
||||
bzero(harq, sizeof(NR_DL_gNB_HARQ_t));
|
||||
harq->b = malloc16(dlsch_bytes);
|
||||
|
||||
@@ -31,23 +31,26 @@
|
||||
*/
|
||||
|
||||
#include "PHY/defs_gNB.h"
|
||||
#include "SCHED_NR/sched_nr.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
|
||||
#include "openair1/PHY/NR_TRANSPORT/nr_prach.h"
|
||||
|
||||
void init_prach_list(PHY_VARS_gNB *gNB)
|
||||
{
|
||||
AssertFatal(gNB!=NULL,"gNB is null\n");
|
||||
for (int i=0; i<NUMBER_OF_NR_PRACH_MAX; i++){
|
||||
AssertFatal(gNB != NULL, "gNB is null\n");
|
||||
for (int i = 0; i < NUMBER_OF_NR_PRACH_MAX; i++){
|
||||
gNB->prach_vars.list[i].frame = -1;
|
||||
gNB->prach_vars.list[i].slot = -1;
|
||||
gNB->prach_vars.list[i].slot = -1;
|
||||
gNB->prach_vars.list[i].beam_nb = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void free_nr_prach_entry(PHY_VARS_gNB *gNB, int prach_id)
|
||||
{
|
||||
gNB->prach_vars.list[prach_id].frame = -1;
|
||||
gNB->prach_vars.list[prach_id].slot = -1;
|
||||
gNB->prach_vars.list[prach_id].slot = -1;
|
||||
gNB->prach_vars.list[prach_id].beam_nb = -1;
|
||||
}
|
||||
|
||||
int16_t find_nr_prach(PHY_VARS_gNB *gNB,int frame, int slot, find_type_t type) {
|
||||
@@ -70,47 +73,54 @@ int16_t find_nr_prach(PHY_VARS_gNB *gNB,int frame, int slot, find_type_t type) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
void nr_fill_prach(PHY_VARS_gNB *gNB,
|
||||
int SFN,
|
||||
int Slot,
|
||||
nfapi_nr_prach_pdu_t *prach_pdu)
|
||||
void nr_fill_prach(PHY_VARS_gNB *gNB, int SFN, int Slot, nfapi_nr_prach_pdu_t *prach_pdu)
|
||||
{
|
||||
int prach_id = find_nr_prach(gNB,SFN,Slot,SEARCH_EXIST_OR_FREE);
|
||||
int prach_id = find_nr_prach(gNB, SFN, Slot, SEARCH_EXIST_OR_FREE);
|
||||
AssertFatal(((prach_id >= 0) && (prach_id < NUMBER_OF_NR_PRACH_MAX)), "illegal or no prach_id found!!! prach_id %d\n", prach_id);
|
||||
|
||||
gNB->prach_vars.list[prach_id].frame=SFN;
|
||||
gNB->prach_vars.list[prach_id].slot=Slot;
|
||||
LOG_D(NR_PHY,"Copying prach pdu %d bytes to index %d\n",(int)sizeof(*prach_pdu),prach_id);
|
||||
memcpy((void*)&gNB->prach_vars.list[prach_id].pdu,(void*)prach_pdu,sizeof(*prach_pdu));
|
||||
|
||||
gNB_PRACH_list_t *prach = &gNB->prach_vars.list[prach_id];
|
||||
prach->frame = SFN;
|
||||
prach->slot = Slot;
|
||||
prach->beam_nb = 0;
|
||||
if (gNB->common_vars.beam_id) {
|
||||
int fapi_beam_idx = prach_pdu->beamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx;
|
||||
// TODO no idea how to compute final prach symbol here so for now we go til the end of the slot
|
||||
int temp_nb_symbols = NR_NUMBER_OF_SYMBOLS_PER_SLOT - prach_pdu->prach_start_symbol;
|
||||
prach->beam_nb = beam_index_allocation(fapi_beam_idx,
|
||||
&gNB->common_vars,
|
||||
Slot,
|
||||
NR_NUMBER_OF_SYMBOLS_PER_SLOT,
|
||||
prach_pdu->prach_start_symbol,
|
||||
temp_nb_symbols);
|
||||
}
|
||||
LOG_D(NR_PHY,"Copying prach pdu %d bytes to index %d\n", (int)sizeof(*prach_pdu), prach_id);
|
||||
memcpy(&prach->pdu, prach_pdu, sizeof(*prach_pdu));
|
||||
}
|
||||
|
||||
void init_prach_ru_list(RU_t *ru) {
|
||||
|
||||
AssertFatal(ru!=NULL,"ruis null\n");
|
||||
for (int i=0; i<NUMBER_OF_NR_RU_PRACH_MAX; i++) {
|
||||
ru->prach_list[i].frame = -1;
|
||||
ru->prach_list[i].slot = -1;
|
||||
}
|
||||
pthread_mutex_init(&ru->prach_list_mutex,NULL);
|
||||
void init_prach_ru_list(RU_t *ru)
|
||||
{
|
||||
AssertFatal(ru != NULL, "ru is null\n");
|
||||
for (int i = 0; i < NUMBER_OF_NR_RU_PRACH_MAX; i++) {
|
||||
ru->prach_list[i].frame = -1;
|
||||
ru->prach_list[i].slot = -1;
|
||||
}
|
||||
pthread_mutex_init(&ru->prach_list_mutex, NULL);
|
||||
}
|
||||
|
||||
int16_t find_nr_prach_ru(RU_t *ru,int frame,int slot, find_type_t type) {
|
||||
|
||||
AssertFatal(ru!=NULL,"ru is null\n");
|
||||
int16_t find_nr_prach_ru(RU_t *ru,int frame,int slot, find_type_t type)
|
||||
{
|
||||
AssertFatal(ru != NULL, "ru is null\n");
|
||||
pthread_mutex_lock(&ru->prach_list_mutex);
|
||||
for (uint16_t i=0; i<NUMBER_OF_NR_RU_PRACH_MAX; i++) {
|
||||
LOG_D(PHY,"searching for PRACH in %d.%d : prach_index %d=> %d.%d\n", frame,slot,i,
|
||||
for (int i = 0; i < NUMBER_OF_NR_RU_PRACH_MAX; i++) {
|
||||
LOG_D(PHY,"searching for PRACH in %d.%d : prach_index %d=> %d.%d\n",
|
||||
frame,
|
||||
slot,
|
||||
i,
|
||||
ru->prach_list[i].frame,ru->prach_list[i].slot);
|
||||
if((type == SEARCH_EXIST_OR_FREE) &&
|
||||
(ru->prach_list[i].frame == -1) &&
|
||||
(ru->prach_list[i].slot == -1)) {
|
||||
pthread_mutex_unlock(&ru->prach_list_mutex);
|
||||
return i;
|
||||
if((type == SEARCH_EXIST_OR_FREE) && (ru->prach_list[i].frame == -1) && (ru->prach_list[i].slot == -1)) {
|
||||
pthread_mutex_unlock(&ru->prach_list_mutex);
|
||||
return i;
|
||||
}
|
||||
else if ((type == SEARCH_EXIST) &&
|
||||
(ru->prach_list[i].frame == frame) &&
|
||||
(ru->prach_list[i].slot == slot)) {
|
||||
else if ((type == SEARCH_EXIST) && (ru->prach_list[i].frame == frame) && (ru->prach_list[i].slot == slot)) {
|
||||
pthread_mutex_unlock(&ru->prach_list_mutex);
|
||||
return i;
|
||||
}
|
||||
@@ -119,55 +129,42 @@ int16_t find_nr_prach_ru(RU_t *ru,int frame,int slot, find_type_t type) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
void nr_fill_prach_ru(RU_t *ru,
|
||||
int SFN,
|
||||
int Slot,
|
||||
nfapi_nr_prach_pdu_t *prach_pdu) {
|
||||
|
||||
int prach_id = find_nr_prach_ru(ru,SFN,Slot,SEARCH_EXIST_OR_FREE);
|
||||
AssertFatal( ((prach_id>=0) && (prach_id<NUMBER_OF_NR_PRACH_MAX)) || (prach_id < 0) ,
|
||||
"illegal or no prach_id found!!! prach_id %d\n",prach_id);
|
||||
void nr_fill_prach_ru(RU_t *ru, int SFN, int Slot, nfapi_nr_prach_pdu_t *prach_pdu)
|
||||
{
|
||||
int prach_id = find_nr_prach_ru(ru, SFN, Slot, SEARCH_EXIST_OR_FREE);
|
||||
AssertFatal(((prach_id >= 0) && (prach_id < NUMBER_OF_NR_PRACH_MAX)) || (prach_id < 0),
|
||||
"illegal or no prach_id found!!! prach_id %d\n",
|
||||
prach_id);
|
||||
|
||||
pthread_mutex_lock(&ru->prach_list_mutex);
|
||||
ru->prach_list[prach_id].frame = SFN;
|
||||
ru->prach_list[prach_id].slot = Slot;
|
||||
ru->prach_list[prach_id].fmt = prach_pdu->prach_format;
|
||||
ru->prach_list[prach_id].numRA = prach_pdu->num_ra;
|
||||
ru->prach_list[prach_id].prachStartSymbol = prach_pdu->prach_start_symbol;
|
||||
ru->prach_list[prach_id].num_prach_ocas = prach_pdu->num_prach_ocas;
|
||||
pthread_mutex_unlock(&ru->prach_list_mutex);
|
||||
|
||||
ru->prach_list[prach_id].frame = SFN;
|
||||
ru->prach_list[prach_id].slot = Slot;
|
||||
ru->prach_list[prach_id].fmt = prach_pdu->prach_format;
|
||||
ru->prach_list[prach_id].numRA = prach_pdu->num_ra;
|
||||
ru->prach_list[prach_id].prachStartSymbol = prach_pdu->prach_start_symbol;
|
||||
ru->prach_list[prach_id].num_prach_ocas = prach_pdu->num_prach_ocas;
|
||||
pthread_mutex_unlock(&ru->prach_list_mutex);
|
||||
}
|
||||
|
||||
void free_nr_ru_prach_entry(RU_t *ru,
|
||||
int prach_id) {
|
||||
|
||||
void free_nr_ru_prach_entry(RU_t *ru, int prach_id)
|
||||
{
|
||||
pthread_mutex_lock(&ru->prach_list_mutex);
|
||||
ru->prach_list[prach_id].frame = -1;
|
||||
ru->prach_list[prach_id].slot = -1;
|
||||
ru->prach_list[prach_id].slot = -1;
|
||||
pthread_mutex_unlock(&ru->prach_list_mutex);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void rx_nr_prach_ru(RU_t *ru,
|
||||
int prachFormat,
|
||||
int numRA,
|
||||
int prachStartSymbol,
|
||||
int prachOccasion,
|
||||
int frame,
|
||||
int slot) {
|
||||
|
||||
AssertFatal(ru!=NULL,"ru is null\n");
|
||||
|
||||
int16_t **rxsigF=NULL;
|
||||
NR_DL_FRAME_PARMS *fp=ru->nr_frame_parms;
|
||||
int slot2=slot;
|
||||
void rx_nr_prach_ru(RU_t *ru, int prachFormat, int numRA, int prachStartSymbol, int prachOccasion, int frame, int slot)
|
||||
{
|
||||
AssertFatal(ru != NULL,"ru is null\n");
|
||||
|
||||
int16_t **rxsigF = NULL;
|
||||
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
|
||||
int slot2 = slot;
|
||||
int16_t *prach[ru->nb_rx];
|
||||
int prach_sequence_length = ru->config.prach_config.prach_sequence_length.value;
|
||||
|
||||
int msg1_frequencystart = ru->config.prach_config.num_prach_fd_occasions_list[numRA].k1.value;
|
||||
int msg1_frequencystart = ru->config.prach_config.num_prach_fd_occasions_list[numRA].k1.value;
|
||||
|
||||
int sample_offset_slot;
|
||||
if (prachStartSymbol == 0) {
|
||||
@@ -184,16 +181,24 @@ void rx_nr_prach_ru(RU_t *ru,
|
||||
sample_offset_slot = (fp->ofdm_symbol_size + fp->nb_prefix_samples) * prachStartSymbol;
|
||||
}
|
||||
|
||||
LOG_D(PHY,"frame %d, slot %d: doing rx_nr_prach_ru for format %d, numRA %d, prachStartSymbol %d, prachOccasion %d\n",frame,slot,prachFormat,numRA,prachStartSymbol,prachOccasion);
|
||||
LOG_D(PHY,
|
||||
"frame %d, slot %d: doing rx_nr_prach_ru for format %d, numRA %d, prachStartSymbol %d, prachOccasion %d\n",
|
||||
frame,
|
||||
slot,
|
||||
prachFormat,
|
||||
numRA,
|
||||
prachStartSymbol,
|
||||
prachOccasion);
|
||||
|
||||
rxsigF = ru->prach_rxsigF[prachOccasion];
|
||||
rxsigF = ru->prach_rxsigF[prachOccasion];
|
||||
|
||||
AssertFatal(ru->if_south == LOCAL_RF || ru->if_south == REMOTE_IF5,
|
||||
"we shouldn't call this if if_south != LOCAL_RF or REMOTE_IF5\n");
|
||||
|
||||
for (int aa=0; aa<ru->nb_rx; aa++){
|
||||
if (prach_sequence_length == 0) slot2=(slot/fp->slots_per_subframe)*fp->slots_per_subframe;
|
||||
prach[aa] = (int16_t*)&ru->common.rxdata[aa][fp->get_samples_slot_timestamp(slot2,fp,0)+sample_offset_slot-ru->N_TA_offset];
|
||||
if (prach_sequence_length == 0)
|
||||
slot2 = (slot / fp->slots_per_subframe) * fp->slots_per_subframe;
|
||||
prach[aa] = (int16_t*)&ru->common.rxdata[aa][fp->get_samples_slot_timestamp(slot2, fp, 0) + sample_offset_slot - ru->N_TA_offset];
|
||||
}
|
||||
|
||||
int reps;
|
||||
@@ -202,8 +207,13 @@ void rx_nr_prach_ru(RU_t *ru,
|
||||
int mu = fp->numerology_index;
|
||||
|
||||
if (prach_sequence_length == 0) {
|
||||
LOG_D(PHY,"PRACH (ru %d) in %d.%d, format %d, msg1_frequencyStart %d\n",
|
||||
ru->idx,frame,slot2,prachFormat,msg1_frequencystart);
|
||||
LOG_D(PHY,
|
||||
"PRACH (ru %d) in %d.%d, format %d, msg1_frequencyStart %d\n",
|
||||
ru->idx,
|
||||
frame,
|
||||
slot2,
|
||||
prachFormat,
|
||||
msg1_frequencystart);
|
||||
switch (prachFormat) {
|
||||
case 0:
|
||||
reps = 1;
|
||||
@@ -235,8 +245,14 @@ void rx_nr_prach_ru(RU_t *ru,
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOG_D(PHY,"PRACH (ru %d) in %d.%d, format %s, msg1_frequencyStart %d,startSymbol %d\n",
|
||||
ru->idx,frame,slot,prachfmt[prachFormat],msg1_frequencystart,prachStartSymbol);
|
||||
LOG_D(PHY,
|
||||
"PRACH (ru %d) in %d.%d, format %s, msg1_frequencyStart %d,startSymbol %d\n",
|
||||
ru->idx,
|
||||
frame,
|
||||
slot,
|
||||
prachfmt[prachFormat],
|
||||
msg1_frequencystart,
|
||||
prachStartSymbol);
|
||||
switch (prachFormat) {
|
||||
case 4: //A1
|
||||
reps = 2;
|
||||
@@ -293,7 +309,9 @@ void rx_nr_prach_ru(RU_t *ru,
|
||||
dftlen = 2048 >> mu;
|
||||
}
|
||||
|
||||
//actually what we should be checking here is how often the current prach crosses a 0.5ms boundary. I am not quite sure for which paramter set this would be the case, so I will ignore it for now and just check if the prach starts on a 0.5ms boundary
|
||||
//actually what we should be checking here is how often the current prach crosses a 0.5ms boundary.
|
||||
//I am not quite sure for which paramter set this would be the case,
|
||||
//so I will ignore it for now and just check if the prach starts on a 0.5ms boundary
|
||||
if(fp->numerology_index == 0) {
|
||||
if (prachStartSymbol == 0 || prachStartSymbol == 7)
|
||||
Ncp += 16;
|
||||
|
||||
@@ -127,7 +127,8 @@ int nr_rx_pusch_tp(PHY_VARS_gNB *gNB,
|
||||
uint8_t ulsch_id,
|
||||
uint32_t frame,
|
||||
uint8_t slot,
|
||||
unsigned char harq_pid);
|
||||
unsigned char harq_pid,
|
||||
int beam_nb);
|
||||
|
||||
/*!
|
||||
\brief This function implements the idft transform precoding in PUSCH
|
||||
@@ -297,6 +298,7 @@ void nr_fill_srs(PHY_VARS_gNB *gNB,
|
||||
nfapi_nr_srs_pdu_t *srs_pdu);
|
||||
|
||||
int nr_get_srs_signal(PHY_VARS_gNB *gNB,
|
||||
c16_t **rxdataF,
|
||||
frame_t frame,
|
||||
slot_t slot,
|
||||
nfapi_nr_srs_pdu_t *srs_pdu,
|
||||
@@ -326,12 +328,14 @@ void nr_decode_pucch1(c16_t **rxdataF,
|
||||
uint8_t nr_bit);
|
||||
|
||||
void nr_decode_pucch2(PHY_VARS_gNB *gNB,
|
||||
c16_t **rxdataF,
|
||||
int frame,
|
||||
int slot,
|
||||
nfapi_nr_uci_pucch_pdu_format_2_3_4_t* uci_pdu,
|
||||
nfapi_nr_pucch_pdu_t* pucch_pdu);
|
||||
|
||||
void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
c16_t **rxdataF,
|
||||
int frame,
|
||||
int slot,
|
||||
nfapi_nr_uci_pucch_pdu_format_0_1_t* uci_pdu,
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <stdint.h>
|
||||
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_ulsch.h"
|
||||
#include "SCHED_NR/sched_nr.h"
|
||||
|
||||
static NR_gNB_ULSCH_t *find_nr_ulsch(PHY_VARS_gNB *gNB, uint16_t rnti, int pid)
|
||||
{
|
||||
@@ -71,6 +72,16 @@ void nr_fill_ulsch(PHY_VARS_gNB *gNB, int frame, int slot, nfapi_nr_pusch_pdu_t
|
||||
ulsch->harq_pid = harq_pid;
|
||||
ulsch->handled = 0;
|
||||
ulsch->active = true;
|
||||
ulsch->beam_nb = 0;
|
||||
if (gNB->common_vars.beam_id) {
|
||||
int fapi_beam_idx = ulsch_pdu->beamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx;
|
||||
ulsch->beam_nb = beam_index_allocation(fapi_beam_idx,
|
||||
&gNB->common_vars,
|
||||
slot,
|
||||
NR_NUMBER_OF_SYMBOLS_PER_SLOT,
|
||||
ulsch_pdu->start_symbol_index,
|
||||
ulsch_pdu->nr_of_symbols);
|
||||
}
|
||||
ulsch->frame = frame;
|
||||
ulsch->slot = slot;
|
||||
|
||||
|
||||
@@ -1394,6 +1394,7 @@ typedef struct puschSymbolProc_s {
|
||||
int16_t **llr_layers;
|
||||
int16_t *scramblingSequence;
|
||||
uint32_t nvar;
|
||||
int beam_nb;
|
||||
} puschSymbolProc_t;
|
||||
|
||||
static void nr_pusch_symbol_processing(void *arg)
|
||||
@@ -1416,7 +1417,7 @@ static void nr_pusch_symbol_processing(void *arg)
|
||||
frame_parms,
|
||||
pusch_vars,
|
||||
rel15_ul,
|
||||
gNB->common_vars.rxdataF,
|
||||
gNB->common_vars.rxdataF[rdata->beam_nb],
|
||||
(c16_t**)gNB->pusch_vars[ulsch_id].ul_ch_estimates,
|
||||
rdata->llr_layers,
|
||||
soffset,
|
||||
@@ -1471,7 +1472,8 @@ int nr_rx_pusch_tp(PHY_VARS_gNB *gNB,
|
||||
uint8_t ulsch_id,
|
||||
uint32_t frame,
|
||||
uint8_t slot,
|
||||
unsigned char harq_pid)
|
||||
unsigned char harq_pid,
|
||||
int beam_nb)
|
||||
{
|
||||
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
|
||||
nfapi_nr_pusch_pdu_t *rel15_ul = &gNB->ulsch[ulsch_id].harq_process->ulsch_pdu;
|
||||
@@ -1503,6 +1505,7 @@ int nr_rx_pusch_tp(PHY_VARS_gNB *gNB,
|
||||
get_dmrs_port(nl, rel15_ul->dmrs_ports),
|
||||
symbol,
|
||||
ulsch_id,
|
||||
beam_nb,
|
||||
bwp_start_subcarrier,
|
||||
rel15_ul,
|
||||
&max_ch,
|
||||
@@ -1535,10 +1538,10 @@ int nr_rx_pusch_tp(PHY_VARS_gNB *gNB,
|
||||
for (int s = rel15_ul->start_symbol_index; s < (rel15_ul->start_symbol_index + rel15_ul->nr_of_symbols); s++) {
|
||||
int offset0 = ((slot & 3) * frame_parms->symbols_per_slot + s) * frame_parms->ofdm_symbol_size;
|
||||
int offset = offset0 + (frame_parms->first_carrier_offset + start_sc) % frame_parms->ofdm_symbol_size;
|
||||
c16_t *ul_ch = &gNB->common_vars.rxdataF[aarx][offset];
|
||||
c16_t *ul_ch = &gNB->common_vars.rxdataF[beam_nb][aarx][offset];
|
||||
if (end_sc < start_sc) {
|
||||
int64_t symb_energy_aux = signal_energy_nodc(ul_ch, middle_sc - start_sc) * (middle_sc - start_sc);
|
||||
ul_ch = &gNB->common_vars.rxdataF[aarx][offset0];
|
||||
ul_ch = &gNB->common_vars.rxdataF[beam_nb][aarx][offset0];
|
||||
symb_energy_aux += (signal_energy_nodc(ul_ch, end_sc + 1) * (end_sc + 1));
|
||||
symb_energy += symb_energy_aux / (rel15_ul->rb_size * NR_NB_SC_PER_RB);
|
||||
} else {
|
||||
@@ -1644,7 +1647,7 @@ int nr_rx_pusch_tp(PHY_VARS_gNB *gNB,
|
||||
c16_t temp_rxFext[frame_parms->nb_antennas_rx][buffer_length] __attribute__((aligned(32)));
|
||||
for (int aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++)
|
||||
for (int nl = 0; nl < rel15_ul->nrOfLayers; nl++)
|
||||
nr_ulsch_extract_rbs(gNB->common_vars.rxdataF[aarx],
|
||||
nr_ulsch_extract_rbs(gNB->common_vars.rxdataF[beam_nb][aarx],
|
||||
(c16_t *)pusch_vars->ul_ch_estimates[nl * frame_parms->nb_antennas_rx + aarx],
|
||||
temp_rxFext[aarx],
|
||||
(c16_t*)&ul_ch_estimates_ext[nl * frame_parms->nb_antennas_rx + aarx][meas_symbol * nb_re_pusch],
|
||||
@@ -1723,6 +1726,7 @@ int nr_rx_pusch_tp(PHY_VARS_gNB *gNB,
|
||||
rdata->llr_layers = pusch_vars->llr_layers;
|
||||
rdata->scramblingSequence = scramblingSequence;
|
||||
rdata->nvar = nvar;
|
||||
rdata->beam_nb = beam_nb;
|
||||
|
||||
if (rel15_ul->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) {
|
||||
nr_pusch_symbol_processing(rdata);
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
#include "PHY/defs_gNB.h"
|
||||
#include "PHY/sse_intrin.h"
|
||||
#include "PHY/NR_UE_TRANSPORT/pucch_nr.h"
|
||||
#include <openair1/PHY/CODING/nrSmallBlock/nr_small_block_defs.h>
|
||||
#include "PHY/CODING/nrSmallBlock/nr_small_block_defs.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
|
||||
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
|
||||
#include "PHY/NR_REFSIG/nr_refsig.h"
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "common/utils/LOG/vcd_signal_dumper.h"
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
#include "SCHED_NR/sched_nr.h"
|
||||
|
||||
#include "T.h"
|
||||
|
||||
@@ -62,15 +63,25 @@ void nr_fill_pucch(PHY_VARS_gNB *gNB,
|
||||
{
|
||||
|
||||
if (NFAPI_MODE == NFAPI_MODE_PNF)
|
||||
gNB->pucch[0].active = 0; // check if ture in monolithic mode
|
||||
gNB->pucch[0].active = false; // check if true in monolithic mode
|
||||
|
||||
bool found = false;
|
||||
for (int i = 0; i < gNB->max_nb_pucch; i++) {
|
||||
NR_gNB_PUCCH_t *pucch = &gNB->pucch[i];
|
||||
if (pucch->active == 0) {
|
||||
if (pucch->active == false) {
|
||||
pucch->frame = frame;
|
||||
pucch->slot = slot;
|
||||
pucch->active = 1;
|
||||
pucch->active = true;
|
||||
pucch->beam_nb = 0;
|
||||
if (gNB->common_vars.beam_id) {
|
||||
int fapi_beam_idx = pucch_pdu->beamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx;
|
||||
pucch->beam_nb = beam_index_allocation(fapi_beam_idx,
|
||||
&gNB->common_vars,
|
||||
slot,
|
||||
NR_NUMBER_OF_SYMBOLS_PER_SLOT,
|
||||
pucch_pdu->start_symbol_index,
|
||||
pucch_pdu->nr_of_symbols);
|
||||
}
|
||||
memcpy((void *)&pucch->pucch_pdu, (void *)pucch_pdu, sizeof(nfapi_nr_pucch_pdu_t));
|
||||
LOG_D(PHY,
|
||||
"Programming PUCCH[%d] for %d.%d, format %d, nb_harq %d, nb_sr %d, nb_csi %d\n",
|
||||
@@ -148,12 +159,12 @@ static const int16_t idft12_im[12][12] = {
|
||||
};
|
||||
//************************************************************************//
|
||||
void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
c16_t **rxdataF,
|
||||
int frame,
|
||||
int slot,
|
||||
nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu,
|
||||
nfapi_nr_pucch_pdu_t *pucch_pdu)
|
||||
{
|
||||
c16_t **rxdataF = gNB->common_vars.rxdataF;
|
||||
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
|
||||
int soffset = (slot & 3) * frame_parms->symbols_per_slot * frame_parms->ofdm_symbol_size;
|
||||
|
||||
@@ -1012,13 +1023,12 @@ void init_pucch2_luts() {
|
||||
|
||||
|
||||
void nr_decode_pucch2(PHY_VARS_gNB *gNB,
|
||||
c16_t **rxdataF,
|
||||
int frame,
|
||||
int slot,
|
||||
nfapi_nr_uci_pucch_pdu_format_2_3_4_t* uci_pdu,
|
||||
nfapi_nr_pucch_pdu_t* pucch_pdu)
|
||||
{
|
||||
|
||||
c16_t **rxdataF = gNB->common_vars.rxdataF;
|
||||
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
|
||||
//pucch_GroupHopping_t pucch_GroupHopping = pucch_pdu->group_hop_flag + (pucch_pdu->sequence_hop_flag<<1);
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "PHY/CODING/nrSmallBlock/nr_small_block_defs.h"
|
||||
#include "PHY/NR_UE_TRANSPORT/srs_modulation_nr.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
|
||||
#include "SCHED_NR/sched_nr.h"
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
|
||||
#include "T.h"
|
||||
@@ -50,11 +50,21 @@ void nr_fill_srs(PHY_VARS_gNB *gNB, frame_t frame, slot_t slot, nfapi_nr_srs_pdu
|
||||
bool found = false;
|
||||
for (int i = 0; i < gNB->max_nb_srs; i++) {
|
||||
NR_gNB_SRS_t *srs = &gNB->srs[i];
|
||||
if (srs->active == 0) {
|
||||
if (srs->active == false) {
|
||||
found = true;
|
||||
srs->frame = frame;
|
||||
srs->slot = slot;
|
||||
srs->active = 1;
|
||||
srs->active = true;
|
||||
srs->beam_nb = 0;
|
||||
if (gNB->common_vars.beam_id) {
|
||||
int fapi_beam_idx = srs_pdu->beamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx;
|
||||
srs->beam_nb = beam_index_allocation(fapi_beam_idx,
|
||||
&gNB->common_vars,
|
||||
slot,
|
||||
NR_NUMBER_OF_SYMBOLS_PER_SLOT,
|
||||
srs_pdu->time_start_position,
|
||||
1 << srs_pdu->num_symbols);
|
||||
}
|
||||
memcpy((void *)&srs->srs_pdu, (void *)srs_pdu, sizeof(nfapi_nr_srs_pdu_t));
|
||||
break;
|
||||
}
|
||||
@@ -63,13 +73,13 @@ void nr_fill_srs(PHY_VARS_gNB *gNB, frame_t frame, slot_t slot, nfapi_nr_srs_pdu
|
||||
}
|
||||
|
||||
int nr_get_srs_signal(PHY_VARS_gNB *gNB,
|
||||
c16_t **rxdataF,
|
||||
frame_t frame,
|
||||
slot_t slot,
|
||||
nfapi_nr_srs_pdu_t *srs_pdu,
|
||||
nr_srs_info_t *nr_srs_info,
|
||||
int32_t srs_received_signal[][gNB->frame_parms.ofdm_symbol_size * (1 << srs_pdu->num_symbols)])
|
||||
{
|
||||
c16_t **rxdataF = gNB->common_vars.rxdataF;
|
||||
const NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
|
||||
|
||||
const uint16_t n_symbols = (slot % RU_RX_SLOT_DEPTH) * frame_parms->symbols_per_slot; // number of symbols until this slot
|
||||
|
||||
@@ -130,9 +130,9 @@ typedef struct {
|
||||
/// - third index: frequency [0..]
|
||||
int32_t **tdd_calib_coeffs;
|
||||
/// \brief Anaglogue beam ID for each OFDM symbol (used when beamforming not done in RU)
|
||||
/// - first index: antenna port
|
||||
/// - first index: concurrent beam
|
||||
/// - second index: beam_id [0.. symbols_per_frame[
|
||||
uint8_t **beam_id;
|
||||
int **beam_id;
|
||||
} RU_COMMON;
|
||||
|
||||
|
||||
|
||||
+18
-9
@@ -123,8 +123,6 @@ typedef struct {
|
||||
typedef struct {
|
||||
/// Pointers to variables related to DLSCH harq process
|
||||
NR_DL_gNB_HARQ_t harq_process;
|
||||
/// beamforming weights for UE-spec transmission (antenna ports 5 or 7..14), for each codeword, maximum 4 layers?
|
||||
int32_t ***ue_spec_bf_weights;
|
||||
/// Active flag for baseband transmitter processing
|
||||
uint8_t active;
|
||||
/// Number of soft channel bits
|
||||
@@ -139,6 +137,8 @@ typedef struct {
|
||||
typedef struct {
|
||||
int frame;
|
||||
int slot;
|
||||
// identifier for concurrent beams
|
||||
int beam_nb;
|
||||
nfapi_nr_prach_pdu_t pdu;
|
||||
} gNB_PRACH_list_t;
|
||||
|
||||
@@ -223,6 +223,8 @@ typedef struct {
|
||||
typedef struct {
|
||||
uint32_t frame;
|
||||
uint32_t slot;
|
||||
// identifier for concurrent beams
|
||||
int beam_nb;
|
||||
uint32_t unav_res;
|
||||
/// Pointers to 16 HARQ processes for the ULSCH
|
||||
NR_UL_gNB_HARQ_t *harq_process;
|
||||
@@ -243,7 +245,9 @@ typedef struct {
|
||||
} NR_gNB_ULSCH_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t active;
|
||||
bool active;
|
||||
// identifier for concurrent beams
|
||||
int beam_nb;
|
||||
/// Frame where current PUCCH pdu was sent
|
||||
uint32_t frame;
|
||||
/// Slot where current PUCCH pdu was sent
|
||||
@@ -253,7 +257,9 @@ typedef struct {
|
||||
} NR_gNB_PUCCH_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t active;
|
||||
bool active;
|
||||
// identifier for concurrent beams
|
||||
int beam_nb;
|
||||
/// Frame where current SRS pdu was received
|
||||
uint32_t frame;
|
||||
/// Slot where current SRS pdu was received
|
||||
@@ -266,17 +272,20 @@ typedef struct {
|
||||
/// \brief Pointers (dynamic) to the received data in the frequency domain.
|
||||
/// - first index: rx antenna [0..nb_antennas_rx[
|
||||
/// - second index: ? [0..2*ofdm_symbol_size*frame_parms->symbols_per_tti[
|
||||
c16_t **rxdataF;
|
||||
c16_t ***rxdataF;
|
||||
/// \brief holds the transmit data in the frequency domain.
|
||||
/// For IFFT_FPGA this points to the same memory as PHY_vars->rx_vars[a].RX_DMA_BUFFER. //?
|
||||
/// - first index: eNB id [0..2] (hard coded)
|
||||
/// - first index: beam (for concurrent beams)
|
||||
/// - second index: tx antenna [0..14[ where 14 is the total supported antenna ports.
|
||||
/// - third index: sample [0..samples_per_frame_woCP]
|
||||
c16_t **txdataF;
|
||||
c16_t ***txdataF;
|
||||
/// \brief Anaglogue beam ID for each OFDM symbol (used when beamforming not done in RU)
|
||||
/// - first index: antenna port
|
||||
/// - first index: beam index (for concurrent beams)
|
||||
/// - second index: beam_id [0.. symbols_per_frame[
|
||||
uint8_t **beam_id;
|
||||
int **beam_id;
|
||||
int num_beams;
|
||||
int num_beams_period;
|
||||
bool analog_bf;
|
||||
int32_t *debugBuff;
|
||||
int32_t debugBuff_sample_offset;
|
||||
} NR_gNB_COMMON;
|
||||
|
||||
@@ -157,7 +157,9 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO)
|
||||
uint8_t number_ul_tti_pdu = (UL_tti_req==NULL) ? 0 : UL_tti_req->n_pdus;
|
||||
uint8_t number_tx_data_pdu = (TX_req == NULL) ? 0 : TX_req->Number_of_PDUs;
|
||||
|
||||
if (NFAPI_MODE == NFAPI_MONOLITHIC){
|
||||
clear_slot_beamid(gNB, slot); // reset beam_id information for the slot to be processed
|
||||
|
||||
if (NFAPI_MODE == NFAPI_MONOLITHIC) {
|
||||
if (slot_type == NR_DOWNLINK_SLOT || slot_type == NR_MIXED_SLOT) {
|
||||
processingData_L1tx_t *msgTx = gNB->msgDataTx;
|
||||
msgTx->num_pdsch_slot = 0;
|
||||
@@ -227,8 +229,8 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO)
|
||||
LOG_D(NR_PHY,"frame %d, slot %d, Got NFAPI_NR_UL_TTI_PRACH_PDU_TYPE for %d.%d\n", frame, slot, UL_tti_req->SFN, UL_tti_req->Slot);
|
||||
nfapi_nr_prach_pdu_t *prach_pdu = &UL_tti_req->pdus_list[i].prach_pdu;
|
||||
nr_fill_prach(gNB, UL_tti_req->SFN, UL_tti_req->Slot, prach_pdu);
|
||||
if (gNB->RU_list[0]->if_south == LOCAL_RF ||
|
||||
gNB->RU_list[0]->if_south == REMOTE_IF5) nr_fill_prach_ru(gNB->RU_list[0], UL_tti_req->SFN, UL_tti_req->Slot, prach_pdu);
|
||||
if (gNB->RU_list[0]->if_south == LOCAL_RF || gNB->RU_list[0]->if_south == REMOTE_IF5)
|
||||
nr_fill_prach_ru(gNB->RU_list[0], UL_tti_req->SFN, UL_tti_req->Slot, prach_pdu);
|
||||
break;
|
||||
case NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE:
|
||||
LOG_D(NR_PHY,"frame %d, slot %d, Got NFAPI_NR_UL_CONFIG_SRS_PDU_TYPE for %d.%d\n", frame, slot, UL_tti_req->SFN, UL_tti_req->Slot);
|
||||
|
||||
@@ -52,28 +52,37 @@
|
||||
extern int oai_exit;
|
||||
|
||||
// OFDM modulation core routine, generates a first_symbol to first_symbol+num_symbols on a particular slot and TX antenna port
|
||||
void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa) {
|
||||
|
||||
void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa)
|
||||
{
|
||||
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
|
||||
|
||||
unsigned int slot_offset,slot_offsetF;
|
||||
int slot = tti_tx;
|
||||
|
||||
|
||||
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+(first_symbol!=0?1:0) , 1 );
|
||||
|
||||
if (aa==0 && first_symbol == 0) start_meas(&ru->ofdm_mod_stats);
|
||||
slot_offset = fp->get_samples_slot_timestamp(slot,fp,0);
|
||||
slot_offsetF = first_symbol*fp->ofdm_symbol_size;
|
||||
if (aa == 0 && first_symbol == 0)
|
||||
start_meas(&ru->ofdm_mod_stats);
|
||||
slot_offset = fp->get_samples_slot_timestamp(slot, fp, 0);
|
||||
slot_offsetF = first_symbol * fp->ofdm_symbol_size;
|
||||
|
||||
int abs_first_symbol = slot*fp->symbols_per_slot;
|
||||
int abs_first_symbol = slot * fp->symbols_per_slot;
|
||||
|
||||
for (uint16_t idx_sym=abs_first_symbol; idx_sym<abs_first_symbol+first_symbol; idx_sym++)
|
||||
slot_offset += (idx_sym%(0x7<<fp->numerology_index)) ? fp->nb_prefix_samples : fp->nb_prefix_samples0;
|
||||
for (int idx_sym = abs_first_symbol; idx_sym < abs_first_symbol + first_symbol; idx_sym++)
|
||||
slot_offset += (idx_sym % (0x7 << fp->numerology_index)) ? fp->nb_prefix_samples : fp->nb_prefix_samples0;
|
||||
|
||||
slot_offset += fp->ofdm_symbol_size*first_symbol;
|
||||
slot_offset += fp->ofdm_symbol_size * first_symbol;
|
||||
|
||||
LOG_D(PHY,"SFN/SF:RU:TX:%d/%d aa %d Generating slot %d (first_symbol %d num_symbols %d) slot_offset %d, slot_offsetF %d\n",ru->proc.frame_tx, ru->proc.tti_tx,aa,slot,first_symbol,num_symbols,slot_offset,slot_offsetF);
|
||||
LOG_D(PHY,
|
||||
"SFN/SF:RU:TX:%d/%d aa %d Generating slot %d (first_symbol %d num_symbols %d) slot_offset %d, slot_offsetF %d\n",
|
||||
ru->proc.frame_tx,
|
||||
ru->proc.tti_tx,
|
||||
aa,
|
||||
slot,
|
||||
first_symbol,
|
||||
num_symbols,
|
||||
slot_offset,
|
||||
slot_offsetF);
|
||||
|
||||
if (fp->Ncp == 1) {
|
||||
PHY_ofdm_mod(&ru->common.txdataF_BF[aa][slot_offsetF],
|
||||
@@ -110,8 +119,8 @@ void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa) {
|
||||
}
|
||||
} // numerology_index!=0
|
||||
else { //numerology_index == 0
|
||||
for (uint16_t idx_sym=abs_first_symbol; idx_sym<abs_first_symbol+num_symbols; idx_sym++) {
|
||||
if (idx_sym%0x7) {
|
||||
for (int idx_sym = abs_first_symbol; idx_sym < abs_first_symbol+num_symbols; idx_sym++) {
|
||||
if (idx_sym % 0x7) {
|
||||
PHY_ofdm_mod(&ru->common.txdataF_BF[aa][slot_offsetF],
|
||||
(int*)&ru->common.txdata[aa][slot_offset],
|
||||
fp->ofdm_symbol_size,
|
||||
@@ -135,7 +144,8 @@ void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa) {
|
||||
} // numerology 0
|
||||
}
|
||||
|
||||
if (aa==0 && first_symbol==0) stop_meas(&ru->ofdm_mod_stats);
|
||||
if (aa == 0 && first_symbol == 0)
|
||||
stop_meas(&ru->ofdm_mod_stats);
|
||||
|
||||
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM+(first_symbol!=0?1:0), 0);
|
||||
}
|
||||
@@ -170,167 +180,165 @@ void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx) {
|
||||
|
||||
}
|
||||
|
||||
void nr_feptx_prec(RU_t *ru,int frame_tx,int tti_tx) {
|
||||
|
||||
int l,aa;
|
||||
void nr_feptx_prec(RU_t *ru, int frame_tx, int tti_tx)
|
||||
{
|
||||
PHY_VARS_gNB **gNB_list = ru->gNB_list,*gNB;
|
||||
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
|
||||
nfapi_nr_config_request_scf_t *cfg = &ru->gNB_list[0]->gNB_config;
|
||||
int32_t ***bw;
|
||||
int i=0;
|
||||
int slot_tx = tti_tx;
|
||||
int txdataF_offset = (tti_tx*fp->samples_per_slot_wCP);
|
||||
|
||||
start_meas(&ru->precoding_stats);
|
||||
AssertFatal(ru->nb_log_antennas > 0,"ru->nb_log_antennas is 0!\n");
|
||||
if (ru->num_gNB == 1){
|
||||
AssertFatal(ru->nb_log_antennas > 0, "ru->nb_log_antennas is 0!\n");
|
||||
|
||||
if (nr_slot_select(cfg,frame_tx,slot_tx) == NR_UPLINK_SLOT)
|
||||
return;
|
||||
|
||||
if (ru->num_gNB == 1) {
|
||||
gNB = gNB_list[0];
|
||||
|
||||
if (nr_slot_select(cfg,frame_tx,slot_tx) == NR_UPLINK_SLOT) return;
|
||||
if (ru->config.dbt_config.num_dig_beams != 0) {
|
||||
for(int i = 0; i < gNB->common_vars.num_beams_period; ++i) {
|
||||
memcpy((void*) &ru->common.beam_id[i][slot_tx * fp->symbols_per_slot],
|
||||
(void*) &gNB->common_vars.beam_id[i][slot_tx * fp->symbols_per_slot],
|
||||
(fp->symbols_per_slot) * sizeof(int));
|
||||
}
|
||||
}
|
||||
|
||||
if (!ru->do_precoding || (ru->nb_tx == 1 && ru->nb_log_antennas == 1)) {
|
||||
for (i = 0; i < ru->nb_log_antennas; ++i) {
|
||||
//ru->common.txdataF_BF[i] = (int32_t *)&gNB->common_vars.txdataF[i][txdataF_offset];
|
||||
memcpy(ru->common.txdataF_BF[i],
|
||||
&gNB->common_vars.txdataF[i][txdataF_offset],
|
||||
fp->samples_per_slot_wCP*sizeof(int32_t));
|
||||
if (ru->config.dbt_config.num_dig_beams == 0 || gNB->common_vars.analog_bf) {
|
||||
for (int i = 0; i < ru->nb_log_antennas; ++i) {
|
||||
// TODO hardcoded beam to 0, still need to understand how to handle this properly
|
||||
memcpy(ru->common.txdataF_BF[i], &gNB->common_vars.txdataF[0][i][txdataF_offset], fp->samples_per_slot_wCP * sizeof(int32_t));
|
||||
}
|
||||
}
|
||||
else {
|
||||
for(i=0; i<ru->nb_log_antennas; ++i) {
|
||||
memcpy((void*)ru->common.txdataF[i],
|
||||
(void*)&gNB->common_vars.txdataF[i][txdataF_offset],
|
||||
fp->samples_per_slot_wCP*sizeof(int32_t));
|
||||
memcpy((void*)&ru->common.beam_id[i][slot_tx*fp->symbols_per_slot],
|
||||
(void*)&gNB->common_vars.beam_id[i][slot_tx*fp->symbols_per_slot],
|
||||
fp->symbols_per_slot*sizeof(uint8_t));
|
||||
for(int i = 0; i < ru->nb_log_antennas; ++i) {
|
||||
// TODO hardcoded beam to 0, still need to understand how to handle this properly
|
||||
memcpy(ru->common.txdataF[i], &gNB->common_vars.txdataF[0][i][txdataF_offset], fp->samples_per_slot_wCP * sizeof(int32_t));
|
||||
}
|
||||
bw = ru->beam_weights[0];
|
||||
for (l=0;l<fp->symbols_per_slot;l++) {
|
||||
for (aa=0;aa<ru->nb_tx;aa++) {
|
||||
for (int l = 0; l < fp->symbols_per_slot; l++) {
|
||||
for (int aa = 0; aa < ru->nb_tx; aa++) {
|
||||
AssertFatal(false, "This needs to be fixed by using appropriate beams from config\n");
|
||||
nr_beam_precoding((c16_t **)ru->common.txdataF,
|
||||
(c16_t **)ru->common.txdataF_BF,
|
||||
fp,
|
||||
bw,
|
||||
ru->beam_weights[0],
|
||||
tti_tx,
|
||||
l,
|
||||
aa,
|
||||
ru->nb_log_antennas,
|
||||
0);
|
||||
}// for (aa=0;aa<ru->nb_tx;aa++)
|
||||
}// for (l=0;l<fp->symbols_per_slot;l++)
|
||||
}// ru->do_precoding
|
||||
}// if (ru->num_gNB == 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stop_meas(&ru->precoding_stats);
|
||||
}
|
||||
|
||||
// core routine for FEP TX, called from threads in RU TX thread-pool
|
||||
void nr_feptx(void *arg) {
|
||||
|
||||
void nr_feptx(void *arg)
|
||||
{
|
||||
feptx_cmd_t *feptx = (feptx_cmd_t *)arg;
|
||||
|
||||
RU_t *ru = feptx->ru;
|
||||
int slot = feptx->slot;
|
||||
int aa = feptx->aid;
|
||||
int startSymbol = feptx->startSymbol;
|
||||
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
|
||||
int numSymbols = feptx->numSymbols;
|
||||
int numSamples = feptx->numSymbols*fp->ofdm_symbol_size;
|
||||
int txdataF_offset = (slot*fp->samples_per_slot_wCP) + startSymbol*fp->ofdm_symbol_size;
|
||||
int txdataF_BF_offset = startSymbol*fp->ofdm_symbol_size;
|
||||
RU_t *ru = feptx->ru;
|
||||
int slot = feptx->slot;
|
||||
int aa = feptx->aid;
|
||||
int startSymbol = feptx->startSymbol;
|
||||
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
|
||||
int numSymbols = feptx->numSymbols;
|
||||
int numSamples = feptx->numSymbols * fp->ofdm_symbol_size;
|
||||
int txdataF_offset = (slot * fp->samples_per_slot_wCP) + startSymbol * fp->ofdm_symbol_size;
|
||||
int txdataF_BF_offset = startSymbol * fp->ofdm_symbol_size;
|
||||
|
||||
////////////precoding////////////
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC+feptx->aid , 1);
|
||||
|
||||
if (aa==0) start_meas(&ru->precoding_stats);
|
||||
|
||||
if (ru->do_precoding == 1) {
|
||||
for(int i=0; i<ru->nb_log_antennas; ++i) {
|
||||
memcpy((void*) &ru->common.beam_id[i][slot*fp->symbols_per_slot],
|
||||
(void*) &ru->gNB_list[0]->common_vars.beam_id[i][slot*fp->symbols_per_slot],
|
||||
(fp->symbols_per_slot)*sizeof(uint8_t));
|
||||
if (aa == 0)
|
||||
start_meas(&ru->precoding_stats);
|
||||
|
||||
if (ru->config.dbt_config.num_dig_beams != 0) {
|
||||
for(int i = 0; i < ru->gNB_list[0]->common_vars.num_beams_period; i++) {
|
||||
memcpy(&ru->common.beam_id[i][slot * fp->symbols_per_slot],
|
||||
&ru->gNB_list[0]->common_vars.beam_id[i][slot * fp->symbols_per_slot],
|
||||
(fp->symbols_per_slot) * sizeof(int));
|
||||
}
|
||||
}
|
||||
|
||||
if (ru->nb_tx == 1 && ru->nb_log_antennas == 1) {
|
||||
memcpy((void*)&ru->common.txdataF_BF[0][txdataF_BF_offset],
|
||||
(void*)&ru->gNB_list[0]->common_vars.txdataF[0][txdataF_offset],
|
||||
numSamples*sizeof(int32_t));
|
||||
}
|
||||
else if (ru->do_precoding == 0) {
|
||||
int gNB_tx = ru->gNB_list[0]->frame_parms.nb_antennas_tx;
|
||||
// If there is no digital beamforming we just need to copy the data to RU
|
||||
if (ru->config.dbt_config.num_dig_beams == 0 || ru->gNB_list[0]->common_vars.analog_bf)
|
||||
memcpy((void*)&ru->common.txdataF_BF[aa][txdataF_BF_offset],
|
||||
(void*)&ru->gNB_list[0]->common_vars.txdataF[aa%gNB_tx][txdataF_offset],
|
||||
numSamples*sizeof(int32_t));
|
||||
}
|
||||
(void*)&ru->gNB_list[0]->common_vars.txdataF[0][aa][txdataF_offset], // TODO hardcoded beam to 0, still need to understand how to handle this properly
|
||||
numSamples * sizeof(int32_t));
|
||||
else {
|
||||
AssertFatal(1==0,"This needs to be fixed, do not use beamforming.\n");
|
||||
int32_t ***bw = ru->beam_weights[0];
|
||||
for(int i=0; i<fp->symbols_per_slot; ++i){
|
||||
AssertFatal(false, "This needs to be fixed by using appropriate beams from config\n");
|
||||
for(int i = 0; i < fp->symbols_per_slot; ++i) {
|
||||
nr_beam_precoding((c16_t **)ru->gNB_list[0]->common_vars.txdataF,
|
||||
(c16_t **)ru->common.txdataF_BF,
|
||||
fp,
|
||||
bw,
|
||||
ru->beam_weights[0],
|
||||
slot,
|
||||
i,
|
||||
aa,
|
||||
ru->nb_log_antennas,
|
||||
txdataF_offset);//here
|
||||
txdataF_offset);
|
||||
}
|
||||
}
|
||||
if (aa==0) stop_meas(&ru->precoding_stats);
|
||||
|
||||
if (aa==0)
|
||||
stop_meas(&ru->precoding_stats);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_PREC+feptx->aid , 0);
|
||||
|
||||
////////////FEPTX////////////
|
||||
nr_feptx0(ru,slot,startSymbol,numSymbols,aa);
|
||||
nr_feptx0(ru, slot, startSymbol, numSymbols, aa);
|
||||
}
|
||||
|
||||
// RU FEP TX using thread-pool
|
||||
void nr_feptx_tp(RU_t *ru, int frame_tx, int slot) {
|
||||
|
||||
void nr_feptx_tp(RU_t *ru, int frame_tx, int slot)
|
||||
{
|
||||
nfapi_nr_config_request_scf_t *cfg = &ru->gNB_list[0]->gNB_config;
|
||||
int nbfeptx=0;
|
||||
if (nr_slot_select(cfg,frame_tx,slot) == NR_UPLINK_SLOT) return;
|
||||
// for (int aa=0; aa<ru->nb_tx; aa++) memset(ru->common.txdataF[aa],0,ru->nr_frame_parms->samples_per_slot_wCP*sizeof(int32_t));
|
||||
|
||||
if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM, 1 );
|
||||
int nbfeptx = 0;
|
||||
if (nr_slot_select(cfg, frame_tx, slot) == NR_UPLINK_SLOT)
|
||||
return;
|
||||
if (ru->idx == 0)
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM, 1);
|
||||
start_meas(&ru->ofdm_total_stats);
|
||||
for (int aid=0;aid<ru->nb_tx;aid++) {
|
||||
notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(feptx_cmd_t), 2000 + aid,ru->respfeptx,nr_feptx);
|
||||
feptx_cmd_t *feptx_cmd=(feptx_cmd_t*)NotifiedFifoData(req);
|
||||
feptx_cmd->aid = aid;
|
||||
feptx_cmd->ru = ru;
|
||||
feptx_cmd->slot = slot;
|
||||
feptx_cmd->startSymbol = 0;
|
||||
feptx_cmd->numSymbols = (ru->half_slot_parallelization>0)?ru->nr_frame_parms->symbols_per_slot>>1:ru->nr_frame_parms->symbols_per_slot;
|
||||
pushTpool(ru->threadPool,req);
|
||||
nbfeptx++;
|
||||
if (ru->half_slot_parallelization>0) {
|
||||
notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(feptx_cmd_t), 2000 + aid + ru->nb_tx,ru->respfeptx,nr_feptx);
|
||||
feptx_cmd_t *feptx_cmd=(feptx_cmd_t*)NotifiedFifoData(req);
|
||||
feptx_cmd->aid = aid;
|
||||
feptx_cmd->ru = ru;
|
||||
feptx_cmd->slot = slot;
|
||||
feptx_cmd->startSymbol = ru->nr_frame_parms->symbols_per_slot>>1;
|
||||
feptx_cmd->numSymbols = ru->nr_frame_parms->symbols_per_slot>>1;
|
||||
pushTpool(ru->threadPool,req);
|
||||
nbfeptx++;
|
||||
}
|
||||
for (int aid = 0; aid < ru->nb_tx; aid++) {
|
||||
notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(feptx_cmd_t), 2000 + aid, ru->respfeptx, nr_feptx);
|
||||
feptx_cmd_t *feptx_cmd = (feptx_cmd_t*)NotifiedFifoData(req);
|
||||
feptx_cmd->aid = aid;
|
||||
feptx_cmd->ru = ru;
|
||||
feptx_cmd->slot = slot;
|
||||
feptx_cmd->startSymbol = 0;
|
||||
feptx_cmd->numSymbols = (ru->half_slot_parallelization > 0) ?
|
||||
ru->nr_frame_parms->symbols_per_slot >> 1 :
|
||||
ru->nr_frame_parms->symbols_per_slot;
|
||||
pushTpool(ru->threadPool, req);
|
||||
nbfeptx++;
|
||||
if (ru->half_slot_parallelization > 0) {
|
||||
notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(feptx_cmd_t), 2000 + aid + ru->nb_tx, ru->respfeptx, nr_feptx);
|
||||
feptx_cmd_t *feptx_cmd = (feptx_cmd_t*)NotifiedFifoData(req);
|
||||
feptx_cmd->aid = aid;
|
||||
feptx_cmd->ru = ru;
|
||||
feptx_cmd->slot = slot;
|
||||
feptx_cmd->startSymbol = ru->nr_frame_parms->symbols_per_slot >> 1;
|
||||
feptx_cmd->numSymbols = ru->nr_frame_parms->symbols_per_slot >> 1;
|
||||
pushTpool(ru->threadPool, req);
|
||||
nbfeptx++;
|
||||
}
|
||||
}
|
||||
while (nbfeptx>0) {
|
||||
while (nbfeptx > 0) {
|
||||
notifiedFIFO_elt_t *req=pullTpool(ru->respfeptx, ru->threadPool);
|
||||
delNotifiedFIFO_elt(req);
|
||||
nbfeptx--;
|
||||
}
|
||||
stop_meas(&ru->ofdm_total_stats);
|
||||
if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM, 0 );
|
||||
if (ru->idx == 0)
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM, 0);
|
||||
}
|
||||
|
||||
// core RX FEP routine, called by threads in RU thread-pool
|
||||
void nr_fep(void* arg)
|
||||
{
|
||||
feprx_cmd_t *feprx_cmd = (feprx_cmd_t *)arg;
|
||||
|
||||
RU_t *ru = feprx_cmd->ru;
|
||||
int aid = feprx_cmd->aid;
|
||||
int tti_rx = feprx_cmd->slot;
|
||||
@@ -338,7 +346,7 @@ void nr_fep(void* arg)
|
||||
int endSymbol = feprx_cmd->endSymbol;
|
||||
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
|
||||
|
||||
LOG_D(PHY,"In nr_fep for aid %d, slot = %d, startSymbol %d, endSymbol %d\n", aid, tti_rx,startSymbol,endSymbol);
|
||||
LOG_D(PHY,"aid %d, frame %d slot %d, startSymbol %d, endSymbol %d\n", aid, ru->proc.frame_rx, tti_rx, startSymbol, endSymbol);
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX+aid, 1);
|
||||
|
||||
|
||||
@@ -43,23 +43,42 @@
|
||||
//#define DEBUG_RXDATA
|
||||
//#define SRS_IND_DEBUG
|
||||
|
||||
extern uint8_t nfapi_mode;
|
||||
int beam_index_allocation(int fapi_beam_index,
|
||||
NR_gNB_COMMON *common_vars,
|
||||
int slot,
|
||||
int symbols_per_slot,
|
||||
int start_symbol,
|
||||
int nb_symbols)
|
||||
{
|
||||
if (!common_vars->beam_id)
|
||||
return 0;
|
||||
|
||||
void nr_common_signal_procedures(PHY_VARS_gNB *gNB, int frame,int slot, nfapi_nr_dl_tti_ssb_pdu ssb_pdu)
|
||||
int idx = -1;
|
||||
for (int j = 0; j < common_vars->num_beams_period; j++) {
|
||||
for (int i = start_symbol; i < start_symbol + nb_symbols; i++) {
|
||||
int current_beam = common_vars->beam_id[j][slot * symbols_per_slot + i];
|
||||
if (current_beam == -1 || current_beam == fapi_beam_index)
|
||||
idx = j;
|
||||
else {
|
||||
idx = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (idx != -1)
|
||||
break;
|
||||
}
|
||||
AssertFatal(idx >= 0, "Couldn't allocate beam ID %d\n", fapi_beam_index);
|
||||
for (int j = start_symbol; j < start_symbol + nb_symbols; j++)
|
||||
common_vars->beam_id[idx][slot * symbols_per_slot + j] = fapi_beam_index;
|
||||
LOG_D(PHY, "Allocating beam %d in slot %d\n", idx, slot);
|
||||
return idx;
|
||||
}
|
||||
|
||||
void nr_common_signal_procedures(PHY_VARS_gNB *gNB, int frame, int slot, nfapi_nr_dl_tti_ssb_pdu ssb_pdu)
|
||||
{
|
||||
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
|
||||
nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config;
|
||||
c16_t **txdataF = gNB->common_vars.txdataF;
|
||||
uint8_t n_hf;
|
||||
int txdataF_offset = slot*fp->samples_per_slot_wCP;
|
||||
uint16_t slots_per_hf = (fp->slots_per_frame) >> 1;
|
||||
|
||||
if (slot<slots_per_hf)
|
||||
n_hf=0;
|
||||
else
|
||||
n_hf=1;
|
||||
|
||||
uint8_t ssb_index = ssb_pdu.ssb_pdu_rel15.SsbBlockIndex;
|
||||
nfapi_nr_dl_tti_ssb_pdu_rel15_t *pdu = &ssb_pdu.ssb_pdu_rel15;
|
||||
uint8_t ssb_index = pdu->SsbBlockIndex;
|
||||
LOG_D(PHY,"common_signal_procedures: frame %d, slot %d ssb index %d\n", frame, slot, ssb_index);
|
||||
|
||||
int ssb_start_symbol_abs = nr_get_ssb_start_symbol(fp, ssb_index); // computing the starting symbol for current ssb
|
||||
@@ -70,11 +89,10 @@ void nr_common_signal_procedures(PHY_VARS_gNB *gNB, int frame,int slot, nfapi_nr
|
||||
// for FR1 offsetToPointA and k_SSB are expressed in terms of 15 kHz SCS
|
||||
// for FR2 offsetToPointA is expressed in terms of 60 kHz SCS and k_SSB expressed in terms of the subcarrier spacing provided
|
||||
// by the higher-layer parameter subCarrierSpacingCommon
|
||||
nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config;
|
||||
const int scs = cfg->ssb_config.scs_common.value;
|
||||
const int prb_offset = (fp->freq_range == FR1) ? ssb_pdu.ssb_pdu_rel15.ssbOffsetPointA >> scs
|
||||
: ssb_pdu.ssb_pdu_rel15.ssbOffsetPointA >> (scs - 2);
|
||||
const int sc_offset =
|
||||
(fp->freq_range == FR1) ? ssb_pdu.ssb_pdu_rel15.SsbSubcarrierOffset >> scs : ssb_pdu.ssb_pdu_rel15.SsbSubcarrierOffset;
|
||||
const int prb_offset = (fp->freq_range == FR1) ? pdu->ssbOffsetPointA >> scs : pdu->ssbOffsetPointA >> (scs - 2);
|
||||
const int sc_offset = (fp->freq_range == FR1) ? pdu->SsbSubcarrierOffset >> scs : pdu->SsbSubcarrierOffset;
|
||||
fp->ssb_start_subcarrier = (12 * prb_offset + sc_offset);
|
||||
|
||||
if (fp->print_ue_help_cmdline_log && get_softmodem_params()->sa) {
|
||||
@@ -99,20 +117,34 @@ void nr_common_signal_procedures(PHY_VARS_gNB *gNB, int frame,int slot, nfapi_nr
|
||||
}
|
||||
LOG_D(PHY,
|
||||
"ssbOffsetPointA %d SSB SsbSubcarrierOffset %d prb_offset %d sc_offset %d scs %d ssb_start_subcarrier %d\n",
|
||||
ssb_pdu.ssb_pdu_rel15.ssbOffsetPointA,
|
||||
ssb_pdu.ssb_pdu_rel15.SsbSubcarrierOffset,
|
||||
pdu->ssbOffsetPointA,
|
||||
pdu->SsbSubcarrierOffset,
|
||||
prb_offset,
|
||||
sc_offset,
|
||||
scs,
|
||||
fp->ssb_start_subcarrier);
|
||||
|
||||
LOG_D(PHY,"SS TX: frame %d, slot %d, start_symbol %d\n",frame,slot, ssb_start_symbol);
|
||||
nr_generate_pss(&txdataF[0][txdataF_offset], gNB->TX_AMP, ssb_start_symbol, cfg, fp);
|
||||
nr_generate_sss(&txdataF[0][txdataF_offset], gNB->TX_AMP, ssb_start_symbol, cfg, fp);
|
||||
LOG_D(PHY,"SS TX: frame %d, slot %d, start_symbol %d\n", frame, slot, ssb_start_symbol);
|
||||
nfapi_nr_tx_precoding_and_beamforming_t *pb = &pdu->precoding_and_beamforming;
|
||||
c16_t ***txdataF = gNB->common_vars.txdataF;
|
||||
int txdataF_offset = slot * fp->samples_per_slot_wCP;
|
||||
// beam number in a scenario with multiple concurrent beams
|
||||
int beam_nb = beam_index_allocation(pb->prgs_list[0].dig_bf_interface_list[0].beam_idx,
|
||||
&gNB->common_vars,
|
||||
slot,
|
||||
fp->symbols_per_slot,
|
||||
ssb_start_symbol,
|
||||
4); // 4 ssb symbols
|
||||
|
||||
nr_generate_pss(&txdataF[beam_nb][0][txdataF_offset], gNB->TX_AMP, ssb_start_symbol, cfg, fp);
|
||||
nr_generate_sss(&txdataF[beam_nb][0][txdataF_offset], gNB->TX_AMP, ssb_start_symbol, cfg, fp);
|
||||
|
||||
uint16_t slots_per_hf = (fp->slots_per_frame) >> 1;
|
||||
int n_hf = slot < slots_per_hf ? 0 : 1;
|
||||
|
||||
int hf = fp->Lmax == 4 ? n_hf : 0;
|
||||
nr_generate_pbch_dmrs(nr_gold_pbch(fp->Lmax, gNB->gNB_config.cell_config.phy_cell_id.value, hf, ssb_index & 7),
|
||||
&txdataF[0][txdataF_offset],
|
||||
&txdataF[beam_nb][0][txdataF_offset],
|
||||
gNB->TX_AMP,
|
||||
ssb_start_symbol,
|
||||
cfg,
|
||||
@@ -121,23 +153,16 @@ void nr_common_signal_procedures(PHY_VARS_gNB *gNB, int frame,int slot, nfapi_nr
|
||||
#if T_TRACER
|
||||
if (T_ACTIVE(T_GNB_PHY_MIB)) {
|
||||
unsigned char bch[3];
|
||||
bch[0] = ssb_pdu.ssb_pdu_rel15.bchPayload & 0xff;
|
||||
bch[1] = (ssb_pdu.ssb_pdu_rel15.bchPayload >> 8) & 0xff;
|
||||
bch[2] = (ssb_pdu.ssb_pdu_rel15.bchPayload >> 16) & 0xff;
|
||||
bch[0] = pdu->bchPayload & 0xff;
|
||||
bch[1] = (pdu->bchPayload >> 8) & 0xff;
|
||||
bch[2] = (pdu->bchPayload >> 16) & 0xff;
|
||||
T(T_GNB_PHY_MIB, T_INT(0) /* module ID */, T_INT(frame), T_INT(slot), T_BUFFER(bch, 3));
|
||||
}
|
||||
#endif
|
||||
|
||||
// Beam_id is currently used only for FR2
|
||||
if (fp->freq_range == FR2){
|
||||
LOG_D(PHY,"slot %d, ssb_index %d, beam %d\n",slot,ssb_index,cfg->ssb_table.ssb_beam_id_list[ssb_index].beam_id.value);
|
||||
for (int j=0;j<fp->symbols_per_slot;j++)
|
||||
gNB->common_vars.beam_id[0][slot*fp->symbols_per_slot+j] = cfg->ssb_table.ssb_beam_id_list[ssb_index].beam_id.value;
|
||||
}
|
||||
|
||||
nr_generate_pbch(gNB,
|
||||
&ssb_pdu,
|
||||
&txdataF[0][txdataF_offset],
|
||||
&txdataF[beam_nb][0][txdataF_offset],
|
||||
ssb_start_symbol,
|
||||
n_hf,
|
||||
frame,
|
||||
@@ -145,29 +170,39 @@ void nr_common_signal_procedures(PHY_VARS_gNB *gNB, int frame,int slot, nfapi_nr
|
||||
fp);
|
||||
}
|
||||
|
||||
// clearing beam information to be provided to RU for all slots (DL and UL)
|
||||
void clear_slot_beamid(PHY_VARS_gNB *gNB, int slot)
|
||||
{
|
||||
LOG_D(PHY, "Clearing beam_id structure for slot %d\n", slot);
|
||||
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
|
||||
for (int i = 0; i < gNB->common_vars.num_beams_period; i++) {
|
||||
if (gNB->common_vars.beam_id)
|
||||
memset(&gNB->common_vars.beam_id[i][slot * fp->symbols_per_slot], -1, fp->symbols_per_slot * sizeof(int));
|
||||
}
|
||||
}
|
||||
|
||||
void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
|
||||
int frame,
|
||||
int slot,
|
||||
int do_meas) {
|
||||
|
||||
int aa;
|
||||
int do_meas)
|
||||
{
|
||||
PHY_VARS_gNB *gNB = msgTx->gNB;
|
||||
NR_DL_FRAME_PARMS *fp=&gNB->frame_parms;
|
||||
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
|
||||
nfapi_nr_config_request_scf_t *cfg = &gNB->gNB_config;
|
||||
int slot_prs = 0;
|
||||
int txdataF_offset = slot*fp->samples_per_slot_wCP;
|
||||
int txdataF_offset = slot * fp->samples_per_slot_wCP;
|
||||
prs_config_t *prs_config = NULL;
|
||||
|
||||
if ((cfg->cell_config.frame_duplex_type.value == TDD) &&
|
||||
(nr_slot_select(cfg,frame,slot) == NR_UPLINK_SLOT)) return;
|
||||
if ((cfg->cell_config.frame_duplex_type.value == TDD) && (nr_slot_select(cfg,frame,slot) == NR_UPLINK_SLOT))
|
||||
return;
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_TX + gNB->CC_id, 1);
|
||||
|
||||
// clear the transmit data array and beam index for the current slot
|
||||
for (aa=0; aa<cfg->carrier_config.num_tx_ant.value; aa++) {
|
||||
memset(&gNB->common_vars.txdataF[aa][txdataF_offset],0,fp->samples_per_slot_wCP*sizeof(int32_t));
|
||||
memset(&gNB->common_vars.beam_id[aa][slot*fp->symbols_per_slot],255,fp->symbols_per_slot*sizeof(uint8_t));
|
||||
for (int i = 0; i < gNB->common_vars.num_beams_period; i++) {
|
||||
for (int aa = 0; aa < cfg->carrier_config.num_tx_ant.value; aa++) {
|
||||
memset(&gNB->common_vars.txdataF[i][aa][txdataF_offset], 0, fp->samples_per_slot_wCP * sizeof(int32_t));
|
||||
}
|
||||
}
|
||||
|
||||
// Check for PRS slot - section 7.4.1.7.4 in 3GPP rel16 38.211
|
||||
@@ -180,19 +215,19 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
|
||||
{
|
||||
slot_prs = (slot - i*prs_config->PRSResourceTimeGap + fp->slots_per_frame)%fp->slots_per_frame;
|
||||
LOG_D(PHY,"gNB_TX: frame %d, slot %d, slot_prs %d, PRS Resource ID %d\n",frame, slot, slot_prs, rsc_id);
|
||||
nr_generate_prs(slot_prs, &gNB->common_vars.txdataF[0][txdataF_offset], AMP, prs_config, cfg, fp);
|
||||
nr_generate_prs(slot_prs, &gNB->common_vars.txdataF[0][0][txdataF_offset], AMP, prs_config, cfg, fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_COMMON_TX,1);
|
||||
for (int i=0; i<fp->Lmax; i++) {
|
||||
for (int i = 0; i < fp->Lmax; i++) {
|
||||
if (msgTx->ssb[i].active) {
|
||||
nr_common_signal_procedures(gNB,frame,slot,msgTx->ssb[i].ssb_pdu);
|
||||
nr_common_signal_procedures(gNB, frame, slot, msgTx->ssb[i].ssb_pdu);
|
||||
msgTx->ssb[i].active = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_COMMON_TX,0);
|
||||
|
||||
int num_pdcch_pdus = msgTx->num_ul_pdcch + msgTx->num_dl_pdcch;
|
||||
@@ -203,7 +238,7 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_PDCCH_TX,1);
|
||||
|
||||
nr_generate_dci_top(msgTx, slot, (int32_t *)&gNB->common_vars.txdataF[0][txdataF_offset], gNB->TX_AMP, fp);
|
||||
nr_generate_dci_top(msgTx, slot, txdataF_offset);
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_PDCCH_TX,0);
|
||||
}
|
||||
@@ -218,6 +253,7 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
|
||||
for (int i = 0; i < NR_SYMBOLS_PER_SLOT; i++){
|
||||
NR_gNB_CSIRS_t *csirs = &msgTx->csirs_pdu[i];
|
||||
if (csirs->active == 1) {
|
||||
AssertFatal(gNB->common_vars.beam_id == NULL, "Cannot handle CSI in the framework of beamforming yet\n");
|
||||
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;
|
||||
if (csi_params->csi_type == 2) { // ZP-CSI
|
||||
@@ -229,7 +265,7 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
|
||||
csi_params->symb_l0,
|
||||
csi_params->symb_l1);
|
||||
nr_generate_csi_rs(&gNB->frame_parms,
|
||||
(int32_t **)gNB->common_vars.txdataF,
|
||||
(int32_t **)gNB->common_vars.txdataF[0],
|
||||
gNB->TX_AMP,
|
||||
csi_params,
|
||||
slot,
|
||||
@@ -238,22 +274,21 @@ void phy_procedures_gNB_TX(processingData_L1tx_t *msgTx,
|
||||
}
|
||||
}
|
||||
|
||||
// if ((frame&127) == 0) dump_pdsch_stats(gNB);
|
||||
|
||||
//apply the OFDM symbol rotation here
|
||||
if (gNB->phase_comp) {
|
||||
for (aa=0; aa<cfg->carrier_config.num_tx_ant.value; aa++) {
|
||||
apply_nr_rotation_TX(fp,
|
||||
&gNB->common_vars.txdataF[aa][txdataF_offset],
|
||||
fp->symbol_rotation[0],
|
||||
slot,
|
||||
fp->N_RB_DL,
|
||||
0,
|
||||
fp->Ncp == EXTENDED ? 12 : 14);
|
||||
|
||||
T(T_GNB_PHY_DL_OUTPUT_SIGNAL, T_INT(0),
|
||||
T_INT(frame), T_INT(slot),
|
||||
T_INT(aa), T_BUFFER(&gNB->common_vars.txdataF[aa][txdataF_offset], fp->samples_per_slot_wCP*sizeof(int32_t)));
|
||||
for(int i = 0; i < gNB->common_vars.num_beams_period; ++i) {
|
||||
for (int aa = 0; aa < cfg->carrier_config.num_tx_ant.value; aa++) {
|
||||
apply_nr_rotation_TX(fp,
|
||||
&gNB->common_vars.txdataF[i][aa][txdataF_offset],
|
||||
fp->symbol_rotation[0],
|
||||
slot,
|
||||
fp->N_RB_DL,
|
||||
0,
|
||||
fp->Ncp == EXTENDED ? 12 : 14);
|
||||
T(T_GNB_PHY_DL_OUTPUT_SIGNAL, T_INT(0),
|
||||
T_INT(frame), T_INT(slot),
|
||||
T_INT(aa), T_BUFFER(&gNB->common_vars.txdataF[aa][txdataF_offset], fp->samples_per_slot_wCP*sizeof(int32_t)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,7 +374,7 @@ static void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req)
|
||||
if (ulsch_harq->ulsch_pdu.mcs_index == 0 && dumpsig==1) {
|
||||
int off = ((ulsch_harq->ulsch_pdu.rb_size&1) == 1)? 4:0;
|
||||
|
||||
LOG_M("rxsigF0.m","rxsF0",&gNB->common_vars.rxdataF[0][(ulsch_harq->slot%RU_RX_SLOT_DEPTH)*gNB->frame_parms.ofdm_symbol_size*gNB->frame_parms.symbols_per_slot],gNB->frame_parms.ofdm_symbol_size*gNB->frame_parms.symbols_per_slot,1,1);
|
||||
LOG_M("rxsigF0.m","rxsF0",&gNB->common_vars.rxdataF[0][0][(ulsch_harq->slot%RU_RX_SLOT_DEPTH)*gNB->frame_parms.ofdm_symbol_size*gNB->frame_parms.symbols_per_slot],gNB->frame_parms.ofdm_symbol_size*gNB->frame_parms.symbols_per_slot,1,1);
|
||||
LOG_M("rxsigF0_ext.m","rxsF0_ext",
|
||||
&gNB->pusch_vars[0].rxdataF_ext[0][ulsch_harq->ulsch_pdu.start_symbol_index*NR_NB_SC_PER_RB *
|
||||
ulsch_harq->ulsch_pdu.rb_size],ulsch_harq->ulsch_pdu.nr_of_symbols*(off+(NR_NB_SC_PER_RB *
|
||||
@@ -728,13 +763,6 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
|
||||
gNB_I0_measurements(gNB, slot_rx, first_symb, num_symb, rb_mask_ul);
|
||||
|
||||
const int soffset = (slot_rx & 3) * gNB->frame_parms.symbols_per_slot * gNB->frame_parms.ofdm_symbol_size;
|
||||
int offset = 10 * gNB->frame_parms.ofdm_symbol_size + gNB->frame_parms.first_carrier_offset;
|
||||
LOG_D(PHY,
|
||||
"frame %d, slot %d: UL signal energy %d\n",
|
||||
frame_rx,
|
||||
slot_rx,
|
||||
signal_energy_nodc(&gNB->common_vars.rxdataF[0][soffset + offset + (47 * 12)], 12 * 18));
|
||||
|
||||
start_meas(&gNB->phy_proc_rx);
|
||||
|
||||
for (int i = 0; i < gNB->max_nb_pucch; i++) {
|
||||
@@ -742,13 +770,10 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
|
||||
if (pucch) {
|
||||
if (NFAPI_MODE == NFAPI_MODE_PNF)
|
||||
pucch->frame = frame_rx;
|
||||
if ((pucch->active == 1) &&
|
||||
(pucch->frame == frame_rx) &&
|
||||
(pucch->slot == slot_rx) ) {
|
||||
|
||||
if (pucch->active && (pucch->frame == frame_rx) && (pucch->slot == slot_rx)) {
|
||||
c16_t **rxdataF = gNB->common_vars.rxdataF[pucch->beam_nb];
|
||||
pucch_decode_done = 1;
|
||||
|
||||
nfapi_nr_pucch_pdu_t *pucch_pdu = &pucch->pucch_pdu;
|
||||
nfapi_nr_pucch_pdu_t *pucch_pdu = &pucch->pucch_pdu;
|
||||
uint16_t num_ucis;
|
||||
switch (pucch_pdu->format_type) {
|
||||
case 0:
|
||||
@@ -760,21 +785,17 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
|
||||
gNB->uci_pdu_list[num_ucis].pdu_size = sizeof(nfapi_nr_uci_pucch_pdu_format_0_1_t);
|
||||
nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu_format0 = &gNB->uci_pdu_list[num_ucis].pucch_pdu_format_0_1;
|
||||
|
||||
offset = pucch_pdu->start_symbol_index*gNB->frame_parms.ofdm_symbol_size + (gNB->frame_parms.first_carrier_offset+pucch_pdu->prb_start*12);
|
||||
int offset = pucch_pdu->start_symbol_index*gNB->frame_parms.ofdm_symbol_size + (gNB->frame_parms.first_carrier_offset+pucch_pdu->prb_start*12);
|
||||
LOG_D(PHY,
|
||||
"frame %d, slot %d: PUCCH signal energy %d\n",
|
||||
frame_rx,
|
||||
slot_rx,
|
||||
signal_energy_nodc(&gNB->common_vars.rxdataF[0][soffset + offset], 12));
|
||||
signal_energy_nodc(&rxdataF[0][soffset + offset], 12));
|
||||
|
||||
nr_decode_pucch0(gNB,
|
||||
frame_rx,
|
||||
slot_rx,
|
||||
uci_pdu_format0,
|
||||
pucch_pdu);
|
||||
nr_decode_pucch0(gNB, rxdataF, frame_rx, slot_rx, uci_pdu_format0, pucch_pdu);
|
||||
|
||||
gNB->UL_INFO.uci_ind.num_ucis += 1;
|
||||
pucch->active = 0;
|
||||
pucch->active = false;
|
||||
break;
|
||||
case 2:
|
||||
num_ucis = gNB->UL_INFO.uci_ind.num_ucis;
|
||||
@@ -786,14 +807,10 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
|
||||
nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu_format2 = &gNB->uci_pdu_list[num_ucis].pucch_pdu_format_2_3_4;
|
||||
|
||||
LOG_D(PHY, "%d.%d Calling nr_decode_pucch2\n", frame_rx, slot_rx);
|
||||
nr_decode_pucch2(gNB,
|
||||
frame_rx,
|
||||
slot_rx,
|
||||
uci_pdu_format2,
|
||||
pucch_pdu);
|
||||
nr_decode_pucch2(gNB, rxdataF, frame_rx, slot_rx, uci_pdu_format2, pucch_pdu);
|
||||
|
||||
gNB->UL_INFO.uci_ind.num_ucis += 1;
|
||||
pucch->active = 0;
|
||||
pucch->active = false;
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1 == 0, "Only PUCCH formats 0 and 2 are currently supported\n");
|
||||
@@ -852,7 +869,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RX_PUSCH, 1);
|
||||
start_meas(&gNB->rx_pusch_stats);
|
||||
nr_rx_pusch_tp(gNB, ULSCH_id, frame_rx, slot_rx, ulsch->harq_pid);
|
||||
nr_rx_pusch_tp(gNB, ULSCH_id, frame_rx, slot_rx, ulsch->harq_pid, ulsch->beam_nb);
|
||||
NR_gNB_PUSCH *pusch_vars = &gNB->pusch_vars[ULSCH_id];
|
||||
pusch_vars->ulsch_power_tot = 0;
|
||||
pusch_vars->ulsch_noise_power_tot = 0;
|
||||
@@ -923,7 +940,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
|
||||
for (int i = 0; i < gNB->max_nb_srs; i++) {
|
||||
NR_gNB_SRS_t *srs = &gNB->srs[i];
|
||||
if (srs) {
|
||||
if ((srs->active == 1) && (srs->frame == frame_rx) && (srs->slot == slot_rx)) {
|
||||
if ((srs->active == true) && (srs->frame == frame_rx) && (srs->slot == slot_rx)) {
|
||||
LOG_D(NR_PHY, "(%d.%d) gNB is waiting for SRS, id = %i\n", frame_rx, slot_rx, i);
|
||||
|
||||
start_meas(&gNB->rx_srs_stats);
|
||||
@@ -943,9 +960,9 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
|
||||
generate_srs_nr(srs_pdu, frame_parms, gNB->nr_srs_info[i]->srs_generated_signal, 0, gNB->nr_srs_info[i], AMP, frame_rx, slot_rx);
|
||||
}
|
||||
stop_meas(&gNB->generate_srs_stats);
|
||||
|
||||
c16_t **rxdataF = gNB->common_vars.rxdataF[srs->beam_nb];
|
||||
start_meas(&gNB->get_srs_signal_stats);
|
||||
int srs_est = nr_get_srs_signal(gNB, frame_rx, slot_rx, srs_pdu, gNB->nr_srs_info[i], srs_received_signal);
|
||||
int srs_est = nr_get_srs_signal(gNB, rxdataF, frame_rx, slot_rx, srs_pdu, gNB->nr_srs_info[i], srs_received_signal);
|
||||
stop_meas(&gNB->get_srs_signal_stats);
|
||||
|
||||
if (srs_est >= 0) {
|
||||
@@ -1131,7 +1148,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
|
||||
#endif
|
||||
|
||||
gNB->UL_INFO.srs_ind.number_of_pdus += 1;
|
||||
srs->active = 0;
|
||||
srs->active = false;
|
||||
|
||||
stop_meas(&gNB->rx_srs_stats);
|
||||
}
|
||||
@@ -1141,7 +1158,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
|
||||
stop_meas(&gNB->phy_proc_rx);
|
||||
|
||||
if (pucch_decode_done || pusch_decode_done) {
|
||||
T(T_GNB_PHY_PUCCH_PUSCH_IQ, T_INT(frame_rx), T_INT(slot_rx), T_BUFFER(&gNB->common_vars.rxdataF[0][0], gNB->frame_parms.symbols_per_slot * gNB->frame_parms.ofdm_symbol_size * 4));
|
||||
T(T_GNB_PHY_PUCCH_PUSCH_IQ, T_INT(frame_rx), T_INT(slot_rx), T_BUFFER(&gNB->common_vars.rxdataF[0][0][0], gNB->frame_parms.symbols_per_slot * gNB->frame_parms.ofdm_symbol_size * 4));
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_UESPEC_RX,0);
|
||||
|
||||
@@ -39,7 +39,6 @@ void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot);
|
||||
void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_dl_tti_ssb_pdu ssb_pdu);
|
||||
void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx);
|
||||
void nr_feptx0(RU_t *ru,int tti_tx,int first_symbol, int num_symbols, int aa);
|
||||
|
||||
void nr_feptx_prec(RU_t *ru,int frame_tx,int tti_tx);
|
||||
void nr_feptx_prec_control(RU_t *ru,int frame,int tti_tx);
|
||||
void nr_fep_tp(RU_t *ru, int slot);
|
||||
@@ -47,5 +46,11 @@ void nr_feptx_tp(RU_t *ru, int frame_tx, int slot);
|
||||
void feptx_prec(RU_t *ru,int frame_tx,int tti_tx);
|
||||
int nr_phy_init_RU(RU_t *ru);
|
||||
void nr_phy_free_RU(RU_t *ru);
|
||||
|
||||
void clear_slot_beamid(PHY_VARS_gNB *gNB, int slot);
|
||||
int beam_index_allocation(int fapi_beam_index,
|
||||
NR_gNB_COMMON *common_vars,
|
||||
int slot,
|
||||
int symbols_per_slot,
|
||||
int start_symbol,
|
||||
int nb_symbols);
|
||||
#endif
|
||||
|
||||
@@ -663,6 +663,7 @@ int main(int argc, char **argv)
|
||||
RC.nb_nr_mac_CC[i] = 1;
|
||||
mac_top_init_gNB(ngran_gNB, scc, NULL, &conf);
|
||||
gNB_mac = RC.nrmac[0];
|
||||
nr_mac_config_scc(RC.nrmac[0], scc, &conf);
|
||||
|
||||
gNB_mac->dl_bler.harq_round_max = num_rounds;
|
||||
|
||||
@@ -1042,24 +1043,33 @@ int main(int argc, char **argv)
|
||||
int txdataF_offset = slot * frame_parms->samples_per_slot_wCP;
|
||||
|
||||
if (n_trials==1) {
|
||||
LOG_M("txsigF0.m","txsF0=", &gNB->common_vars.txdataF[0][txdataF_offset+2*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size,1,1);
|
||||
LOG_M("txsigF0.m","txsF0=",
|
||||
&gNB->common_vars.txdataF[0][0][txdataF_offset +2 * frame_parms->ofdm_symbol_size],
|
||||
frame_parms->ofdm_symbol_size,
|
||||
1,
|
||||
1);
|
||||
if (gNB->frame_parms.nb_antennas_tx>1)
|
||||
LOG_M("txsigF1.m","txsF1=", &gNB->common_vars.txdataF[1][txdataF_offset+2*frame_parms->ofdm_symbol_size],frame_parms->ofdm_symbol_size,1,1);
|
||||
LOG_M("txsigF1.m","txsF1=",
|
||||
&gNB->common_vars.txdataF[0][1][txdataF_offset + 2 * frame_parms->ofdm_symbol_size],
|
||||
frame_parms->ofdm_symbol_size,
|
||||
1,
|
||||
1);
|
||||
}
|
||||
if (n_trials == 1) printf("slot_offset %d, txdataF_offset %d \n", slot_offset, txdataF_offset);
|
||||
if (n_trials == 1)
|
||||
printf("slot_offset %d, txdataF_offset %d \n", slot_offset, txdataF_offset);
|
||||
|
||||
//TODO: loop over slots
|
||||
for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++) {
|
||||
|
||||
if (cyclic_prefix_type == 1) {
|
||||
PHY_ofdm_mod((int *)&gNB->common_vars.txdataF[aa][txdataF_offset],
|
||||
PHY_ofdm_mod((int *)&gNB->common_vars.txdataF[0][aa][txdataF_offset],
|
||||
(int *)&txdata[aa][slot_offset],
|
||||
frame_parms->ofdm_symbol_size,
|
||||
12,
|
||||
frame_parms->nb_prefix_samples,
|
||||
CYCLIC_PREFIX);
|
||||
} else {
|
||||
nr_normal_prefix_mod(&gNB->common_vars.txdataF[aa][txdataF_offset],
|
||||
nr_normal_prefix_mod(&gNB->common_vars.txdataF[0][aa][txdataF_offset],
|
||||
&txdata[aa][slot_offset],
|
||||
14,
|
||||
frame_parms,
|
||||
|
||||
@@ -640,49 +640,45 @@ int main(int argc, char **argv)
|
||||
int slot = start_symbol/14;
|
||||
|
||||
for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++)
|
||||
memset(gNB->common_vars.txdataF[aa],0,frame_parms->samples_per_slot_wCP*sizeof(int32_t));
|
||||
memset(gNB->common_vars.txdataF[0][aa], 0, frame_parms->samples_per_slot_wCP * sizeof(int32_t));
|
||||
|
||||
nr_common_signal_procedures (gNB,frame,slot,msgDataTx.ssb[i].ssb_pdu);
|
||||
|
||||
int samp = frame_parms->get_samples_slot_timestamp(slot, frame_parms, 0);
|
||||
for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++) {
|
||||
if (cyclic_prefix_type == 1) {
|
||||
apply_nr_rotation_TX(frame_parms,
|
||||
gNB->common_vars.txdataF[aa],
|
||||
gNB->common_vars.txdataF[0][aa],
|
||||
frame_parms->symbol_rotation[0],
|
||||
slot,
|
||||
frame_parms->N_RB_DL,
|
||||
0,
|
||||
12);
|
||||
|
||||
PHY_ofdm_mod((int *)gNB->common_vars.txdataF[aa],
|
||||
(int *)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)],
|
||||
frame_parms->ofdm_symbol_size,
|
||||
12,
|
||||
frame_parms->nb_prefix_samples,
|
||||
CYCLIC_PREFIX);
|
||||
PHY_ofdm_mod((int *)gNB->common_vars.txdataF[0][aa],
|
||||
(int *)&txdata[aa][samp],
|
||||
frame_parms->ofdm_symbol_size,
|
||||
12,
|
||||
frame_parms->nb_prefix_samples,
|
||||
CYCLIC_PREFIX);
|
||||
} else {
|
||||
apply_nr_rotation_TX(frame_parms,
|
||||
gNB->common_vars.txdataF[aa],
|
||||
gNB->common_vars.txdataF[0][aa],
|
||||
frame_parms->symbol_rotation[0],
|
||||
slot,
|
||||
frame_parms->N_RB_DL,
|
||||
0,
|
||||
14);
|
||||
|
||||
/*nr_normal_prefix_mod(gNB->common_vars.txdataF[aa],
|
||||
&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)],
|
||||
14,
|
||||
frame_parms);*/
|
||||
|
||||
PHY_ofdm_mod((int *)gNB->common_vars.txdataF[aa],
|
||||
(int*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)],
|
||||
PHY_ofdm_mod((int *)gNB->common_vars.txdataF[0][aa],
|
||||
(int*)&txdata[aa][samp],
|
||||
frame_parms->ofdm_symbol_size,
|
||||
1,
|
||||
frame_parms->nb_prefix_samples0,
|
||||
CYCLIC_PREFIX);
|
||||
|
||||
PHY_ofdm_mod((int *)&gNB->common_vars.txdataF[aa][frame_parms->ofdm_symbol_size],
|
||||
(int*)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)+frame_parms->nb_prefix_samples0+frame_parms->ofdm_symbol_size],
|
||||
PHY_ofdm_mod((int *)&gNB->common_vars.txdataF[0][aa][frame_parms->ofdm_symbol_size],
|
||||
(int*)&txdata[aa][samp + frame_parms->nb_prefix_samples0 + frame_parms->ofdm_symbol_size],
|
||||
frame_parms->ofdm_symbol_size,
|
||||
13,
|
||||
frame_parms->nb_prefix_samples,
|
||||
@@ -691,9 +687,9 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
}
|
||||
LOG_M("txsigF0.m","txsF0", gNB->common_vars.txdataF[0],frame_length_complex_samples_no_prefix,1,1);
|
||||
LOG_M("txsigF0.m","txsF0", gNB->common_vars.txdataF[0][0],frame_length_complex_samples_no_prefix, 1, 1);
|
||||
if (gNB->frame_parms.nb_antennas_tx>1)
|
||||
LOG_M("txsigF1.m","txsF1", gNB->common_vars.txdataF[1],frame_length_complex_samples_no_prefix,1,1);
|
||||
LOG_M("txsigF1.m","txsF1", gNB->common_vars.txdataF[0][1],frame_length_complex_samples_no_prefix, 1, 1);
|
||||
|
||||
} else {
|
||||
printf("Reading %d samples from file to antenna buffer %d\n",frame_length_complex_samples,0);
|
||||
|
||||
@@ -436,7 +436,7 @@ int main(int argc, char **argv)
|
||||
/* RU handles rxdataF, and gNB just has a pointer. Here, we don't have an RU,
|
||||
* so we need to allocate that memory as well. */
|
||||
for (i = 0; i < n_rx; i++)
|
||||
gNB->common_vars.rxdataF[i] = malloc16_clear(gNB->frame_parms.samples_per_frame_wCP*sizeof(c16_t));
|
||||
gNB->common_vars.rxdataF[0][i] = malloc16_clear(gNB->frame_parms.samples_per_frame_wCP * sizeof(c16_t));
|
||||
|
||||
double fs,txbw,rxbw;
|
||||
uint32_t samples;
|
||||
@@ -540,11 +540,12 @@ int main(int argc, char **argv)
|
||||
|
||||
pucch_GroupHopping_t PUCCH_GroupHopping = pucch_tx_pdu.group_hop_flag + (pucch_tx_pdu.sequence_hop_flag<<1);
|
||||
double tx_level_fp = 100.0;
|
||||
for(SNR=snr0;SNR<=snr1;SNR+=1){
|
||||
c16_t **rxdataF = gNB->common_vars.rxdataF[0];
|
||||
for(SNR = snr0; SNR <= snr1; SNR += 1) {
|
||||
ack_nack_errors=0;
|
||||
sr_errors=0;
|
||||
sr_errors = 0;
|
||||
n_errors = 0;
|
||||
c16_t **txdataF = gNB->common_vars.txdataF;
|
||||
c16_t **txdataF = gNB->common_vars.txdataF[0];
|
||||
for (trial=0; trial<n_trials; trial++) {
|
||||
for (int aatx=0;aatx<1;aatx++)
|
||||
bzero(txdataF[aatx],frame_parms->ofdm_symbol_size*sizeof(int));
|
||||
@@ -569,7 +570,6 @@ int main(int argc, char **argv)
|
||||
|
||||
if (n_trials==1) printf("txlev %d (%f dB), offset %d, sigma2 %f ( %f dB)\n",txlev,10*log10(txlev),startingSymbolIndex*frame_parms->ofdm_symbol_size,sigma2,sigma2_dB);
|
||||
|
||||
c16_t **rxdataF = gNB->common_vars.rxdataF;
|
||||
for (int symb=0; symb<gNB->frame_parms.symbols_per_slot;symb++) {
|
||||
if (symb<startingSymbolIndex || symb >= startingSymbolIndex+nrofSymbols) {
|
||||
int i0 = symb*gNB->frame_parms.ofdm_symbol_size;
|
||||
@@ -668,7 +668,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
else pucch_pdu.freq_hop_flag = 0;
|
||||
|
||||
nr_decode_pucch0(gNB, nr_frame_tx, nr_slot_tx,&uci_pdu,&pucch_pdu);
|
||||
nr_decode_pucch0(gNB, rxdataF, nr_frame_tx, nr_slot_tx,&uci_pdu,&pucch_pdu);
|
||||
if(sr_flag==1){
|
||||
if (uci_pdu.sr.sr_indication == 0 || uci_pdu.sr.sr_confidence_level == 1)
|
||||
sr_errors+=1;
|
||||
@@ -721,7 +721,7 @@ int main(int argc, char **argv)
|
||||
pucch_pdu.second_hop_prb = N_RB_DL-1;
|
||||
}
|
||||
else pucch_pdu.freq_hop_flag = 0;
|
||||
nr_decode_pucch2(gNB,nr_frame_tx,nr_slot_tx,&uci_pdu,&pucch_pdu);
|
||||
nr_decode_pucch2(gNB, rxdataF, nr_frame_tx, nr_slot_tx, &uci_pdu, &pucch_pdu);
|
||||
int csi_part1_bytes=pucch_pdu.bit_len_csi_part1>>3;
|
||||
if ((pucch_pdu.bit_len_csi_part1&7) > 0) csi_part1_bytes++;
|
||||
for (int i=0;i<csi_part1_bytes;i++) {
|
||||
@@ -752,8 +752,10 @@ int main(int argc, char **argv)
|
||||
free(gNB->gNB_config.tdd_table.max_tdd_periodicity_list[i].max_num_of_symbol_per_slot_list);
|
||||
free(gNB->gNB_config.tdd_table.max_tdd_periodicity_list);
|
||||
|
||||
for (i = 0; i < n_rx; i++)
|
||||
free(gNB->common_vars.rxdataF[i]);
|
||||
for (int j = 0; j < gNB->common_vars.num_beams_period; j++) {
|
||||
for (i = 0; i < n_rx; i++)
|
||||
free(gNB->common_vars.rxdataF[j][i]);
|
||||
}
|
||||
phy_free_nr_gNB(gNB);
|
||||
free(RC.gNB[0]);
|
||||
free(RC.gNB);
|
||||
|
||||
@@ -625,6 +625,7 @@ int main(int argc, char *argv[])
|
||||
for (i = 0; i < RC.nb_nr_macrlc_inst; i++)
|
||||
RC.nb_nr_mac_CC[i] = 1;
|
||||
mac_top_init_gNB(ngran_gNB, scc, NULL /* scd will be updated further below */, &conf);
|
||||
nr_mac_config_scc(RC.nrmac[0], scc, &conf);
|
||||
|
||||
NR_ServingCellConfig_t *scd = calloc(1,sizeof(NR_ServingCellConfig_t));
|
||||
prepare_scd(scd);
|
||||
@@ -656,7 +657,7 @@ int main(int argc, char *argv[])
|
||||
/* RU handles rxdataF, and gNB just has a pointer. Here, we don't have an RU,
|
||||
* so we need to allocate that memory as well. */
|
||||
for (i = 0; i < n_rx; i++)
|
||||
gNB->common_vars.rxdataF[i] = malloc16_clear(gNB->frame_parms.samples_per_frame_wCP*sizeof(int32_t));
|
||||
gNB->common_vars.rxdataF[0][i] = malloc16_clear(gNB->frame_parms.samples_per_frame_wCP*sizeof(int32_t));
|
||||
N_RB_DL = gNB->frame_parms.N_RB_DL;
|
||||
|
||||
/* no RU: need to have rxdata */
|
||||
@@ -1228,7 +1229,7 @@ int main(int argc, char *argv[])
|
||||
for (int aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++)
|
||||
nr_slot_fep_ul(&gNB->frame_parms,
|
||||
(int32_t *)rxdata[aa],
|
||||
(int32_t *)gNB->common_vars.rxdataF[aa],
|
||||
(int32_t *)gNB->common_vars.rxdataF[0][aa],
|
||||
symbol,
|
||||
slot,
|
||||
0);
|
||||
@@ -1236,7 +1237,7 @@ int main(int argc, char *argv[])
|
||||
int offset = (slot & 3) * gNB->frame_parms.symbols_per_slot * gNB->frame_parms.ofdm_symbol_size;
|
||||
for (int aa = 0; aa < gNB->frame_parms.nb_antennas_rx; aa++) {
|
||||
apply_nr_rotation_RX(&gNB->frame_parms,
|
||||
gNB->common_vars.rxdataF[aa],
|
||||
gNB->common_vars.rxdataF[0][aa],
|
||||
gNB->frame_parms.symbol_rotation[1],
|
||||
slot,
|
||||
gNB->frame_parms.N_RB_UL,
|
||||
@@ -1249,15 +1250,15 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (n_trials == 1 && round == 0) {
|
||||
LOG_M("rxsig0.m", "rx0", &rxdata[0][slot_offset], slot_length, 1, 1);
|
||||
LOG_M("rxsigF0.m", "rxsF0", gNB->common_vars.rxdataF[0], 14 * frame_parms->ofdm_symbol_size, 1, 1);
|
||||
LOG_M("rxsigF0.m", "rxsF0", gNB->common_vars.rxdataF[0][0], 14 * frame_parms->ofdm_symbol_size, 1, 1);
|
||||
if (precod_nbr_layers > 1) {
|
||||
LOG_M("rxsig1.m", "rx1", &rxdata[1][slot_offset], slot_length, 1, 1);
|
||||
LOG_M("rxsigF1.m", "rxsF1", gNB->common_vars.rxdataF[1], 14 * frame_parms->ofdm_symbol_size, 1, 1);
|
||||
LOG_M("rxsigF1.m", "rxsF1", gNB->common_vars.rxdataF[0][1], 14 * frame_parms->ofdm_symbol_size, 1, 1);
|
||||
if (precod_nbr_layers == 4) {
|
||||
LOG_M("rxsig2.m", "rx2", &rxdata[2][slot_offset], slot_length, 1, 1);
|
||||
LOG_M("rxsig3.m", "rx3", &rxdata[3][slot_offset], slot_length, 1, 1);
|
||||
LOG_M("rxsigF2.m", "rxsF2", gNB->common_vars.rxdataF[2], 14 * frame_parms->ofdm_symbol_size, 1, 1);
|
||||
LOG_M("rxsigF3.m", "rxsF3", gNB->common_vars.rxdataF[3], 14 * frame_parms->ofdm_symbol_size, 1, 1);
|
||||
LOG_M("rxsigF2.m", "rxsF2", gNB->common_vars.rxdataF[0][2], 14 * frame_parms->ofdm_symbol_size, 1, 1);
|
||||
LOG_M("rxsigF3.m", "rxsF3", gNB->common_vars.rxdataF[0][3], 14 * frame_parms->ofdm_symbol_size, 1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user