Merge remote-tracking branch 'origin/remove-stored-G-in-UE-dl' into integration_2024_w14
This commit is contained in:
@@ -274,7 +274,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
uint8_t nr_slot_rx,
|
||||
uint8_t harq_pid,
|
||||
int b_size,
|
||||
uint8_t b[b_size])
|
||||
uint8_t b[b_size],
|
||||
int G)
|
||||
{
|
||||
uint32_t ret,offset;
|
||||
uint32_t r,r_offset=0,Kr=8424,Kr_bytes;
|
||||
@@ -339,7 +340,6 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
uint32_t A = dlsch->dlsch_config.TBS;
|
||||
ret = dlsch->max_ldpc_iterations + 1;
|
||||
dlsch->last_iteration_cnt = ret;
|
||||
uint32_t G = harq_process->G;
|
||||
|
||||
// target_code_rate is in 0.1 units
|
||||
float Coderate = (float) dlsch->dlsch_config.targetCodeRate / 10240.0f;
|
||||
|
||||
@@ -255,7 +255,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
||||
int nbRx,
|
||||
int32_t rxdataF_comp[][nbRx][rx_size_symbol * NR_SYMBOLS_PER_SLOT],
|
||||
c16_t ptrs_phase_per_slot[][NR_SYMBOLS_PER_SLOT],
|
||||
int32_t ptrs_re_per_slot[][NR_SYMBOLS_PER_SLOT])
|
||||
int32_t ptrs_re_per_slot[][NR_SYMBOLS_PER_SLOT],
|
||||
int G)
|
||||
{
|
||||
const int nl = dlsch[0].Nl;
|
||||
const int matrixSz = ue->frame_parms.nb_antennas_rx * nl;
|
||||
@@ -335,9 +336,9 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
||||
}
|
||||
|
||||
DEBUG_HARQ("[DEMOD] cw for TB0 = %d, cw for TB1 = %d\n", codeword_TB0, codeword_TB1);
|
||||
|
||||
int start_rb = dlsch[0].dlsch_config.start_rb;
|
||||
int nb_rb_pdsch = dlsch[0].dlsch_config.number_rbs;
|
||||
fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config = &dlsch[0].dlsch_config;
|
||||
int start_rb = dlsch_config->start_rb;
|
||||
int nb_rb_pdsch = dlsch_config->number_rbs;
|
||||
|
||||
DevAssert(dlsch0_harq);
|
||||
|
||||
@@ -361,8 +362,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
||||
slot = 1;
|
||||
}
|
||||
|
||||
uint8_t pilots = (dlsch[0].dlsch_config.dlDmrsSymbPos >> symbol) & 1;
|
||||
uint8_t config_type = dlsch[0].dlsch_config.dmrsConfigType;
|
||||
uint8_t pilots = (dlsch_config->dlDmrsSymbPos >> symbol) & 1;
|
||||
uint8_t config_type = dlsch_config->dmrsConfigType;
|
||||
//----------------------------------------------------------
|
||||
//--------------------- RBs extraction ---------------------
|
||||
//----------------------------------------------------------
|
||||
@@ -386,12 +387,12 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
||||
symbol,
|
||||
pilots,
|
||||
config_type,
|
||||
start_rb + dlsch[0].dlsch_config.BWPStart,
|
||||
start_rb + dlsch_config->BWPStart,
|
||||
nb_rb_pdsch,
|
||||
dlsch[0].dlsch_config.n_dmrs_cdm_groups,
|
||||
dlsch_config->n_dmrs_cdm_groups,
|
||||
nl,
|
||||
frame_parms,
|
||||
dlsch[0].dlsch_config.dlDmrsSymbPos,
|
||||
dlsch_config->dlDmrsSymbPos,
|
||||
ue->chest_time);
|
||||
if (meas_enabled) {
|
||||
stop_meas(&meas);
|
||||
@@ -409,12 +410,12 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
||||
memcpy(ue->phy_sim_pdsch_rxdataF_ext + offset, rxdataF_ext, rx_size_symbol * sizeof(c16_t));
|
||||
}
|
||||
|
||||
nb_re_pdsch = (pilots == 1)
|
||||
? ((config_type == NFAPI_NR_DMRS_TYPE1) ? nb_rb_pdsch * (12 - 6 * dlsch[0].dlsch_config.n_dmrs_cdm_groups) : nb_rb_pdsch * (12 - 4 * dlsch[0].dlsch_config.n_dmrs_cdm_groups))
|
||||
: (nb_rb_pdsch * 12);
|
||||
//----------------------------------------------------------
|
||||
//--------------------- Channel Scaling --------------------
|
||||
//----------------------------------------------------------
|
||||
nb_re_pdsch = (pilots == 1) ? ((config_type == NFAPI_NR_DMRS_TYPE1) ? nb_rb_pdsch * (12 - 6 * dlsch_config->n_dmrs_cdm_groups)
|
||||
: nb_rb_pdsch * (12 - 4 * dlsch_config->n_dmrs_cdm_groups))
|
||||
: (nb_rb_pdsch * 12);
|
||||
//----------------------------------------------------------
|
||||
//--------------------- Channel Scaling --------------------
|
||||
//----------------------------------------------------------
|
||||
if (meas_enabled)
|
||||
start_meas(&meas);
|
||||
nr_dlsch_scale_channel(rx_size_symbol, dl_ch_estimates_ext, frame_parms, nl, n_rx, symbol, pilots, nb_re_pdsch, nb_rb_pdsch);
|
||||
@@ -493,7 +494,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
||||
symbol,
|
||||
nb_re_pdsch,
|
||||
first_symbol_flag,
|
||||
dlsch[0].dlsch_config.qamModOrder,
|
||||
dlsch_config->qamModOrder,
|
||||
nb_rb_pdsch,
|
||||
*log2_maxh,
|
||||
measurements); // log2_maxh+I0_shift
|
||||
@@ -535,7 +536,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
||||
dl_ch_magr,
|
||||
dl_ch_estimates_ext,
|
||||
nb_rb_pdsch,
|
||||
dlsch[0].dlsch_config.qamModOrder,
|
||||
dlsch_config->qamModOrder,
|
||||
*log2_maxh,
|
||||
symbol,
|
||||
nb_re_pdsch);
|
||||
@@ -561,9 +562,9 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
||||
int pduBitmap = 0;
|
||||
|
||||
if(dlsch0_harq->status == ACTIVE) {
|
||||
startSymbIdx = dlsch[0].dlsch_config.start_symbol;
|
||||
nbSymb = dlsch[0].dlsch_config.number_symbols;
|
||||
pduBitmap = dlsch[0].dlsch_config.pduBitmap;
|
||||
startSymbIdx = dlsch_config->start_symbol;
|
||||
nbSymb = dlsch_config->number_symbols;
|
||||
pduBitmap = dlsch_config->pduBitmap;
|
||||
}
|
||||
|
||||
/* Check for PTRS bitmap and process it respectively */
|
||||
@@ -572,11 +573,9 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
||||
ue, nbRx, ptrs_phase_per_slot, ptrs_re_per_slot, rx_size_symbol, rxdataF_comp, frame_parms, dlsch0_harq, dlsch1_harq, gNB_id, nr_slot_rx, symbol, (nb_rb_pdsch * 12), dlsch[0].rnti, dlsch);
|
||||
dl_valid_re[symbol-1] -= ptrs_re_per_slot[0][symbol];
|
||||
}
|
||||
|
||||
/* at last symbol in a slot calculate LLR's for whole slot */
|
||||
if(symbol == (startSymbIdx + nbSymb -1)) {
|
||||
|
||||
const uint32_t rx_llr_layer_size = (dlsch0_harq->G + dlsch[0].Nl - 1) / dlsch[0].Nl;
|
||||
const uint32_t rx_llr_layer_size = (G + dlsch[0].Nl - 1) / dlsch[0].Nl;
|
||||
|
||||
int16_t* layer_llr[NR_MAX_NB_LAYERS];
|
||||
for (int i = 0; i < NR_MAX_NB_LAYERS; i++)
|
||||
@@ -610,13 +609,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
||||
llr_offset);
|
||||
}
|
||||
|
||||
nr_dlsch_layer_demapping(llr,
|
||||
dlsch[0].Nl,
|
||||
dlsch[0].dlsch_config.qamModOrder,
|
||||
dlsch0_harq->G,
|
||||
codeword_TB0,
|
||||
codeword_TB1,
|
||||
layer_llr);
|
||||
nr_dlsch_layer_demapping(llr, dlsch[0].Nl, dlsch[0].dlsch_config.qamModOrder, G, codeword_TB0, codeword_TB1, layer_llr);
|
||||
// if (llr[0][0]) abort();
|
||||
for (int i=0; i<NR_MAX_NB_LAYERS; i++)
|
||||
free(layer_llr[i]);
|
||||
|
||||
@@ -210,7 +210,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
|
||||
uint8_t nr_slot_rx,
|
||||
uint8_t harq_pid,
|
||||
int b_size,
|
||||
uint8_t b[b_size]);
|
||||
uint8_t b[b_size],
|
||||
int G);
|
||||
|
||||
int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
|
||||
NR_UE_ULSCH_t *ulsch,
|
||||
@@ -410,7 +411,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
|
||||
int nbRx,
|
||||
int32_t rxdataF_comp[][nbRx][rx_size_symbol * NR_SYMBOLS_PER_SLOT],
|
||||
c16_t ptrs_phase_per_slot[][NR_SYMBOLS_PER_SLOT],
|
||||
int32_t ptrs_re_per_slot[][NR_SYMBOLS_PER_SLOT]);
|
||||
int32_t ptrs_re_per_slot[][NR_SYMBOLS_PER_SLOT],
|
||||
int G);
|
||||
|
||||
int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, int frame, uint8_t slot);
|
||||
|
||||
|
||||
@@ -123,8 +123,6 @@ typedef struct {
|
||||
uint32_t F;
|
||||
/// LDPC lifting factor
|
||||
uint32_t Z;
|
||||
/// Number of soft channel bits
|
||||
uint32_t G;
|
||||
/// codeword this transport block is mapped to
|
||||
uint8_t codeword;
|
||||
/// HARQ-ACKs
|
||||
|
||||
@@ -485,7 +485,8 @@ static int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue,
|
||||
const UE_nr_rxtx_proc_t *proc,
|
||||
NR_UE_DLSCH_t dlsch[2],
|
||||
int16_t *llr[2],
|
||||
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP])
|
||||
c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP],
|
||||
int G)
|
||||
{
|
||||
int frame_rx = proc->frame_rx;
|
||||
int nr_slot_rx = proc->nr_slot_rx;
|
||||
@@ -609,7 +610,8 @@ static int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue,
|
||||
ue->frame_parms.nb_antennas_rx,
|
||||
rxdataF_comp,
|
||||
ptrs_phase_per_slot,
|
||||
ptrs_re_per_slot)
|
||||
ptrs_re_per_slot,
|
||||
G)
|
||||
< 0)
|
||||
return -1;
|
||||
|
||||
@@ -639,7 +641,11 @@ static void send_dl_done_to_tx_thread(notifiedFIFO_t *nf, int rx_slot)
|
||||
}
|
||||
}
|
||||
|
||||
static bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, NR_UE_DLSCH_t dlsch[2], int16_t *llr[2])
|
||||
static bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
|
||||
const UE_nr_rxtx_proc_t *proc,
|
||||
NR_UE_DLSCH_t dlsch[2],
|
||||
int16_t *llr[2],
|
||||
int G)
|
||||
{
|
||||
if (dlsch[0].active == false) {
|
||||
LOG_E(PHY, "DLSCH should be active when calling this function\n");
|
||||
@@ -685,12 +691,7 @@ static bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *
|
||||
}
|
||||
|
||||
start_meas(&ue->dlsch_unscrambling_stats);
|
||||
nr_dlsch_unscrambling(llr[0],
|
||||
dl_harq0->G,
|
||||
0,
|
||||
dlsch[0].dlsch_config.dlDataScramblingId,
|
||||
dlsch[0].rnti);
|
||||
|
||||
nr_dlsch_unscrambling(llr[0], G, 0, dlsch[0].dlsch_config.dlDataScramblingId, dlsch[0].rnti);
|
||||
|
||||
stop_meas(&ue->dlsch_unscrambling_stats);
|
||||
|
||||
@@ -718,7 +719,8 @@ static bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *
|
||||
nr_slot_rx,
|
||||
harq_pid,
|
||||
dlsch_bytes,
|
||||
p_b);
|
||||
p_b,
|
||||
G);
|
||||
|
||||
LOG_T(PHY,"dlsch decoding, ret = %d\n", ret);
|
||||
|
||||
@@ -773,19 +775,10 @@ static bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *
|
||||
int ptrsSymbPerSlot = get_ptrs_symbols_in_slot(ptrsSymbPos, dlsch_config->start_symbol, dlsch_config->number_symbols);
|
||||
unav_res = n_ptrs * ptrsSymbPerSlot;
|
||||
}
|
||||
dl_harq1->G = nr_get_G(dlsch_config->number_rbs,
|
||||
nb_symb_sch,
|
||||
nb_re_dmrs,
|
||||
dmrs_len,
|
||||
unav_res,
|
||||
dlsch_config->qamModOrder,
|
||||
dlsch[1].Nl);
|
||||
int G1 =
|
||||
nr_get_G(dlsch_config->number_rbs, nb_symb_sch, nb_re_dmrs, dmrs_len, unav_res, dlsch_config->qamModOrder, dlsch[1].Nl);
|
||||
start_meas(&ue->dlsch_unscrambling_stats);
|
||||
nr_dlsch_unscrambling(llr[1],
|
||||
dl_harq1->G,
|
||||
0,
|
||||
dlsch[1].dlsch_config.dlDataScramblingId,
|
||||
dlsch[1].rnti);
|
||||
nr_dlsch_unscrambling(llr[1], G1, 0, dlsch[1].dlsch_config.dlDataScramblingId, dlsch[1].rnti);
|
||||
stop_meas(&ue->dlsch_unscrambling_stats);
|
||||
|
||||
start_meas(&ue->dlsch_decoding_stats);
|
||||
@@ -802,7 +795,8 @@ static bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *
|
||||
nr_slot_rx,
|
||||
harq_pid,
|
||||
dlsch_bytes,
|
||||
p_b);
|
||||
p_b,
|
||||
G);
|
||||
LOG_T(PHY,"CW dlsch decoding, ret1 = %d\n", ret1);
|
||||
|
||||
stop_meas(&ue->dlsch_decoding_stats);
|
||||
@@ -1048,15 +1042,14 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_
|
||||
int ptrsSymbPerSlot = get_ptrs_symbols_in_slot(ptrsSymbPos, dlsch_config->start_symbol, dlsch_config->number_symbols);
|
||||
unav_res = n_ptrs * ptrsSymbPerSlot;
|
||||
}
|
||||
NR_DL_UE_HARQ_t *dlsch0_harq = &ue->dl_harq_processes[0][dlsch_config->harq_process_nbr];
|
||||
dlsch0_harq->G = nr_get_G(dlsch_config->number_rbs,
|
||||
dlsch_config->number_symbols,
|
||||
nb_re_dmrs,
|
||||
dmrs_len,
|
||||
unav_res,
|
||||
dlsch_config->qamModOrder,
|
||||
dlsch[0].Nl);
|
||||
const uint32_t rx_llr_buf_sz = ((dlsch0_harq->G + 15) / 16) * 16;
|
||||
int G = nr_get_G(dlsch_config->number_rbs,
|
||||
dlsch_config->number_symbols,
|
||||
nb_re_dmrs,
|
||||
dmrs_len,
|
||||
unav_res,
|
||||
dlsch_config->qamModOrder,
|
||||
dlsch[0].Nl);
|
||||
const uint32_t rx_llr_buf_sz = ((G + 15) / 16) * 16;
|
||||
const uint32_t nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1;
|
||||
int16_t* llr[2];
|
||||
for (int i = 0; i < nb_codewords; i++)
|
||||
@@ -1064,11 +1057,11 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_C, VCD_FUNCTION_IN);
|
||||
// it returns -1 in case of internal failure, or 0 in case of normal result
|
||||
int ret_pdsch = nr_ue_pdsch_procedures(ue, proc, dlsch, llr, rxdataF);
|
||||
int ret_pdsch = nr_ue_pdsch_procedures(ue, proc, dlsch, llr, rxdataF, G);
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_C, VCD_FUNCTION_OUT);
|
||||
|
||||
UEscopeCopy(ue, pdschLlr, llr[0], sizeof(int16_t), 1, dlsch0_harq->G, 0);
|
||||
UEscopeCopy(ue, pdschLlr, llr[0], sizeof(int16_t), 1, G, 0);
|
||||
|
||||
LOG_D(PHY, "DLSCH data reception at nr_slot_rx: %d\n", nr_slot_rx);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN);
|
||||
@@ -1076,7 +1069,7 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_
|
||||
start_meas(&ue->dlsch_procedures_stat);
|
||||
|
||||
if (ret_pdsch >= 0)
|
||||
nr_ue_dlsch_procedures(ue, proc, dlsch, llr);
|
||||
nr_ue_dlsch_procedures(ue, proc, dlsch, llr, G);
|
||||
else {
|
||||
LOG_E(NR_PHY, "Demodulation impossible, internal error\n");
|
||||
send_dl_done_to_tx_thread(
|
||||
|
||||
@@ -472,8 +472,7 @@ int main(int argc, char **argv)
|
||||
//estimated_output = (unsigned char *) malloc16(sizeof(unsigned char) * 16 * 68 * 384);
|
||||
unsigned char estimated_output_bit[16 * 68 * 384];
|
||||
NR_UE_DLSCH_t *dlsch0_ue = &dlsch_ue[0];
|
||||
NR_DL_UE_HARQ_t *harq_process = &UE->dl_harq_processes[0][harq_pid];
|
||||
harq_process->G = available_bits;
|
||||
NR_DL_UE_HARQ_t *harq_process = &UE->dl_harq_processes[0][harq_pid];
|
||||
harq_process->first_rx = 1;
|
||||
dlsch0_ue->dlsch_config.mcs = Imcs;
|
||||
dlsch0_ue->dlsch_config.mcs_table = mcs_table;
|
||||
@@ -563,13 +562,24 @@ int main(int argc, char **argv)
|
||||
}
|
||||
uint32_t dlsch_bytes = a_segments*1056; // allocated bytes per segment
|
||||
__attribute__ ((aligned(32))) uint8_t b[dlsch_bytes];
|
||||
ret = nr_dlsch_decoding(UE, &proc, 0, channel_output_fixed, &UE->frame_parms,
|
||||
dlsch0_ue, harq_process, frame, nb_symb_sch,
|
||||
slot,harq_pid,dlsch_bytes,b);
|
||||
ret = nr_dlsch_decoding(UE,
|
||||
&proc,
|
||||
0,
|
||||
channel_output_fixed,
|
||||
&UE->frame_parms,
|
||||
dlsch0_ue,
|
||||
harq_process,
|
||||
frame,
|
||||
nb_symb_sch,
|
||||
slot,
|
||||
harq_pid,
|
||||
dlsch_bytes,
|
||||
b,
|
||||
available_bits);
|
||||
|
||||
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING0, VCD_FUNCTION_OUT);
|
||||
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DECODING0, VCD_FUNCTION_OUT);
|
||||
|
||||
if (ret > dlsch0_ue->max_ldpc_iterations)
|
||||
if (ret > dlsch0_ue->max_ldpc_iterations)
|
||||
n_errors++;
|
||||
|
||||
//count errors
|
||||
|
||||
Reference in New Issue
Block a user