Commit a7129408 authored by Raymond Knopp's avatar Raymond Knopp

debugging with dlsim

parent 8911335f
...@@ -450,7 +450,7 @@ typedef struct ...@@ -450,7 +450,7 @@ typedef struct
typedef struct typedef struct
{ {
nfapi_uint8_tlv_t tdd_period;//DL UL Transmission Periodicity. Value:0: ms0p5 1: ms0p625 2: ms1 3: ms1p25 4: ms2 5: ms2p5 6: ms5 7: ms10 nfapi_uint8_tlv_t tdd_period;//DL UL Transmission Periodicity. Value:0: ms0p5 1: ms0p625 2: ms1 3: ms1p25 4: ms2 5: ms2p5 6: ms5 7: ms10 8: ms3 9: ms4
nfapi_nr_max_tdd_periodicity_t* max_tdd_periodicity_list; nfapi_nr_max_tdd_periodicity_t* max_tdd_periodicity_list;
} nfapi_nr_tdd_table_t; } nfapi_nr_tdd_table_t;
......
...@@ -187,7 +187,8 @@ void nr_polar_print_polarParams(t_nrPolar_params *polarParams); ...@@ -187,7 +187,8 @@ void nr_polar_print_polarParams(t_nrPolar_params *polarParams);
t_nrPolar_params *nr_polar_params (int8_t messageType, t_nrPolar_params *nr_polar_params (int8_t messageType,
uint16_t messageLength, uint16_t messageLength,
uint8_t aggregation_level); uint8_t aggregation_level,
int decoder_flag);
uint16_t nr_polar_aggregation_prime (uint8_t aggregation_level); uint16_t nr_polar_aggregation_prime (uint8_t aggregation_level);
......
...@@ -40,7 +40,8 @@ static int intcmp(const void *p1,const void *p2) { ...@@ -40,7 +40,8 @@ static int intcmp(const void *p1,const void *p2) {
static void nr_polar_init(t_nrPolar_params * *polarParams, static void nr_polar_init(t_nrPolar_params * *polarParams,
int8_t messageType, int8_t messageType,
uint16_t messageLength, uint16_t messageLength,
uint8_t aggregation_level) { uint8_t aggregation_level,
int decoder_flag) {
t_nrPolar_params *currentPtr = *polarParams; t_nrPolar_params *currentPtr = *polarParams;
uint16_t aggregation_prime = nr_polar_aggregation_prime(aggregation_level); uint16_t aggregation_prime = nr_polar_aggregation_prime(aggregation_level);
...@@ -150,7 +151,7 @@ static void nr_polar_init(t_nrPolar_params * *polarParams, ...@@ -150,7 +151,7 @@ static void nr_polar_init(t_nrPolar_params * *polarParams,
newPolarInitNode->i_bil, newPolarInitNode->i_bil,
newPolarInitNode->encoderLength); newPolarInitNode->encoderLength);
free(J); free(J);
build_decoder_tree(newPolarInitNode); if (decoder_flag == 1) build_decoder_tree(newPolarInitNode);
build_polar_tables(newPolarInitNode); build_polar_tables(newPolarInitNode);
init_polar_deinterleaver_table(newPolarInitNode); init_polar_deinterleaver_table(newPolarInitNode);
//printf("decoder tree nodes %d\n",newPolarInitNode->tree.num_nodes); //printf("decoder tree nodes %d\n",newPolarInitNode->tree.num_nodes);
...@@ -183,9 +184,10 @@ void nr_polar_print_polarParams(t_nrPolar_params *polarParams) { ...@@ -183,9 +184,10 @@ void nr_polar_print_polarParams(t_nrPolar_params *polarParams) {
t_nrPolar_params *nr_polar_params (int8_t messageType, t_nrPolar_params *nr_polar_params (int8_t messageType,
uint16_t messageLength, uint16_t messageLength,
uint8_t aggregation_level) { uint8_t aggregation_level,
int decoding_flag) {
static t_nrPolar_params *polarList = NULL; static t_nrPolar_params *polarList = NULL;
nr_polar_init(&polarList, messageType,messageLength,aggregation_level); nr_polar_init(&polarList, messageType,messageLength,aggregation_level,decoding_flag);
t_nrPolar_params *polarParams=polarList; t_nrPolar_params *polarParams=polarList;
const int tag=messageType * messageLength * nr_polar_aggregation_prime(aggregation_level); const int tag=messageType * messageLength * nr_polar_aggregation_prime(aggregation_level);
......
...@@ -86,7 +86,9 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, ...@@ -86,7 +86,9 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
LTE_eNB_PRACH *const prach_vars = &gNB->prach_vars;*/ LTE_eNB_PRACH *const prach_vars = &gNB->prach_vars;*/
int i; int i;
int P=cfg->carrier_config.num_tx_ant.value;
AssertFatal(P>0 && P<9,"P %d is not supported\n",P);
LOG_I(PHY,"[gNB %d] %s() About to wait for gNB to be configured\n", gNB->Mod_id, __FUNCTION__); LOG_I(PHY,"[gNB %d] %s() About to wait for gNB to be configured\n", gNB->Mod_id, __FUNCTION__);
gNB->total_dlsch_bitrate = 0; gNB->total_dlsch_bitrate = 0;
gNB->total_transmitted_bits = 0; gNB->total_transmitted_bits = 0;
...@@ -157,11 +159,11 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB, ...@@ -157,11 +159,11 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
gNB->first_run_I0_measurements = gNB->first_run_I0_measurements =
1; ///This flag used to be static. With multiple gNBs this does no longer work, hence we put it in the structure. However it has to be initialized with 1, which is performed here. 1; ///This flag used to be static. With multiple gNBs this does no longer work, hence we put it in the structure. However it has to be initialized with 1, which is performed here.
common_vars->rxdata = (int32_t **)malloc16(15*sizeof(int32_t*)); common_vars->rxdata = (int32_t **)malloc16(P*sizeof(int32_t*));
common_vars->txdataF = (int32_t **)malloc16(15*sizeof(int32_t*)); common_vars->txdataF = (int32_t **)malloc16(P*sizeof(int32_t*));
common_vars->rxdataF = (int32_t **)malloc16(15*sizeof(int32_t*)); common_vars->rxdataF = (int32_t **)malloc16(P*sizeof(int32_t*));
for (i=0;i<15;i++){ for (i=0;i<P;i++){
common_vars->txdataF[i] = (int32_t*)malloc16_clear(fp->samples_per_frame_wCP*sizeof(int32_t)); // [hna] samples_per_frame without CP common_vars->txdataF[i] = (int32_t*)malloc16_clear(fp->samples_per_frame_wCP*sizeof(int32_t)); // [hna] samples_per_frame without CP
common_vars->rxdataF[i] = (int32_t*)malloc16_clear(fp->samples_per_frame_wCP*sizeof(int32_t)); common_vars->rxdataF[i] = (int32_t*)malloc16_clear(fp->samples_per_frame_wCP*sizeof(int32_t));
common_vars->rxdata[i] = (int32_t*)malloc16_clear(fp->samples_per_frame*sizeof(int32_t)); common_vars->rxdata[i] = (int32_t*)malloc16_clear(fp->samples_per_frame*sizeof(int32_t));
...@@ -247,8 +249,9 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB) ...@@ -247,8 +249,9 @@ void phy_free_nr_gNB(PHY_VARS_gNB *gNB)
/*LTE_eNB_SRS *const srs_vars = gNB->srs_vars; /*LTE_eNB_SRS *const srs_vars = gNB->srs_vars;
LTE_eNB_PRACH *const prach_vars = &gNB->prach_vars;*/ LTE_eNB_PRACH *const prach_vars = &gNB->prach_vars;*/
uint32_t ***pdcch_dmrs = gNB->nr_gold_pdcch_dmrs; uint32_t ***pdcch_dmrs = gNB->nr_gold_pdcch_dmrs;
int P=gNB->gNB_config.carrier_config.num_tx_ant.value;
for (int i = 0; i < 15; i++) { for (int i = 0; i < P; i++) {
free_and_zero(common_vars->txdataF[i]); free_and_zero(common_vars->txdataF[i]);
/* rxdataF[i] is not allocated -> don't free */ /* rxdataF[i] is not allocated -> don't free */
} }
...@@ -364,6 +367,7 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) { ...@@ -364,6 +367,7 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) {
NR_DL_FRAME_PARMS *fp = &RC.gNB[Mod_id]->frame_parms; NR_DL_FRAME_PARMS *fp = &RC.gNB[Mod_id]->frame_parms;
nfapi_nr_config_request_scf_t *gNB_config = &RC.gNB[Mod_id]->gNB_config; nfapi_nr_config_request_scf_t *gNB_config = &RC.gNB[Mod_id]->gNB_config;
/*
gNB_config->cell_config.phy_cell_id.value = phy_config->cfg->cell_config.phy_cell_id.value; gNB_config->cell_config.phy_cell_id.value = phy_config->cfg->cell_config.phy_cell_id.value;
gNB_config->carrier_config.dl_frequency.value = phy_config->cfg->carrier_config.dl_frequency.value; gNB_config->carrier_config.dl_frequency.value = phy_config->cfg->carrier_config.dl_frequency.value;
gNB_config->carrier_config.uplink_frequency.value = phy_config->cfg->carrier_config.uplink_frequency.value; gNB_config->carrier_config.uplink_frequency.value = phy_config->cfg->carrier_config.uplink_frequency.value;
...@@ -391,7 +395,8 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) { ...@@ -391,7 +395,8 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) {
memcpy((void*)&gNB_config->prach_config,(void*)&phy_config->cfg->prach_config,sizeof(phy_config->cfg->prach_config)); memcpy((void*)&gNB_config->prach_config,(void*)&phy_config->cfg->prach_config,sizeof(phy_config->cfg->prach_config));
memcpy((void*)&gNB_config->tdd_table,(void*)&phy_config->cfg->tdd_table,sizeof(phy_config->cfg->tdd_table)); memcpy((void*)&gNB_config->tdd_table,(void*)&phy_config->cfg->tdd_table,sizeof(phy_config->cfg->tdd_table));
*/
memcpy((void*)gNB_config,phy_config->cfg,sizeof(*phy_config->cfg));
RC.gNB[Mod_id]->mac_enabled = 1; RC.gNB[Mod_id]->mac_enabled = 1;
fp->dl_CarrierFreq = (gNB_config->carrier_config.dl_frequency.value)*1e3 + (gNB_config->carrier_config.dl_bandwidth.value)*5e5; fp->dl_CarrierFreq = (gNB_config->carrier_config.dl_frequency.value)*1e3 + (gNB_config->carrier_config.dl_bandwidth.value)*5e5;
......
...@@ -41,6 +41,13 @@ int nr_phy_init_RU(RU_t *ru) { ...@@ -41,6 +41,13 @@ int nr_phy_init_RU(RU_t *ru) {
LOG_I(PHY,"Initializing RU signal buffers (if_south %s) nb_tx %d\n",ru_if_types[ru->if_south],ru->nb_tx); LOG_I(PHY,"Initializing RU signal buffers (if_south %s) nb_tx %d\n",ru_if_types[ru->if_south],ru->nb_tx);
nfapi_nr_config_request_scf_t *cfg;
ru->nb_log_antennas=0;
for (int n=0;n<RC.nb_L1_inst;n++) {
cfg = &RC.gNB[n]->gNB_config;
if (cfg->carrier_config.num_tx_ant.value > ru->nb_log_antennas) ru->nb_log_antennas = cfg->carrier_config.num_tx_ant.value;
}
if (ru->if_south <= REMOTE_IF5) { // this means REMOTE_IF5 or LOCAL_RF, so allocate memory for time-domain signals if (ru->if_south <= REMOTE_IF5) { // this means REMOTE_IF5 or LOCAL_RF, so allocate memory for time-domain signals
// Time-domain signals // Time-domain signals
ru->common.txdata = (int32_t**)malloc16(ru->nb_tx*sizeof(int32_t*)); ru->common.txdata = (int32_t**)malloc16(ru->nb_tx*sizeof(int32_t*));
...@@ -75,8 +82,8 @@ int nr_phy_init_RU(RU_t *ru) { ...@@ -75,8 +82,8 @@ int nr_phy_init_RU(RU_t *ru) {
// allocate precoding input buffers (TX) // allocate precoding input buffers (TX)
ru->common.txdataF = (int32_t **)malloc16(15*sizeof(int32_t*)); ru->common.txdataF = (int32_t **)malloc16(ru->nb_tx**sizeof(int32_t*));
for(i=0; i< 15; ++i) ru->common.txdataF[i] = (int32_t*)malloc16_clear(fp->samples_per_frame_wCP*sizeof(int32_t)); // [hna] samples_per_frame without CP 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
// allocate IFFT input buffers (TX) // allocate IFFT input buffers (TX)
ru->common.txdataF_BF = (int32_t **)malloc16(ru->nb_tx*sizeof(int32_t*)); ru->common.txdataF_BF = (int32_t **)malloc16(ru->nb_tx*sizeof(int32_t*));
...@@ -110,8 +117,8 @@ int nr_phy_init_RU(RU_t *ru) { ...@@ -110,8 +117,8 @@ int nr_phy_init_RU(RU_t *ru) {
LOG_E(PHY,"[INIT] %s() RC.nb_nr_L1_inst:%d \n", __FUNCTION__, RC.nb_nr_L1_inst); LOG_E(PHY,"[INIT] %s() RC.nb_nr_L1_inst:%d \n", __FUNCTION__, RC.nb_nr_L1_inst);
int beam_count = 0; int beam_count = 0;
if (ru->nb_tx>1) { if (ru->nb_log_antennas>1) {
for (p=0;p<fp->Lmax;p++) { for (p=0;p<ru->nb_log_antennas;p++) {
if ((fp->L_ssb >> p) & 0x01) if ((fp->L_ssb >> p) & 0x01)
beam_count++; beam_count++;
} }
...@@ -119,7 +126,7 @@ int nr_phy_init_RU(RU_t *ru) { ...@@ -119,7 +126,7 @@ int nr_phy_init_RU(RU_t *ru) {
int l_ind = 0; int l_ind = 0;
for (i=0; i<RC.nb_nr_L1_inst; i++) { for (i=0; i<RC.nb_nr_L1_inst; i++) {
for (p=0;p<fp->Lmax;p++) { for (p=0;p<nb_logical_antennas;p++) {
if ((fp->L_ssb >> p) & 0x01) { if ((fp->L_ssb >> p) & 0x01) {
ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*)); ru->beam_weights[i][p] = (int32_t **)malloc16_clear(ru->nb_tx*sizeof(int32_t*));
for (j=0; j<ru->nb_tx; j++) { for (j=0; j<ru->nb_tx; j++) {
......
...@@ -81,12 +81,15 @@ int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp, uint8_t i_ssb) ...@@ -81,12 +81,15 @@ int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp, uint8_t i_ssb)
} }
int nr_init_frame_parms0(NR_DL_FRAME_PARMS *fp, int nr_init_frame_parms0(NR_DL_FRAME_PARMS *fp,
int mu, nfapi_nr_config_request_scf_t* cfg,
int mu0,
int Ncp, int Ncp,
int N_RB_DL) int N_RB_DL)
{ {
int mu = cfg!= NULL ? cfg->ssb_config.scs_common.value : mu0;
#if DISABLE_LOG_X #if DISABLE_LOG_X
printf("Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, N_RB_DL, Ncp); printf("Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, N_RB_DL, Ncp);
#else #else
...@@ -249,7 +252,9 @@ int nr_init_frame_parms0(NR_DL_FRAME_PARMS *fp, ...@@ -249,7 +252,9 @@ int nr_init_frame_parms0(NR_DL_FRAME_PARMS *fp,
} }
fp->N_ssb = 0; fp->N_ssb = 0;
for (int p=0; p<fp->Lmax; p++) int num_tx_ant = (cfg == NULL) ? fp->Lmax : cfg->carrier_config.num_tx_ant.value;
for (int p=0; p<num_tx_ant; p++)
fp->N_ssb += ((fp->L_ssb >> p) & 0x01); fp->N_ssb += ((fp->L_ssb >> p) & 0x01);
return 0; return 0;
...@@ -263,7 +268,8 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* config, ...@@ -263,7 +268,8 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* config,
fp->L_ssb = (((uint64_t) config->ssb_table.ssb_mask_list[1].ssb_mask.value)<<32) | config->ssb_table.ssb_mask_list[0].ssb_mask.value ; fp->L_ssb = (((uint64_t) config->ssb_table.ssb_mask_list[1].ssb_mask.value)<<32) | config->ssb_table.ssb_mask_list[0].ssb_mask.value ;
int N_RB_DL = config->carrier_config.dl_grid_size[config->ssb_config.scs_common.value].value; int N_RB_DL = config->carrier_config.dl_grid_size[config->ssb_config.scs_common.value].value;
return nr_init_frame_parms0(fp, return nr_init_frame_parms0(fp,
config->ssb_config.scs_common.value, config,
0,
NFAPI_CP_NORMAL, NFAPI_CP_NORMAL,
N_RB_DL); N_RB_DL);
} }
...@@ -276,7 +282,7 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, ...@@ -276,7 +282,7 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
int ssb_subcarrier_offset) int ssb_subcarrier_offset)
{ {
/*n_ssb_crb and ssb_subcarrier_offset are given in 15kHz SCS*/ /*n_ssb_crb and ssb_subcarrier_offset are given in 15kHz SCS*/
nr_init_frame_parms0(fp,mu,Ncp,N_RB_DL); nr_init_frame_parms0(fp,NULL,mu,Ncp,N_RB_DL);
fp->ssb_start_subcarrier = (12 * n_ssb_crb + ssb_subcarrier_offset); fp->ssb_start_subcarrier = (12 * n_ssb_crb + ssb_subcarrier_offset);
return 0; return 0;
} }
......
...@@ -233,7 +233,8 @@ uint8_t nr_generate_dci_top(nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu, ...@@ -233,7 +233,8 @@ uint8_t nr_generate_dci_top(nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu,
t_nrPolar_params *currentPtr = nr_polar_params(NR_POLAR_DCI_MESSAGE_TYPE, t_nrPolar_params *currentPtr = nr_polar_params(NR_POLAR_DCI_MESSAGE_TYPE,
pdcch_pdu_rel15->PayloadSizeBits[d], pdcch_pdu_rel15->PayloadSizeBits[d],
pdcch_pdu_rel15->AggregationLevel[d]); pdcch_pdu_rel15->AggregationLevel[d],
0);
polar_encoder_fast((uint64_t*)pdcch_pdu_rel15->Payload[d], encoder_output, pdcch_pdu_rel15->RNTI[d],1,currentPtr); polar_encoder_fast((uint64_t*)pdcch_pdu_rel15->Payload[d], encoder_output, pdcch_pdu_rel15->RNTI[d],1,currentPtr);
#ifdef DEBUG_CHANNEL_CODING #ifdef DEBUG_CHANNEL_CODING
printf("polar rnti %d\n",pdcch_pdu_rel15->RNTI[d]); printf("polar rnti %d\n",pdcch_pdu_rel15->RNTI[d]);
......
...@@ -299,7 +299,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch, ...@@ -299,7 +299,7 @@ int nr_generate_pbch(NR_gNB_PBCH *pbch,
/// CRC, coding and rate matching /// CRC, coding and rate matching
polar_encoder_fast (&a_reversed, (uint32_t *)pbch->pbch_e, 0, 0, polar_encoder_fast (&a_reversed, (uint32_t *)pbch->pbch_e, 0, 0,
nr_polar_params( NR_POLAR_PBCH_MESSAGE_TYPE, NR_POLAR_PBCH_PAYLOAD_BITS, NR_POLAR_PBCH_AGGREGATION_LEVEL) nr_polar_params( NR_POLAR_PBCH_MESSAGE_TYPE, NR_POLAR_PBCH_PAYLOAD_BITS, NR_POLAR_PBCH_AGGREGATION_LEVEL,0)
); );
#ifdef DEBUG_PBCH_ENCODING #ifdef DEBUG_PBCH_ENCODING
printf("Channel coding:\n"); printf("Channel coding:\n");
......
...@@ -1247,7 +1247,7 @@ void nr_dci_decoding_procedure0(int s, ...@@ -1247,7 +1247,7 @@ void nr_dci_decoding_procedure0(int s,
#endif #endif
*/ */
uint64_t dci_estimation[2]= {0}; uint64_t dci_estimation[2]= {0};
const t_nrPolar_params *currentPtrDCI=nr_polar_params(1, sizeof_bits, L2); const t_nrPolar_params *currentPtrDCI=nr_polar_params(1, sizeof_bits, L2,1);
decoderState = polar_decoder_int16(&pdcch_vars[eNB_id]->e_rx[CCEind*9*6*2], decoderState = polar_decoder_int16(&pdcch_vars[eNB_id]->e_rx[CCEind*9*6*2],
dci_estimation, dci_estimation,
1, 1,
......
...@@ -538,7 +538,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, ...@@ -538,7 +538,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
uint32_t unscrambling_mask = (Lmax==64)?0x100006D:0x1000041; uint32_t unscrambling_mask = (Lmax==64)?0x100006D:0x1000041;
nr_pbch_unscrambling(nr_ue_pbch_vars,frame_parms->Nid_cell,nushift,M,NR_POLAR_PBCH_E,0,0); nr_pbch_unscrambling(nr_ue_pbch_vars,frame_parms->Nid_cell,nushift,M,NR_POLAR_PBCH_E,0,0);
//polar decoding de-rate matching //polar decoding de-rate matching
const t_nrPolar_params *currentPtr = nr_polar_params( NR_POLAR_PBCH_MESSAGE_TYPE, NR_POLAR_PBCH_PAYLOAD_BITS, NR_POLAR_PBCH_AGGREGATION_LEVEL); const t_nrPolar_params *currentPtr = nr_polar_params( NR_POLAR_PBCH_MESSAGE_TYPE, NR_POLAR_PBCH_PAYLOAD_BITS, NR_POLAR_PBCH_AGGREGATION_LEVEL,1);
decoderState = polar_decoder_int16(pbch_e_rx,(uint64_t *)&nr_ue_pbch_vars->pbch_a_prime,0,currentPtr); decoderState = polar_decoder_int16(pbch_e_rx,(uint64_t *)&nr_ue_pbch_vars->pbch_a_prime,0,currentPtr);
if(decoderState) return(decoderState); if(decoderState) return(decoderState);
......
...@@ -468,6 +468,8 @@ typedef struct RU_t_s { ...@@ -468,6 +468,8 @@ typedef struct RU_t_s {
int nb_rx; int nb_rx;
/// number of TX paths on device /// number of TX paths on device
int nb_tx; int nb_tx;
/// number of logical antennas at TX beamformer input
int nb_log_antennas;
/// maximum PDSCH RS EPRE /// maximum PDSCH RS EPRE
int max_pdschReferenceSignalPower; int max_pdschReferenceSignalPower;
/// maximum RX gain /// maximum RX gain
......
...@@ -147,7 +147,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){ ...@@ -147,7 +147,7 @@ void nr_schedule_response(NR_Sched_Rsp_t *Sched_INFO){
uint8_t number_dl_pdu = DL_req->dl_tti_request_body.nPDUs; uint8_t number_dl_pdu = DL_req->dl_tti_request_body.nPDUs;
uint8_t number_ul_pdu = 0; uint8_t number_ul_pdu = 0;
uint8_t number_ul_dci_pdu = UL_dci_req->numPdus; uint8_t number_ul_dci_pdu = (UL_dci_req==NULL) ? 0 : UL_dci_req->numPdus;
if (UL_tti_req != NULL) number_ul_pdu = UL_tti_req->n_pdus; if (UL_tti_req != NULL) number_ul_pdu = UL_tti_req->n_pdus;
......
...@@ -126,11 +126,12 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) { ...@@ -126,11 +126,12 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) {
nr_set_ssb_first_subcarrier(cfg, fp); // setting the first subcarrier nr_set_ssb_first_subcarrier(cfg, fp); // setting the first subcarrier
AssertFatal(txdataF[ssb_index]!=NULL,"txdataF[%d] is null\n",ssb_index,txdataF[ssb_index]);
LOG_D(PHY,"SS TX: frame %d, slot %d, start_symbol %d\n",frame,slot, ssb_start_symbol); LOG_D(PHY,"SS TX: frame %d, slot %d, start_symbol %d\n",frame,slot, ssb_start_symbol);
nr_generate_pss(gNB->d_pss, &txdataF[ssb_index][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); nr_generate_pss(gNB->d_pss, &txdataF[ssb_index][txdataF_offset], AMP, ssb_start_symbol, cfg, fp);
nr_generate_sss(gNB->d_sss, &txdataF[ssb_index][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); nr_generate_sss(gNB->d_sss, &txdataF[ssb_index][txdataF_offset], AMP, ssb_start_symbol, cfg, fp);
if (fp->Lmax == 4) if (cfg->carrier_config.num_tx_ant.value <= 4)
nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[n_hf][ssb_index],&txdataF[ssb_index][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[n_hf][ssb_index],&txdataF[ssb_index][txdataF_offset], AMP, ssb_start_symbol, cfg, fp);
else else
nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[0][ssb_index],&txdataF[ssb_index][txdataF_offset], AMP, ssb_start_symbol, cfg, fp); nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[0][ssb_index],&txdataF[ssb_index][txdataF_offset], AMP, ssb_start_symbol, cfg, fp);
...@@ -141,7 +142,7 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) { ...@@ -141,7 +142,7 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) {
&txdataF[ssb_index][txdataF_offset], &txdataF[ssb_index][txdataF_offset],
AMP, AMP,
ssb_start_symbol, ssb_start_symbol,
n_hf,fp->Lmax, n_hf,cfg->carrier_config.num_tx_ant.value,
frame, cfg, fp); frame, cfg, fp);
} }
} }
...@@ -171,7 +172,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, ...@@ -171,7 +172,7 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
if (do_meas==1) start_meas(&gNB->phy_proc_tx); if (do_meas==1) start_meas(&gNB->phy_proc_tx);
// clear the transmit data array for the current subframe // clear the transmit data array for the current subframe
for (aa=0; aa<fp->Lmax; aa++) { 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.txdataF[aa][txdataF_offset],0,fp->samples_per_slot_wCP*sizeof(int32_t));
} }
......
...@@ -221,7 +221,7 @@ int main(int argc, char **argv) ...@@ -221,7 +221,7 @@ int main(int argc, char **argv)
int do_pdcch_flag=1; int do_pdcch_flag=1;
uint16_t cset_offset = 0; uint16_t cset_offset = 0;
int loglvl=OAILOG_WARNING; int loglvl=OAILOG_INFO;
float target_error_rate = 0.01; float target_error_rate = 0.01;
int css_flag=0; int css_flag=0;
...@@ -492,8 +492,8 @@ int main(int argc, char **argv) ...@@ -492,8 +492,8 @@ int main(int argc, char **argv)
gNB_RRC_INST rrc; gNB_RRC_INST rrc;
memset((void*)&rrc,0,sizeof(rrc)); memset((void*)&rrc,0,sizeof(rrc));
// read in SCGroupConfig // read in SCGroupConfig
FILE *scg_fd = fopen("reconfig.hex","r"); FILE *scg_fd = fopen("reconfig.raw","r");
AssertFatal(scg_fd != NULL,"no reconfig.hex file\n"); AssertFatal(scg_fd != NULL,"no reconfig.raw file\n");
char buffer[1024]; char buffer[1024];
int msg_len=fread(buffer,1,1024,scg_fd); int msg_len=fread(buffer,1,1024,scg_fd);
NR_RRCReconfiguration_t *NR_RRCReconfiguration; NR_RRCReconfiguration_t *NR_RRCReconfiguration;
...@@ -532,6 +532,7 @@ int main(int argc, char **argv) ...@@ -532,6 +532,7 @@ int main(int argc, char **argv)
NR_ServingCellConfigCommon_t *scc = secondaryCellGroup->spCellConfig->reconfigurationWithSync->spCellConfigCommon; NR_ServingCellConfigCommon_t *scc = secondaryCellGroup->spCellConfig->reconfigurationWithSync->spCellConfigCommon;
xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)secondaryCellGroup);
rrc.carrier.servingcellconfigcommon = secondaryCellGroup->spCellConfig->reconfigurationWithSync->spCellConfigCommon; rrc.carrier.servingcellconfigcommon = secondaryCellGroup->spCellConfig->reconfigurationWithSync->spCellConfigCommon;
printf("%p,%p\n", printf("%p,%p\n",
......
...@@ -289,6 +289,8 @@ void config_common(int Mod_idP, NR_ServingCellConfigCommon_t *scc) { ...@@ -289,6 +289,8 @@ void config_common(int Mod_idP, NR_ServingCellConfigCommon_t *scc) {
} }
} }
// set tx and rx antennas to number of SSB
// Cell configuration // Cell configuration
cfg->cell_config.phy_cell_id.value = *scc->physCellId; cfg->cell_config.phy_cell_id.value = *scc->physCellId;
cfg->cell_config.phy_cell_id.tl.tag = NFAPI_NR_CONFIG_PHY_CELL_ID_TAG; cfg->cell_config.phy_cell_id.tl.tag = NFAPI_NR_CONFIG_PHY_CELL_ID_TAG;
...@@ -403,12 +405,31 @@ void config_common(int Mod_idP, NR_ServingCellConfigCommon_t *scc) { ...@@ -403,12 +405,31 @@ void config_common(int Mod_idP, NR_ServingCellConfigCommon_t *scc) {
cfg->ssb_table.ssb_mask_list[0].ssb_mask.tl.tag = NFAPI_NR_CONFIG_SSB_MASK_TAG; cfg->ssb_table.ssb_mask_list[0].ssb_mask.tl.tag = NFAPI_NR_CONFIG_SSB_MASK_TAG;
cfg->num_tlv++; cfg->num_tlv++;
cfg->carrier_config.num_tx_ant.value = 0;
cfg->carrier_config.num_tx_ant.tl.tag = NFAPI_NR_CONFIG_NUM_TX_ANT_TAG;
for (int i=0;i<32;i++) {
cfg->carrier_config.num_tx_ant.value += (cfg->ssb_table.ssb_mask_list[0].ssb_mask.value>>i)&1;
cfg->carrier_config.num_tx_ant.value += (cfg->ssb_table.ssb_mask_list[1].ssb_mask.value>>i)&1;
}
cfg->carrier_config.num_rx_ant.value = cfg->carrier_config.num_tx_ant.value;
cfg->carrier_config.num_rx_ant.tl.tag = NFAPI_NR_CONFIG_NUM_RX_ANT_TAG;
LOG_I(MAC,"Set TX/RX antenna number to %d (ssb: %x,%x)\n",cfg->carrier_config.num_tx_ant.value,cfg->ssb_table.ssb_mask_list[0].ssb_mask.value,cfg->ssb_table.ssb_mask_list[1].ssb_mask.value);
AssertFatal(cfg->carrier_config.num_tx_ant.value > 0,"carrier_config.num_tx_ant.value %d !\n",cfg->carrier_config.num_tx_ant.value );
cfg->num_tlv++;
cfg->num_tlv++;
// TDD Table Configuration // TDD Table Configuration
//cfg->tdd_table.tdd_period.value = scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity; //cfg->tdd_table.tdd_period.value = scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity;
cfg->tdd_table.tdd_period.tl.tag = NFAPI_NR_CONFIG_TDD_PERIOD_TAG; cfg->tdd_table.tdd_period.tl.tag = NFAPI_NR_CONFIG_TDD_PERIOD_TAG;
cfg->num_tlv++; cfg->num_tlv++;
if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1 == NULL)
cfg->tdd_table.tdd_period.value = scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity; cfg->tdd_table.tdd_period.value = scc->tdd_UL_DL_ConfigurationCommon->pattern1.dl_UL_TransmissionPeriodicity;
else {
AssertFatal(scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530 != NULL,
"scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530 is null\n");
cfg->tdd_table.tdd_period.value = *scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1->dl_UL_TransmissionPeriodicity_v1530;
}
LOG_I(MAC,"Setting TDD configuration period to %d\n",cfg->tdd_table.tdd_period.value);
if(cfg->cell_config.frame_duplex_type.value == TDD){ if(cfg->cell_config.frame_duplex_type.value == TDD){
int return_tdd = set_tdd_config_nr(cfg, int return_tdd = set_tdd_config_nr(cfg,
scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing,
...@@ -451,9 +472,6 @@ void config_common(int Mod_idP, NR_ServingCellConfigCommon_t *scc) { ...@@ -451,9 +472,6 @@ void config_common(int Mod_idP, NR_ServingCellConfigCommon_t *scc) {
} }
/*void config_servingcellconfigcommon(){
}*/
int rrc_mac_config_req_gNB(module_id_t Mod_idP, int rrc_mac_config_req_gNB(module_id_t Mod_idP,
int ssb_SubcarrierOffset, int ssb_SubcarrierOffset,
......
...@@ -147,7 +147,7 @@ gNBs = ...@@ -147,7 +147,7 @@ gNBs =
# ssb_PositionsInBurs_BitmapPR # ssb_PositionsInBurs_BitmapPR
# 1=short, 2=medium, 3=long # 1=short, 2=medium, 3=long
ssb_PositionsInBurst_PR = 2; ssb_PositionsInBurst_PR = 2;
ssb_PositionsInBurst_Bitmap = 255; ssb_PositionsInBurst_Bitmap = 15;
# ssb_periodicityServingCell # ssb_periodicityServingCell
# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 # 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1
...@@ -165,7 +165,7 @@ gNBs = ...@@ -165,7 +165,7 @@ gNBs =
#tdd-UL-DL-ConfigurationCommon #tdd-UL-DL-ConfigurationCommon
# subcarrierSpacing # subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
referenceSubcarrierSpacing = 2; referenceSubcarrierSpacing = 1;
# pattern1 # pattern1
# dl_UL_TransmissionPeriodicity # dl_UL_TransmissionPeriodicity
# 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment