Commit f87977b1 authored by francescomani's avatar francescomani

addressing review comments

parent 19295d0e
...@@ -344,11 +344,6 @@ typedef struct { ...@@ -344,11 +344,6 @@ typedef struct {
#define MAX_NR_OF_DL_ALLOCATIONS 16 #define MAX_NR_OF_DL_ALLOCATIONS 16
#define MAX_NR_OF_UL_ALLOCATIONS (16) #define MAX_NR_OF_UL_ALLOCATIONS (16)
typedef enum {
typeA = 0,
typeB = 1
} mappingType_t;
typedef enum { typedef enum {
pdsch_dmrs_pos0 = 0, pdsch_dmrs_pos0 = 0,
pdsch_dmrs_pos1 = 1, pdsch_dmrs_pos1 = 1,
...@@ -368,12 +363,7 @@ typedef enum { ...@@ -368,12 +363,7 @@ typedef enum {
pusch_dmrs_type1 = 0, pusch_dmrs_type1 = 0,
pusch_dmrs_type2 = 1 pusch_dmrs_type2 = 1
} pusch_dmrs_type_t; } pusch_dmrs_type_t;
typedef enum {
pusch_dmrs_pos0 = 0,
pusch_dmrs_pos1 = 1,
pusch_dmrs_pos2 = 2,
pusch_dmrs_pos3 = 3,
} pusch_dmrs_AdditionalPosition_t;
typedef enum { typedef enum {
pusch_len1 = 1, pusch_len1 = 1,
pusch_len2 = 2 pusch_len2 = 2
......
...@@ -85,31 +85,22 @@ nrUE_params_t *get_nrUE_params(void) { ...@@ -85,31 +85,22 @@ nrUE_params_t *get_nrUE_params(void) {
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
char c; char c;
int i; //,j,l,aa; int i;
double SNR, SNR_lin, snr0 = -2.0, snr1 = 2.0; double SNR, SNR_lin, snr0 = -2.0, snr1 = 2.0;
double snr_step = 0.1; double snr_step = 0.1;
uint8_t snr1set = 0; uint8_t snr1set = 0;
int **txdata; int **txdata;
double **s_re, **s_im, **r_re, **r_im; double **s_re, **s_im, **r_re, **r_im;
// int sync_pos, sync_pos_slot;
// FILE *rx_frame_file;
FILE *output_fd = NULL; FILE *output_fd = NULL;
//uint8_t write_output_file = 0; //uint8_t write_output_file = 0;
// int subframe_offset;
// char fname[40], vname[40];
int trial, n_trials = 1, n_errors = 0, n_false_positive = 0; int trial, n_trials = 1, n_errors = 0, n_false_positive = 0;
uint8_t n_tx = 1, n_rx = 1; uint8_t n_tx = 1, n_rx = 1;
//uint8_t transmission_mode = 1;
uint16_t Nid_cell = 0; uint16_t Nid_cell = 0;
channel_desc_t *gNB2UE; channel_desc_t *gNB2UE;
uint8_t extended_prefix_flag = 0; uint8_t extended_prefix_flag = 0;
//int8_t interf1 = -21, interf2 = -21;
FILE *input_fd = NULL, *pbch_file_fd = NULL; FILE *input_fd = NULL, *pbch_file_fd = NULL;
//char input_val_str[50],input_val_str2[50];
//uint16_t NB_RB=25;
SCM_t channel_model = AWGN; //Rayleigh1_anticorr; SCM_t channel_model = AWGN; //Rayleigh1_anticorr;
uint16_t N_RB_DL = 106, mu = 1; uint16_t N_RB_DL = 106, mu = 1;
//unsigned char frame_type = 0;
unsigned char pbch_phase = 0; unsigned char pbch_phase = 0;
int frame = 0, slot = 0; int frame = 0, slot = 0;
int frame_length_complex_samples; int frame_length_complex_samples;
...@@ -120,7 +111,6 @@ int main(int argc, char **argv) ...@@ -120,7 +111,6 @@ int main(int argc, char **argv)
double sigma; double sigma;
unsigned char qbits = 8; unsigned char qbits = 8;
int ret; int ret;
//int run_initial_sync=0;
int loglvl = OAILOG_WARNING; int loglvl = OAILOG_WARNING;
uint8_t dlsch_threads = 0; uint8_t dlsch_threads = 0;
float target_error_rate = 0.01; float target_error_rate = 0.01;
...@@ -195,14 +185,6 @@ int main(int argc, char **argv) ...@@ -195,14 +185,6 @@ int main(int argc, char **argv)
break; break;
/*case 'i':
interf1 = atoi(optarg);
break;
case 'j':
interf2 = atoi(optarg);
break;*/
case 'n': case 'n':
n_trials = atoi(optarg); n_trials = atoi(optarg);
break; break;
...@@ -312,13 +294,10 @@ int main(int argc, char **argv) ...@@ -312,13 +294,10 @@ int main(int argc, char **argv)
gNBthreads[sizeof(gNBthreads)-1]=0; gNBthreads[sizeof(gNBthreads)-1]=0;
break; break;
/*case 'x':
transmission_mode = atoi(optarg);
break;*/
default: default:
case 'h': case 'h':
printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n", argv[0]); printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n", argv[0]);
printf("-h This message\n"); printf("-h This message\n");
printf("-p Use extended prefix mode\n"); printf("-p Use extended prefix mode\n");
printf("-V Enable VCD dumb functions\n"); printf("-V Enable VCD dumb functions\n");
...@@ -333,7 +312,7 @@ int main(int argc, char **argv) ...@@ -333,7 +312,7 @@ int main(int argc, char **argv)
printf("-z Number of RX antennas used in UE\n"); printf("-z Number of RX antennas used in UE\n");
//printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n"); //printf("-i Relative strength of first intefering eNB (in dB) - cell_id mod 3 = 1\n");
//printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n"); //printf("-j Relative strength of second intefering eNB (in dB) - cell_id mod 3 = 2\n");
printf("-M Multiple SSB positions in burst\n"); printf("-M Multiple SSB positions in burst\n");
printf("-N Nid_cell\n"); printf("-N Nid_cell\n");
printf("-R N_RB_DL\n"); printf("-R N_RB_DL\n");
printf("-O oversampling factor (1,2,4,8,16)\n"); printf("-O oversampling factor (1,2,4,8,16)\n");
......
...@@ -324,21 +324,20 @@ void nr_dlsim_preprocessor(module_id_t module_id, ...@@ -324,21 +324,20 @@ void nr_dlsim_preprocessor(module_id_t module_id,
current_BWP->mcsTableIdx = g_mcsTableIdx; current_BWP->mcsTableIdx = g_mcsTableIdx;
sched_pdsch->time_domain_allocation = get_dl_tda(RC.nrmac[module_id], scc, slot); sched_pdsch->time_domain_allocation = get_dl_tda(RC.nrmac[module_id], scc, slot);
AssertFatal(sched_pdsch->time_domain_allocation>=0,"Unable to find PDSCH time domain allocation in list\n"); AssertFatal(sched_pdsch->time_domain_allocation>=0,"Unable to find PDSCH time domain allocation in list\n");
NR_pdsch_tda_info_t *tda_info = &sched_pdsch->tda_info;
nr_get_pdsch_tda_info(current_BWP, sched_pdsch->time_domain_allocation, tda_info);
set_dl_dmrs_params(&sched_pdsch->dmrs_parms, sched_pdsch->tda_info = nr_get_pdsch_tda_info(current_BWP, sched_pdsch->time_domain_allocation);
scc,
current_BWP, sched_pdsch->dmrs_parms = get_dl_dmrs_params(scc,
tda_info, current_BWP,
sched_pdsch->nrOfLayers); &sched_pdsch->tda_info,
sched_pdsch->nrOfLayers);
sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, current_BWP->mcsTableIdx); sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, current_BWP->mcsTableIdx);
sched_pdsch->R = nr_get_code_rate_dl(sched_pdsch->mcs, current_BWP->mcsTableIdx); sched_pdsch->R = nr_get_code_rate_dl(sched_pdsch->mcs, current_BWP->mcsTableIdx);
sched_pdsch->tb_size = nr_compute_tbs(sched_pdsch->Qm, sched_pdsch->tb_size = nr_compute_tbs(sched_pdsch->Qm,
sched_pdsch->R, sched_pdsch->R,
sched_pdsch->rbSize, sched_pdsch->rbSize,
tda_info->nrOfSymbols, sched_pdsch->tda_info.nrOfSymbols,
sched_pdsch->dmrs_parms.N_PRB_DMRS * sched_pdsch->dmrs_parms.N_DMRS_SLOT, sched_pdsch->dmrs_parms.N_PRB_DMRS * sched_pdsch->dmrs_parms.N_DMRS_SLOT,
0 /* N_PRB_oh, 0 for initialBWP */, 0 /* N_PRB_oh, 0 for initialBWP */,
0 /* tb_scaling */, 0 /* tb_scaling */,
......
...@@ -3155,7 +3155,7 @@ int is_nr_UL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, sl ...@@ -3155,7 +3155,7 @@ int is_nr_UL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, sl
else return(slot_in_period >= slots1+tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots ? 1 : 0); else return(slot_in_period >= slots1+tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots ? 1 : 0);
} }
int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols, int startSymbol, int mappingtype, int length) { int16_t fill_dmrs_mask(const NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols, int startSymbol, mappingType_t mappingtype, int length) {
int dmrs_AdditionalPosition = 0; int dmrs_AdditionalPosition = 0;
NR_DMRS_DownlinkConfig_t *dmrs_config = NULL; NR_DMRS_DownlinkConfig_t *dmrs_config = NULL;
......
...@@ -38,6 +38,18 @@ ...@@ -38,6 +38,18 @@
#include "openair1/PHY/impl_defs_nr.h" #include "openair1/PHY/impl_defs_nr.h"
#include "common/utils/nr/nr_common.h" #include "common/utils/nr/nr_common.h"
typedef enum {
pusch_dmrs_pos0 = 0,
pusch_dmrs_pos1 = 1,
pusch_dmrs_pos2 = 2,
pusch_dmrs_pos3 = 3,
} pusch_dmrs_AdditionalPosition_t;
typedef enum {
typeA = 0,
typeB = 1
} mappingType_t;
uint32_t get_Y(NR_SearchSpace_t *ss, int slot, rnti_t rnti); uint32_t get_Y(NR_SearchSpace_t *ss, int slot, rnti_t rnti);
uint8_t get_BG(uint32_t A, uint16_t R); uint8_t get_BG(uint32_t A, uint16_t R);
...@@ -46,7 +58,7 @@ uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn); ...@@ -46,7 +58,7 @@ uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn);
uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, uint32_t bw); uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, uint32_t bw);
int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol,int mappingtype_fromDCI,int length); int16_t fill_dmrs_mask(const NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol,mappingType_t mappingtype,int length);
int is_nr_DL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon,slot_t slotP); int is_nr_DL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon,slot_t slotP);
......
...@@ -1159,10 +1159,8 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra ...@@ -1159,10 +1159,8 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
// Calculate number of symbols // Calculate number of symbols
int time_domain_assignment = get_dl_tda(nr_mac, scc, slotP); int time_domain_assignment = get_dl_tda(nr_mac, scc, slotP);
NR_pdsch_tda_info_t tda_info; NR_tda_info_t tda_info = nr_get_pdsch_tda_info(dl_bwp,
nr_get_pdsch_tda_info(dl_bwp, time_domain_assignment);
time_domain_assignment,
&tda_info);
NR_ControlResourceSet_t *coreset = ra->coreset; NR_ControlResourceSet_t *coreset = ra->coreset;
...@@ -1242,12 +1240,10 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra ...@@ -1242,12 +1240,10 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
const int pduindex = nr_mac->pdu_index[CC_id]++; const int pduindex = nr_mac->pdu_index[CC_id]++;
uint8_t mcsTableIdx = dl_bwp->mcsTableIdx; uint8_t mcsTableIdx = dl_bwp->mcsTableIdx;
NR_pdsch_dmrs_t dmrs_parms; NR_pdsch_dmrs_t dmrs_parms = get_dl_dmrs_params(scc,
set_dl_dmrs_params(&dmrs_parms, dl_bwp,
scc, &tda_info,
dl_bwp, 1);
&tda_info,
1);
pdsch_pdu_rel15->pduBitmap = 0; pdsch_pdu_rel15->pduBitmap = 0;
pdsch_pdu_rel15->rnti = ra->RA_rnti; pdsch_pdu_rel15->rnti = ra->RA_rnti;
...@@ -1531,15 +1527,12 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra ...@@ -1531,15 +1527,12 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
} }
} }
NR_pdsch_tda_info_t msg4_tda; NR_tda_info_t msg4_tda = nr_get_pdsch_tda_info(dl_bwp, time_domain_assignment);
nr_get_pdsch_tda_info(dl_bwp, time_domain_assignment, &msg4_tda);
NR_pdsch_dmrs_t dmrs_info; NR_pdsch_dmrs_t dmrs_info = get_dl_dmrs_params(scc,
set_dl_dmrs_params(&dmrs_info, dl_bwp,
scc, &msg4_tda,
dl_bwp, 1);
&msg4_tda,
1);
uint8_t mcsTableIdx = dl_bwp->mcsTableIdx; uint8_t mcsTableIdx = dl_bwp->mcsTableIdx;
......
...@@ -282,7 +282,7 @@ uint32_t schedule_control_sib1(module_id_t module_id, ...@@ -282,7 +282,7 @@ uint32_t schedule_control_sib1(module_id_t module_id,
NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config,
int time_domain_allocation, int time_domain_allocation,
NR_pdsch_dmrs_t *dmrs_parms, NR_pdsch_dmrs_t *dmrs_parms,
NR_pdsch_tda_info_t *tda_info, NR_tda_info_t *tda_info,
uint8_t candidate_idx, uint8_t candidate_idx,
uint16_t num_total_bytes) { uint16_t num_total_bytes) {
...@@ -580,17 +580,16 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) ...@@ -580,17 +580,16 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
AssertFatal((startSymbolIndex+nrOfSymbols)<14,"SIB1 TDA %d would cause overlap with CSI-RS. Please select a different SIB1 TDA.\n",time_domain_allocation); AssertFatal((startSymbolIndex+nrOfSymbols)<14,"SIB1 TDA %d would cause overlap with CSI-RS. Please select a different SIB1 TDA.\n",time_domain_allocation);
NR_pdsch_tda_info_t tda_info; NR_tda_info_t tda_info = {
tda_info.mapping_type = is_typeA? typeA: typeB; .mapping_type = is_typeA ? typeA : typeB,
tda_info.startSymbolIndex = startSymbolIndex; .startSymbolIndex = startSymbolIndex,
tda_info.nrOfSymbols = nrOfSymbols; .nrOfSymbols = nrOfSymbols
};
NR_pdsch_dmrs_t dmrs_parms;
set_dl_dmrs_params(&dmrs_parms, NR_pdsch_dmrs_t dmrs_parms = get_dl_dmrs_params(scc,
scc, NULL,
NULL, &tda_info,
&tda_info, 1);
1);
// Configure sched_ctrlCommon for SIB1 // Configure sched_ctrlCommon for SIB1
uint32_t TBS = schedule_control_sib1(module_idP, CC_id, uint32_t TBS = schedule_control_sib1(module_idP, CC_id,
......
...@@ -410,7 +410,7 @@ bool allocate_dl_retransmission(module_id_t module_id, ...@@ -410,7 +410,7 @@ bool allocate_dl_retransmission(module_id_t module_id,
if (tda == retInfo->time_domain_allocation && if (tda == retInfo->time_domain_allocation &&
layers == retInfo->nrOfLayers) { layers == retInfo->nrOfLayers) {
NR_pdsch_tda_info_t *tda_info = &retInfo->tda_info; NR_tda_info_t *tda_info = &retInfo->tda_info;
/* Check that there are enough resources for retransmission */ /* Check that there are enough resources for retransmission */
while (rbSize < retInfo->rbSize) { while (rbSize < retInfo->rbSize) {
rbStart += rbSize; /* last iteration rbSize was not enough, skip it */ rbStart += rbSize; /* last iteration rbSize was not enough, skip it */
...@@ -433,14 +433,11 @@ bool allocate_dl_retransmission(module_id_t module_id, ...@@ -433,14 +433,11 @@ bool allocate_dl_retransmission(module_id_t module_id,
} else { } else {
/* the retransmission will use a different time domain allocation, check /* the retransmission will use a different time domain allocation, check
* that we have enough resources */ * that we have enough resources */
NR_pdsch_tda_info_t temp_tda; NR_tda_info_t temp_tda = nr_get_pdsch_tda_info(dl_bwp, tda);
nr_get_pdsch_tda_info(dl_bwp, tda, &temp_tda); NR_pdsch_dmrs_t temp_dmrs = get_dl_dmrs_params(scc,
NR_pdsch_dmrs_t temp_dmrs; dl_bwp,
set_dl_dmrs_params(&temp_dmrs, &temp_tda,
scc, layers);
dl_bwp,
&temp_tda,
layers);
const uint16_t slbitmap = SL_to_bitmap(temp_tda.startSymbolIndex, temp_tda.nrOfSymbols); const uint16_t slbitmap = SL_to_bitmap(temp_tda.startSymbolIndex, temp_tda.nrOfSymbols);
while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap) while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap)
...@@ -623,8 +620,7 @@ void pf_dl(module_id_t module_id, ...@@ -623,8 +620,7 @@ void pf_dl(module_id_t module_id,
else else
sched_pdsch->mcs = get_mcs_from_bler(bo, stats, &sched_ctrl->dl_bler_stats, max_mcs, frame); sched_pdsch->mcs = get_mcs_from_bler(bo, stats, &sched_ctrl->dl_bler_stats, max_mcs, frame);
sched_pdsch->nrOfLayers = get_dl_nrOfLayers(sched_ctrl, current_BWP->dci_format); sched_pdsch->nrOfLayers = get_dl_nrOfLayers(sched_ctrl, current_BWP->dci_format);
sched_pdsch->pm_index = set_pm_index(UE, sched_pdsch->pm_index = get_pm_index(UE,
sched_ctrl,
sched_pdsch->nrOfLayers, sched_pdsch->nrOfLayers,
mac->xp_pdsch_antenna_ports); mac->xp_pdsch_antenna_ports);
const uint8_t Qm = nr_get_Qm_dl(sched_pdsch->mcs, current_BWP->mcsTableIdx); const uint8_t Qm = nr_get_Qm_dl(sched_pdsch->mcs, current_BWP->mcsTableIdx);
...@@ -728,9 +724,9 @@ void pf_dl(module_id_t module_id, ...@@ -728,9 +724,9 @@ void pf_dl(module_id_t module_id,
NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch; NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch;
sched_pdsch->time_domain_allocation = get_dl_tda(RC.nrmac[module_id], scc, slot); sched_pdsch->time_domain_allocation = get_dl_tda(RC.nrmac[module_id], scc, slot);
AssertFatal(sched_pdsch->time_domain_allocation>=0,"Unable to find PDSCH time domain allocation in list\n"); AssertFatal(sched_pdsch->time_domain_allocation>=0,"Unable to find PDSCH time domain allocation in list\n");
NR_pdsch_tda_info_t *tda_info = &sched_pdsch->tda_info;
nr_get_pdsch_tda_info(dl_bwp, sched_pdsch->time_domain_allocation, tda_info); sched_pdsch->tda_info = nr_get_pdsch_tda_info(dl_bwp, sched_pdsch->time_domain_allocation);
NR_tda_info_t *tda_info = &sched_pdsch->tda_info;
const uint16_t slbitmap = SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols); const uint16_t slbitmap = SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols);
...@@ -743,11 +739,10 @@ void pf_dl(module_id_t module_id, ...@@ -743,11 +739,10 @@ void pf_dl(module_id_t module_id,
while (rbStart + max_rbSize < bwpSize && (rballoc_mask[rbStart + max_rbSize] & slbitmap) == slbitmap) while (rbStart + max_rbSize < bwpSize && (rballoc_mask[rbStart + max_rbSize] & slbitmap) == slbitmap)
max_rbSize++; max_rbSize++;
set_dl_dmrs_params(&sched_pdsch->dmrs_parms, sched_pdsch->dmrs_parms = get_dl_dmrs_params(scc,
scc, dl_bwp,
dl_bwp, tda_info,
tda_info, sched_pdsch->nrOfLayers);
sched_pdsch->nrOfLayers);
sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, dl_bwp->mcsTableIdx); sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, dl_bwp->mcsTableIdx);
sched_pdsch->R = nr_get_code_rate_dl(sched_pdsch->mcs, dl_bwp->mcsTableIdx); sched_pdsch->R = nr_get_code_rate_dl(sched_pdsch->mcs, dl_bwp->mcsTableIdx);
sched_pdsch->pucch_allocation = alloc; sched_pdsch->pucch_allocation = alloc;
...@@ -929,7 +924,7 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -929,7 +924,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
remove_nr_list(&sched_ctrl->retrans_dl_harq, current_harq_pid); remove_nr_list(&sched_ctrl->retrans_dl_harq, current_harq_pid);
} }
NR_pdsch_tda_info_t *tda_info = &sched_pdsch->tda_info; NR_tda_info_t *tda_info = &sched_pdsch->tda_info;
NR_pdsch_dmrs_t *dmrs_parms = &sched_pdsch->dmrs_parms; NR_pdsch_dmrs_t *dmrs_parms = &sched_pdsch->dmrs_parms;
NR_UE_harq_t *harq = &sched_ctrl->harq_processes[current_harq_pid]; NR_UE_harq_t *harq = &sched_ctrl->harq_processes[current_harq_pid];
DevAssert(!harq->is_waiting); DevAssert(!harq->is_waiting);
......
...@@ -197,8 +197,8 @@ void nr_preprocessor_phytest(module_id_t module_id, ...@@ -197,8 +197,8 @@ void nr_preprocessor_phytest(module_id_t module_id,
const int CC_id = 0; const int CC_id = 0;
const int tda = get_dl_tda(RC.nrmac[module_id], scc, slot); const int tda = get_dl_tda(RC.nrmac[module_id], scc, slot);
NR_pdsch_tda_info_t *tda_info = &sched_ctrl->sched_pdsch.tda_info; NR_tda_info_t tda_info = nr_get_pdsch_tda_info(dl_bwp, tda);
nr_get_pdsch_tda_info(dl_bwp, tda, tda_info); sched_ctrl->sched_pdsch.tda_info = tda_info;
sched_ctrl->sched_pdsch.time_domain_allocation = tda; sched_ctrl->sched_pdsch.time_domain_allocation = tda;
/* find largest unallocated chunk */ /* find largest unallocated chunk */
...@@ -214,12 +214,12 @@ void nr_preprocessor_phytest(module_id_t module_id, ...@@ -214,12 +214,12 @@ void nr_preprocessor_phytest(module_id_t module_id,
while (true) { while (true) {
/* advance to first free RB */ /* advance to first free RB */
while (rbStart < bwpSize && while (rbStart < bwpSize &&
(vrb_map[rbStart + BWPStart]&SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols))) (vrb_map[rbStart + BWPStart]&SL_to_bitmap(tda_info.startSymbolIndex, tda_info.nrOfSymbols)))
rbStart++; rbStart++;
rbSize = 1; rbSize = 1;
/* iterate until we are at target_dl_bw or no available RBs */ /* iterate until we are at target_dl_bw or no available RBs */
while (rbStart + rbSize < bwpSize && while (rbStart + rbSize < bwpSize &&
!(vrb_map[rbStart + rbSize + BWPStart]&SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols)) && !(vrb_map[rbStart + rbSize + BWPStart]&SL_to_bitmap(tda_info.startSymbolIndex, tda_info.nrOfSymbols)) &&
rbSize < target_dl_bw) rbSize < target_dl_bw)
rbSize++; rbSize++;
/* found target_dl_bw? */ /* found target_dl_bw? */
...@@ -305,11 +305,10 @@ void nr_preprocessor_phytest(module_id_t module_id, ...@@ -305,11 +305,10 @@ void nr_preprocessor_phytest(module_id_t module_id,
sched_pdsch->rbStart = rbStart; sched_pdsch->rbStart = rbStart;
sched_pdsch->rbSize = rbSize; sched_pdsch->rbSize = rbSize;
set_dl_dmrs_params(&sched_pdsch->dmrs_parms, sched_pdsch->dmrs_parms = get_dl_dmrs_params(scc,
scc, dl_bwp,
dl_bwp, &tda_info,
tda_info, target_dl_Nl);
target_dl_Nl);
sched_pdsch->mcs = target_dl_mcs; sched_pdsch->mcs = target_dl_mcs;
sched_pdsch->nrOfLayers = target_dl_Nl; sched_pdsch->nrOfLayers = target_dl_Nl;
...@@ -319,7 +318,7 @@ void nr_preprocessor_phytest(module_id_t module_id, ...@@ -319,7 +318,7 @@ void nr_preprocessor_phytest(module_id_t module_id,
sched_pdsch->tb_size = nr_compute_tbs(sched_pdsch->Qm, sched_pdsch->tb_size = nr_compute_tbs(sched_pdsch->Qm,
sched_pdsch->R, sched_pdsch->R,
sched_pdsch->rbSize, sched_pdsch->rbSize,
tda_info->nrOfSymbols, tda_info.nrOfSymbols,
sched_pdsch->dmrs_parms.N_PRB_DMRS * sched_pdsch->dmrs_parms.N_DMRS_SLOT, sched_pdsch->dmrs_parms.N_PRB_DMRS * sched_pdsch->dmrs_parms.N_DMRS_SLOT,
0 /* N_PRB_oh, 0 for initialBWP */, 0 /* N_PRB_oh, 0 for initialBWP */,
0 /* tb_scaling */, 0 /* tb_scaling */,
...@@ -331,7 +330,7 @@ void nr_preprocessor_phytest(module_id_t module_id, ...@@ -331,7 +330,7 @@ void nr_preprocessor_phytest(module_id_t module_id,
/* mark the corresponding RBs as used */ /* mark the corresponding RBs as used */
for (int rb = 0; rb < sched_pdsch->rbSize; rb++) for (int rb = 0; rb < sched_pdsch->rbSize; rb++)
vrb_map[rb + sched_pdsch->rbStart + BWPStart] = SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols); vrb_map[rb + sched_pdsch->rbStart + BWPStart] = SL_to_bitmap(tda_info.startSymbolIndex, tda_info.nrOfSymbols);
if ((frame&127) == 0) LOG_D(MAC,"phytest: %d.%d DL mcs %d, DL rbStart %d, DL rbSize %d\n", frame, slot, sched_pdsch->mcs, rbStart,rbSize); if ((frame&127) == 0) LOG_D(MAC,"phytest: %d.%d DL mcs %d, DL rbStart %d, DL rbSize %d\n", frame, slot, sched_pdsch->mcs, rbStart,rbSize);
} }
...@@ -393,13 +392,13 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_ ...@@ -393,13 +392,13 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_
else else
rbSize = target_ul_bw; rbSize = target_ul_bw;
NR_pusch_tda_info_t *tda_info = &sched_ctrl->sched_pusch.tda_info; NR_tda_info_t tda_info = nr_get_pusch_tda_info(ul_bwp, tda);
nr_get_pusch_tda_info(ul_bwp, tda, tda_info); sched_ctrl->sched_pusch.tda_info = tda_info;
uint16_t *vrb_map_UL = uint16_t *vrb_map_UL =
&RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[sched_slot * MAX_BWP_SIZE]; &RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[sched_slot * MAX_BWP_SIZE];
for (int i = rbStart; i < rbStart + rbSize; ++i) { for (int i = rbStart; i < rbStart + rbSize; ++i) {
if ((vrb_map_UL[i+BWPStart] & SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols)) != 0) { if ((vrb_map_UL[i+BWPStart] & SL_to_bitmap(tda_info.startSymbolIndex, tda_info.nrOfSymbols)) != 0) {
LOG_E(MAC, LOG_E(MAC,
"%s(): %4d.%2d RB %d is already reserved, cannot schedule UE\n", "%s(): %4d.%2d RB %d is already reserved, cannot schedule UE\n",
__func__, __func__,
...@@ -460,18 +459,17 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_ ...@@ -460,18 +459,17 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_
sched_pusch->Qm <<= 1; sched_pusch->Qm <<= 1;
} }
NR_pusch_dmrs_t *dmrs = &sched_ctrl->sched_pusch.dmrs_info; NR_pusch_dmrs_t dmrs = get_ul_dmrs_params(scc,
set_ul_dmrs_params(dmrs, ul_bwp,
scc, &tda_info,
ul_bwp, sched_pusch->nrOfLayers);
tda_info, sched_ctrl->sched_pusch.dmrs_info = dmrs;
sched_pusch->nrOfLayers);
sched_pusch->tb_size = nr_compute_tbs(sched_pusch->Qm, sched_pusch->tb_size = nr_compute_tbs(sched_pusch->Qm,
sched_pusch->R, sched_pusch->R,
sched_pusch->rbSize, sched_pusch->rbSize,
tda_info->nrOfSymbols, tda_info.nrOfSymbols,
dmrs->N_PRB_DMRS * dmrs->num_dmrs_symb, dmrs.N_PRB_DMRS * dmrs.num_dmrs_symb,
0, // nb_rb_oh 0, // nb_rb_oh
0, 0,
sched_pusch->nrOfLayers /* NrOfLayers */) sched_pusch->nrOfLayers /* NrOfLayers */)
...@@ -485,6 +483,6 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_ ...@@ -485,6 +483,6 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_
sched_ctrl->aggregation_level); sched_ctrl->aggregation_level);
for (int rb = rbStart; rb < rbStart + rbSize; rb++) for (int rb = rbStart; rb < rbStart + rbSize; rb++)
vrb_map_UL[rb+BWPStart] |= SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols); vrb_map_UL[rb+BWPStart] |= SL_to_bitmap(tda_info.startSymbolIndex, tda_info.nrOfSymbols);
return true; return true;
} }
...@@ -88,7 +88,7 @@ uint32_t schedule_control_sib1(module_id_t module_id, ...@@ -88,7 +88,7 @@ uint32_t schedule_control_sib1(module_id_t module_id,
NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config,
int time_domain_allocation, int time_domain_allocation,
NR_pdsch_dmrs_t *dmrs_parms, NR_pdsch_dmrs_t *dmrs_parms,
NR_pdsch_tda_info_t *tda_info, NR_tda_info_t *tda_info,
uint8_t candidate_idx, uint8_t candidate_idx,
uint16_t num_total_bytes); uint16_t num_total_bytes);
...@@ -324,19 +324,16 @@ long get_K2(NR_PUSCH_TimeDomainResourceAllocationList_t *tdaList, ...@@ -324,19 +324,16 @@ long get_K2(NR_PUSCH_TimeDomainResourceAllocationList_t *tdaList,
int time_domain_assignment, int time_domain_assignment,
int mu); int mu);
void nr_get_pdsch_tda_info(const NR_UE_DL_BWP_t *dl_bwp, NR_tda_info_t nr_get_pdsch_tda_info(const NR_UE_DL_BWP_t *dl_bwp,
int tda, const int tda);
NR_pdsch_tda_info_t *tda_info);
void nr_get_pusch_tda_info(const NR_UE_UL_BWP_t *ul_bwp, NR_tda_info_t nr_get_pusch_tda_info(const NR_UE_UL_BWP_t *ul_bwp,
int tda, const int tda);
NR_pusch_tda_info_t *tda_info);
void set_ul_dmrs_params(NR_pusch_dmrs_t *dmrs, NR_pusch_dmrs_t get_ul_dmrs_params(const NR_ServingCellConfigCommon_t *scc,
const NR_ServingCellConfigCommon_t *scc, const NR_UE_UL_BWP_t *ul_bwp,
NR_UE_UL_BWP_t *ul_bwp, const NR_tda_info_t *tda_info,
NR_pusch_tda_info_t *tda_info, const int Layers);
int Layers);
uint8_t nr_get_tpc(int target, uint8_t cqi, int incr); uint8_t nr_get_tpc(int target, uint8_t cqi, int incr);
...@@ -460,20 +457,18 @@ int16_t ssb_index_from_prach(module_id_t module_idP, ...@@ -460,20 +457,18 @@ int16_t ssb_index_from_prach(module_id_t module_idP,
void find_SSB_and_RO_available(module_id_t module_idP); void find_SSB_and_RO_available(module_id_t module_idP);
void set_dl_dmrs_params(NR_pdsch_dmrs_t *dmrs, NR_pdsch_dmrs_t get_dl_dmrs_params(const NR_ServingCellConfigCommon_t *scc,
const NR_ServingCellConfigCommon_t *scc, const NR_UE_DL_BWP_t *BWP,
NR_UE_DL_BWP_t *BWP, const NR_tda_info_t *tda_info,
NR_pdsch_tda_info_t *tda_info, const int Layers);
int Layers);
uint16_t set_pm_index(NR_UE_info_t *UE, uint16_t get_pm_index(const NR_UE_info_t *UE,
NR_UE_sched_ctrl_t *sched_ctrl,
int layers, int layers,
int xp_pdsch_antenna_ports); int xp_pdsch_antenna_ports);
uint8_t get_mcs_from_cqi(int mcs_table, int cqi_table, int cqi_idx); uint8_t get_mcs_from_cqi(int mcs_table, int cqi_table, int cqi_idx);
uint8_t get_dl_nrOfLayers(NR_UE_sched_ctrl_t *sched_ctrl, nr_dci_format_t dci_format); uint8_t get_dl_nrOfLayers(const NR_UE_sched_ctrl_t *sched_ctrl, const nr_dci_format_t dci_format);
const int get_dl_tda(const gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon_t *scc, int slot); const int get_dl_tda(const gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon_t *scc, int slot);
const int get_ul_tda(const gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon_t *scc, int slot); const int get_ul_tda(const gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon_t *scc, int slot);
......
...@@ -373,11 +373,11 @@ typedef struct NR_sched_pucch { ...@@ -373,11 +373,11 @@ typedef struct NR_sched_pucch {
int start_symb; int start_symb;
} NR_sched_pucch_t; } NR_sched_pucch_t;
typedef struct NR_pusch_tda_info { typedef struct NR_tda_info {
int mapping_type; mappingType_t mapping_type;
int startSymbolIndex; int startSymbolIndex;
int nrOfSymbols; int nrOfSymbols;
} NR_pusch_tda_info_t; } NR_tda_info_t;
typedef struct NR_pusch_dmrs { typedef struct NR_pusch_dmrs {
uint8_t N_PRB_DMRS; uint8_t N_PRB_DMRS;
...@@ -409,9 +409,10 @@ typedef struct NR_sched_pusch { ...@@ -409,9 +409,10 @@ typedef struct NR_sched_pusch {
int8_t ul_harq_pid; int8_t ul_harq_pid;
uint8_t nrOfLayers; uint8_t nrOfLayers;
// time_domain_allocation is the index of a list of tda
int time_domain_allocation; int time_domain_allocation;
NR_tda_info_t tda_info;
NR_pusch_dmrs_t dmrs_info; NR_pusch_dmrs_t dmrs_info;
NR_pusch_tda_info_t tda_info;
} NR_sched_pusch_t; } NR_sched_pusch_t;
typedef struct NR_sched_srs { typedef struct NR_sched_srs {
...@@ -420,12 +421,6 @@ typedef struct NR_sched_srs { ...@@ -420,12 +421,6 @@ typedef struct NR_sched_srs {
bool srs_scheduled; bool srs_scheduled;
} NR_sched_srs_t; } NR_sched_srs_t;
typedef struct NR_pdsch_tda_info {
int mapping_type;
int startSymbolIndex;
int nrOfSymbols;
} NR_pdsch_tda_info_t;
typedef struct NR_pdsch_dmrs { typedef struct NR_pdsch_dmrs {
uint8_t dmrs_ports_id; uint8_t dmrs_ports_id;
uint8_t N_PRB_DMRS; uint8_t N_PRB_DMRS;
...@@ -454,12 +449,13 @@ typedef struct NR_sched_pdsch { ...@@ -454,12 +449,13 @@ typedef struct NR_sched_pdsch {
// pucch format allocation // pucch format allocation
uint8_t pucch_allocation; uint8_t pucch_allocation;
int time_domain_allocation;
uint16_t pm_index; uint16_t pm_index;
uint8_t nrOfLayers; uint8_t nrOfLayers;
NR_pdsch_dmrs_t dmrs_parms; NR_pdsch_dmrs_t dmrs_parms;
NR_pdsch_tda_info_t tda_info; // time_domain_allocation is the index of a list of tda
int time_domain_allocation;
NR_tda_info_t tda_info;
} NR_sched_pdsch_t; } NR_sched_pdsch_t;
typedef struct NR_UE_harq { typedef struct NR_UE_harq {
......
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