diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c b/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c index ebc9c96970..fa729704a5 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c @@ -119,6 +119,8 @@ void nr_fill_dci_and_dlsch(PHY_VARS_gNB *gNB, nfapi_nr_dl_config_dci_dl_pdu_rel15_t *pdu_rel15 = &pdu->dci_dl_pdu.dci_dl_pdu_rel15; nfapi_nr_dl_config_pdcch_parameters_rel15_t *params_rel15 = &pdu->dci_dl_pdu.pdcch_params_rel15; nfapi_nr_config_request_t *cfg = &gNB->gNB_config; + NR_gNB_DLSCH_t *dlsch = &gNB->dlsch; + NR_DL_gNB_HARQ_t **harq = dlsch->harq_processes; uint16_t N_RB = fp->initial_bwp_dl.N_RB; uint16_t N_RB_UL = fp->initial_bwp_ul.N_RB; diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 9fc9dd10d1..53f0a7791b 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -158,6 +158,42 @@ uint8_t nr_generate_pdsch(NR_gNB_DLSCH_t dlsch, NR_DL_FRAME_PARMS frame_parms, nfapi_nr_config_request_t config) { + NR_DL_gNB_HARQ_t *harq = dlsch.harq_processes[0]; + uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH]={0}; + uint16_t mod_symbs[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>1] = {0}; + uint16_t tx_layers[NR_MAX_NB_LAYERS][NR_MAX_PDSCH_ENCODED_LENGTH>>1]; + + /// CRC, coding, interleaving and rate matching + + /// scrambling + uint16_t n_RNTI = (pdcch_params.search_space_type == NFAPI_NR_SEARCH_SPACE_TYPE_UE_SPECIFIC)? ((pdcch_params.scrambling_id)?pdcch_params.rnti:0) : 0; + uint16_t Nid = (pdcch_params.search_space_type == NFAPI_NR_SEARCH_SPACE_TYPE_UE_SPECIFIC)? pdcch_params.scrambling_id : config.sch_config.physical_cell_id.value; + for (int q=0; qn_codewords; q++) + nr_pdsch_codeword_scrambling(harq->f, + harq->TBS, + q, + Nid, + n_RNTI, + scrambled_output[q]); + + /// Modulation + for (int q=0; qn_codewords; q++) + nr_pdsch_codeword_modulation(scrambled_output[q], + harq->Qm, + harq->TBS, + mod_symbs[q]); + + /// Layer mapping + nr_pdsch_layer_mapping(mod_symbs, + harq->n_codewords, + harq->Nl, + n_symbs, + tx_layers); + + /// Antenna port mapping -- Not yet necessary + + /// Resource mapping + return 0; } diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 49f4d94305..05a6b267b7 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -132,16 +132,26 @@ typedef struct { uint8_t first_layer; /// codeword this transport block is mapped to uint8_t codeword; + /// Number of codewords + uint8_t n_codewords; } NR_DL_gNB_HARQ_t; typedef struct { - /// Pointers to 8 HARQ processes for the DLSCH - NR_DL_gNB_HARQ_t *harq_processes[8]; + /// Pointers to 16 HARQ processes for the DLSCH + NR_DL_gNB_HARQ_t *harq_processes[16]; nfapi_nr_pdsch_time_domain_alloc_type_e time_alloc_type; uint8_t time_alloc_list_flag; uint8_t rbg_list[NR_MAX_NB_RBG]; + /// Time domain allocation + uint8_t S; + uint8_t L; + /// Freq domain allocation + uint16_t rb_start; + uint16_t n_rb; + /// BWP index + uint8_t bwp_idx; /// TX buffers for UE-spec transmission (antenna ports 5 or 7..14, prior to precoding) int32_t *txdataF[8]; diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index 3f125e9d93..b7fabb1a27 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -85,6 +85,7 @@ #define NR_MAX_CSET_DURATION 3 #define NR_MAX_NB_RBG 18 +#define NR_MAX_NB_LAYERS 8 typedef enum { NR_MU_0=0, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 4a5054b52a..f2c9ee8661 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -70,8 +70,8 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, cfg->rf_config.dl_channel_bandwidth.value); memcpy((void*)params_rel15, (void*)&gNB->pdcch_type0_params, sizeof(nfapi_nr_dl_config_pdcch_parameters_rel15_t)); - pdu_rel15->frequency_domain_assignment = 5; - pdu_rel15->time_domain_assignment = 3; + pdu_rel15->frequency_domain_assignment = get_RIV(0, 40, 106); + pdu_rel15->time_domain_assignment = get_SLIV(8, 14); pdu_rel15->vrb_to_prb_mapping = 1; pdu_rel15->mcs = 12; pdu_rel15->tb_scaling = 1;