Commit 478ea7ab authored by francescomani's avatar francescomani

BG at MAC as part of new FAPI version

parent 04a09c99
...@@ -495,9 +495,3 @@ void SLIV2SL(int SLIV,int *S,int *L) { ...@@ -495,9 +495,3 @@ void SLIV2SL(int SLIV,int *S,int *L) {
} }
} }
int get_BG(uint32_t A, float code_rate) {
if ((A <=292) || ((A<=3824) && (code_rate <= 0.6667)) || code_rate <= 0.25)
return 2;
else
return 1;
}
...@@ -76,7 +76,6 @@ uint16_t SL_to_bitmap(int startSymbolIndex, int nrOfSymbols); ...@@ -76,7 +76,6 @@ uint16_t SL_to_bitmap(int startSymbolIndex, int nrOfSymbols);
int get_nb_periods_per_frame(uint8_t tdd_period); int get_nb_periods_per_frame(uint8_t tdd_period);
int get_supported_band_index(int scs, int band, int n_rbs); int get_supported_band_index(int scs, int band, int n_rbs);
long rrc_get_max_nr_csrs(uint8_t max_rbs, long b_SRS); long rrc_get_max_nr_csrs(uint8_t max_rbs, long b_SRS);
int get_BG(uint32_t A, float code_rate);
#define CEILIDIV(a,b) ((a+b-1)/b) #define CEILIDIV(a,b) ((a+b-1)/b)
#define ROUNDIDIV(a,b) (((a<<1)+b)/(b<<1)) #define ROUNDIDIV(a,b) (((a<<1)+b)/(b<<1))
......
...@@ -777,6 +777,7 @@ typedef struct { ...@@ -777,6 +777,7 @@ typedef struct {
} nfapi_nr_dl_tti_pdcch_pdu_rel15_t; } nfapi_nr_dl_tti_pdcch_pdu_rel15_t;
typedef struct { typedef struct {
uint8_t ldpcBaseGraph;
uint32_t tbSizeLbrmBytes; uint32_t tbSizeLbrmBytes;
}nfapi_v3_pdsch_maintenance_parameters_t; }nfapi_v3_pdsch_maintenance_parameters_t;
...@@ -1193,6 +1194,7 @@ typedef struct ...@@ -1193,6 +1194,7 @@ typedef struct
#define PUSCH_PDU_BITMAP_DFTS_OFDM 0x8 #define PUSCH_PDU_BITMAP_DFTS_OFDM 0x8
typedef struct { typedef struct {
uint8_t ldpcBaseGraph;
uint32_t tbSizeLbrmBytes; uint32_t tbSizeLbrmBytes;
}nfapi_v3_pusch_maintenance_parameters_t; }nfapi_v3_pusch_maintenance_parameters_t;
......
...@@ -376,11 +376,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -376,11 +376,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
memcpy(harq->b, a, (A / 8) + 3); // using 3 bytes to mimic the case of 24 bit crc memcpy(harq->b, a, (A / 8) + 3); // using 3 bytes to mimic the case of 24 bit crc
} }
// target_code_rate is in 0.1 units impp.BG = rel15->maintenance_parms_v3.ldpcBaseGraph;
float Coderate = (float) rel15->targetCodeRate[0] / 10240.0f;
LOG_D(PHY,"DLSCH Coderate %f\n",Coderate);
impp.BG = get_BG(A, Coderate);
start_meas(dlsch_segmentation_stats); start_meas(dlsch_segmentation_stats);
impp.Kb = nr_segmentation(harq->b, harq->c, harq->B, &impp.n_segments, &impp.K, impp.Zc, &impp.F, impp.BG); impp.Kb = nr_segmentation(harq->b, harq->c, harq->B, &impp.n_segments, &impp.K, impp.Zc, &impp.F, impp.BG);
......
...@@ -382,7 +382,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -382,7 +382,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
uint32_t r; uint32_t r;
uint32_t r_offset; uint32_t r_offset;
uint32_t offset; uint32_t offset;
int kc;
int E; int E;
#ifdef PRINT_CRC_CHECK #ifdef PRINT_CRC_CHECK
...@@ -445,8 +444,9 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -445,8 +444,9 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
LOG_D(PHY,"ULSCH Decoding, harq_pid %d TBS %d G %d mcs %d Nl %d nb_rb %d, Qm %d, Coderate %f RV %d round %d\n", LOG_D(PHY,"ULSCH Decoding, harq_pid %d TBS %d G %d mcs %d Nl %d nb_rb %d, Qm %d, Coderate %f RV %d round %d\n",
harq_pid, A, G, mcs, n_layers, nb_rb, Qm, Coderate, pusch_pdu->pusch_data.rv_index, harq_process->round); harq_pid, A, G, mcs, n_layers, nb_rb, Qm, Coderate, pusch_pdu->pusch_data.rv_index, harq_process->round);
if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25){ p_decParams->BG = pusch_pdu->maintenance_parms_v3.ldpcBaseGraph;
p_decParams->BG = 2; int kc;
if (p_decParams->BG == 2){
kc = 52; kc = 52;
if (Coderate < 0.3333) { if (Coderate < 0.3333) {
p_decParams->R = 15; p_decParams->R = 15;
...@@ -458,7 +458,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -458,7 +458,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
p_decParams->R = 23; p_decParams->R = 23;
} }
} else { } else {
p_decParams->BG = 1;
kc = 68; kc = 68;
if (Coderate < 0.6667) { if (Coderate < 0.6667) {
p_decParams->R = 13; p_decParams->R = 13;
......
...@@ -1121,6 +1121,8 @@ void fill_msg3_pusch_pdu(nfapi_nr_pusch_pdu_t *pusch_pdu, ...@@ -1121,6 +1121,8 @@ void fill_msg3_pusch_pdu(nfapi_nr_pusch_pdu_t *pusch_pdu,
pusch_pdu->mcs_index = mcsindex; pusch_pdu->mcs_index = mcsindex;
pusch_pdu->pusch_data.tb_size = TBS; pusch_pdu->pusch_data.tb_size = TBS;
pusch_pdu->maintenance_parms_v3.ldpcBaseGraph = get_BG(TBS<<3,R);
} }
} }
...@@ -1425,6 +1427,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra ...@@ -1425,6 +1427,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
pdsch_pdu_rel15->maintenance_parms_v3.tbSizeLbrmBytes = nr_compute_tbslbrm(mcsTableIdx, pdsch_pdu_rel15->maintenance_parms_v3.tbSizeLbrmBytes = nr_compute_tbslbrm(mcsTableIdx,
bw_tbslbrm, bw_tbslbrm,
1); 1);
pdsch_pdu_rel15->maintenance_parms_v3.ldpcBaseGraph = get_BG(TBS<<3,R);
// Fill PDCCH DL DCI PDU // Fill PDCCH DL DCI PDU
nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci]; nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci];
...@@ -1829,6 +1832,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra ...@@ -1829,6 +1832,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
pdsch_pdu_rel15->maintenance_parms_v3.tbSizeLbrmBytes = nr_compute_tbslbrm(mcsTableIdx, pdsch_pdu_rel15->maintenance_parms_v3.tbSizeLbrmBytes = nr_compute_tbslbrm(mcsTableIdx,
bw_tbslbrm, bw_tbslbrm,
1); 1);
pdsch_pdu_rel15->maintenance_parms_v3.ldpcBaseGraph = get_BG(harq->tb_size<<3,R);
pdsch_pdu_rel15->precodingAndBeamforming.num_prgs=1; pdsch_pdu_rel15->precodingAndBeamforming.num_prgs=1;
pdsch_pdu_rel15->precodingAndBeamforming.prg_size=275; pdsch_pdu_rel15->precodingAndBeamforming.prg_size=275;
......
...@@ -465,6 +465,7 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, ...@@ -465,6 +465,7 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP,
pdsch_pdu_rel15->maintenance_parms_v3.tbSizeLbrmBytes = nr_compute_tbslbrm(0, pdsch_pdu_rel15->maintenance_parms_v3.tbSizeLbrmBytes = nr_compute_tbslbrm(0,
pdsch_pdu_rel15->BWPSize, pdsch_pdu_rel15->BWPSize,
1); 1);
pdsch_pdu_rel15->maintenance_parms_v3.ldpcBaseGraph = get_BG(TBS<<3,pdsch_pdu_rel15->targetCodeRate[0]);
/* Fill PDCCH DL DCI PDU */ /* Fill PDCCH DL DCI PDU */
nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci]; nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci];
......
...@@ -1128,6 +1128,7 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -1128,6 +1128,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
pdsch_pdu->maintenance_parms_v3.tbSizeLbrmBytes = nr_compute_tbslbrm(ps->mcsTableIdx, pdsch_pdu->maintenance_parms_v3.tbSizeLbrmBytes = nr_compute_tbslbrm(ps->mcsTableIdx,
bw_tbslbrm, bw_tbslbrm,
nl_tbslbrm); nl_tbslbrm);
pdsch_pdu->maintenance_parms_v3.ldpcBaseGraph = get_BG(TBS<<3,R);
NR_PDSCH_Config_t *pdsch_Config=NULL; NR_PDSCH_Config_t *pdsch_Config=NULL;
......
...@@ -245,6 +245,15 @@ void set_dl_dmrs_ports(NR_pdsch_semi_static_t *ps) { ...@@ -245,6 +245,15 @@ void set_dl_dmrs_ports(NR_pdsch_semi_static_t *ps) {
} }
} }
uint8_t get_BG(uint32_t A, uint16_t R) {
float code_rate = (float) R / 10240.0f;
if ((A <=292) || ((A<=3824) && (code_rate <= 0.6667)) || code_rate <= 0.25)
return 2;
else
return 1;
}
NR_BWP_t *get_dl_bwp_genericParameters(NR_BWP_Downlink_t *active_bwp, NR_BWP_t *get_dl_bwp_genericParameters(NR_BWP_Downlink_t *active_bwp,
NR_ServingCellConfigCommon_t *ServingCellConfigCommon, NR_ServingCellConfigCommon_t *ServingCellConfigCommon,
const NR_SIB1_t *sib1) { const NR_SIB1_t *sib1) {
......
...@@ -1837,6 +1837,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) ...@@ -1837,6 +1837,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot)
pusch_pdu->pusch_data.num_cb = 0; //CBG not supported pusch_pdu->pusch_data.num_cb = 0; //CBG not supported
pusch_pdu->maintenance_parms_v3.tbSizeLbrmBytes = 0; pusch_pdu->maintenance_parms_v3.tbSizeLbrmBytes = 0;
pusch_pdu->maintenance_parms_v3.ldpcBaseGraph = get_BG(sched_pusch->tb_size<<3,sched_pusch->R);
LOG_D(NR_MAC,"PUSCH PDU : data_scrambling_identity %x, dmrs_scrambling_id %x\n",pusch_pdu->data_scrambling_id,pusch_pdu->ul_dmrs_scrambling_id); LOG_D(NR_MAC,"PUSCH PDU : data_scrambling_identity %x, dmrs_scrambling_id %x\n",pusch_pdu->data_scrambling_id,pusch_pdu->ul_dmrs_scrambling_id);
/* TRANSFORM PRECODING --------------------------------------------------------*/ /* TRANSFORM PRECODING --------------------------------------------------------*/
......
...@@ -498,7 +498,7 @@ uint16_t set_pm_index(NR_UE_sched_ctrl_t *sched_ctrl, ...@@ -498,7 +498,7 @@ uint16_t set_pm_index(NR_UE_sched_ctrl_t *sched_ctrl,
int codebook_mode); int codebook_mode);
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_BG(uint32_t A, uint16_t R);
uint8_t set_dl_nrOfLayers(NR_UE_sched_ctrl_t *sched_ctrl); uint8_t set_dl_nrOfLayers(NR_UE_sched_ctrl_t *sched_ctrl);
int get_dci_format(NR_UE_sched_ctrl_t *sched_ctrl); int get_dci_format(NR_UE_sched_ctrl_t *sched_ctrl);
......
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