Commit 7ca13083 authored by francescomani's avatar francescomani

move computation of base graph for LDPC at MAC in the UE

parent b2c5f4bc
......@@ -348,6 +348,7 @@ typedef struct
uint8_t start_symbol_index;
uint8_t nr_of_symbols;
uint32_t tbslbrm;
uint8_t ldpcBaseGraph;
//Optional Data only included if indicated in pduBitmap
nfapi_nr_ue_pusch_data_t pusch_data;
nfapi_nr_ue_pusch_uci_t pusch_uci;
......@@ -491,6 +492,7 @@ typedef struct {
uint16_t dlDmrsScramblingId;
uint16_t pduBitmap;
uint32_t k1_feedback;
uint8_t ldpcBaseGraph;
} fapi_nr_dl_config_dlsch_pdu_rel15_t;
typedef struct {
......
......@@ -44,7 +44,6 @@
#include "executables/nr-uesoftmodem.h"
#include "PHY/CODING/nrLDPC_extern.h"
#include "common/utils/nr/nr_common.h"
#include "openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h"
#include "openair1/PHY/TOOLS/phy_scope_interface.h"
//#define ENABLE_PHY_PAYLOAD_DEBUG 1
......@@ -348,7 +347,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
LOG_D(PHY,"%d.%d DLSCH Decoding, harq_pid %d TBS %d (%d) G %d nb_re_dmrs %d length dmrs %d mcs %d Nl %d nb_symb_sch %d nb_rb %d Qm %d Coderate %f\n",
frame,nr_slot_rx,harq_pid,A,A/8,G, nb_re_dmrs, dmrs_length, dlsch->dlsch_config.mcs, dlsch->Nl, nb_symb_sch, nb_rb, dlsch->dlsch_config.qamModOrder, Coderate);
decParams.BG = get_BG(A, dlsch->dlsch_config.targetCodeRate);
decParams.BG = dlsch->dlsch_config.ldpcBaseGraph;
unsigned int kc = decParams.BG == 2 ? 52 : 68;
if (harq_process->first_rx == 1) {
......
......@@ -122,11 +122,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
///////////////////////// b---->| block segmentation |---->c /////////////////////////
///////////
if ((A <= 292) || ((A <= NR_MAX_PDSCH_TBS) && (Coderate <= 0.6667)) || Coderate <= 0.25) {
harq_process->BG = 2;
} else {
harq_process->BG = 1;
}
harq_process->BG = ulsch->pusch_pdu.ldpcBaseGraph;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_SEGMENTATION, VCD_FUNCTION_IN);
start_meas(&ue->ulsch_segmentation_stats);
......
......@@ -483,6 +483,7 @@ int main(int argc, char **argv)
dlsch0_ue->dlsch_config.rv = rvidx;
dlsch0_ue->dlsch_config.targetCodeRate = rate;
dlsch0_ue->dlsch_config.TBS = TBS;
dlsch0_ue->dlsch_config.ldpcBaseGraph = get_BG(TBS, rate);
dlsch0_ue->dlsch_config.dmrsConfigType = NFAPI_NR_DMRS_TYPE1;
dlsch0_ue->dlsch_config.dlDmrsSymbPos = 4;
dlsch0_ue->dlsch_config.n_dmrs_cdm_groups = 1;
......
......@@ -506,6 +506,7 @@ int main(int argc, char **argv)
ulsch_ue->pusch_pdu.pusch_data.tb_size = TBS>>3;
ulsch_ue->pusch_pdu.target_code_rate = code_rate;
ulsch_ue->pusch_pdu.qam_mod_order = mod_order;
ulsch_ue->pusch_pdu.ldpcBaseGraph = get_BG(TBS, code_rate);
unsigned char *test_input = harq_process_ul_ue->a;
///////////
......
......@@ -1116,6 +1116,7 @@ int main(int argc, char *argv[])
pusch_config_pdu->absolute_delta_PUSCH = 0;
pusch_config_pdu->target_code_rate = code_rate;
pusch_config_pdu->tbslbrm = tbslbrm;
pusch_config_pdu->ldpcBaseGraph = get_BG(TBS, code_rate);
pusch_config_pdu->pusch_data.tb_size = TBS / 8;
pusch_config_pdu->pusch_data.new_data_indicator = round == 0 ? true : false;
pusch_config_pdu->pusch_data.rv_index = rv_index;
......
......@@ -4075,8 +4075,8 @@ void csi_period_offset(NR_CSI_ReportConfig_t *csirep,
}
}
uint8_t get_BG(uint32_t A, uint16_t R) {
uint8_t get_BG(uint32_t A, uint16_t R)
{
float code_rate = (float) R / 10240.0f;
if ((A <= 292) || ((A <= NR_MAX_PDSCH_TBS) && (code_rate <= 0.6667)) || code_rate <= 0.25)
return 2;
......
......@@ -736,6 +736,8 @@ static int nr_ue_process_dci_dl_10(module_id_t module_id,
dlsch_pdu->TBS = current_harq->TBS;
}
dlsch_pdu->ldpcBaseGraph = get_BG(dlsch_pdu->TBS, dlsch_pdu->targetCodeRate);
int bw_tbslbrm = current_DL_BWP ? mac->sc_info.dl_bw_tbslbrm : dlsch_pdu->BWPSize;
dlsch_pdu->tbslbrm = nr_compute_tbslbrm(dlsch_pdu->mcs_table, bw_tbslbrm, 1);
......@@ -1163,6 +1165,8 @@ static int nr_ue_process_dci_dl_11(module_id_t module_id,
dlsch_pdu->TBS = current_harq->TBS;
}
dlsch_pdu->ldpcBaseGraph = get_BG(dlsch_pdu->TBS, dlsch_pdu->targetCodeRate);
// TBS_LBRM according to section 5.4.2.1 of 38.212
AssertFatal(sc_info->maxMIMO_Layers_PDSCH != NULL, "Option with max MIMO layers not configured is not supported\n");
int nl_tbslbrm = *sc_info->maxMIMO_Layers_PDSCH < 4 ? *sc_info->maxMIMO_Layers_PDSCH : 4;
......
......@@ -739,6 +739,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
pusch_config_pdu->target_code_rate = mac->ul_harq_info[pid].R;
pusch_config_pdu->pusch_data.tb_size = mac->ul_harq_info[pid].TBS;
}
pusch_config_pdu->ldpcBaseGraph = get_BG(pusch_config_pdu->pusch_data.tb_size << 3, pusch_config_pdu->target_code_rate);
return 0;
}
......
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