Commit 3fd45922 authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/NR_PTRS_improvements' into integration_2023_w44

parents 3bede49b 629825ac
...@@ -506,7 +506,6 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB, ...@@ -506,7 +506,6 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
uint16_t *dmrsSymbPos = &rel15_ul->ul_dmrs_symb_pos; uint16_t *dmrsSymbPos = &rel15_ul->ul_dmrs_symb_pos;
uint16_t *ptrsSymbPos = &pusch_vars->ptrs_symbols; uint16_t *ptrsSymbPos = &pusch_vars->ptrs_symbols;
uint8_t *ptrsSymbIdx = &pusch_vars->ptrs_symbol_index; uint8_t *ptrsSymbIdx = &pusch_vars->ptrs_symbol_index;
uint8_t *dmrsConfigType = &rel15_ul->dmrs_config_type;
uint16_t *nb_rb = &rel15_ul->rb_size; uint16_t *nb_rb = &rel15_ul->rb_size;
uint8_t *ptrsReOffset = &rel15_ul->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset; uint8_t *ptrsReOffset = &rel15_ul->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset;
...@@ -548,7 +547,6 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB, ...@@ -548,7 +547,6 @@ void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
/*------------------------------------------------------------------------------------------------------- */ /*------------------------------------------------------------------------------------------------------- */
nr_ptrs_cpe_estimation(*K_ptrs, nr_ptrs_cpe_estimation(*K_ptrs,
*ptrsReOffset, *ptrsReOffset,
*dmrsConfigType,
*nb_rb, *nb_rb,
rel15_ul->rnti, rel15_ul->rnti,
nr_tti_rx, nr_tti_rx,
......
This diff is collapsed.
...@@ -47,18 +47,14 @@ ...@@ -47,18 +47,14 @@
/************** FUNCTION ******************************************/ /************** FUNCTION ******************************************/
int16_t get_kRE_ref(uint8_t dmrs_antenna_port, uint8_t pusch_dmrs_type, uint8_t resourceElementOffset);
void set_ptrs_symb_idx(uint16_t *ptrs_symbols, void set_ptrs_symb_idx(uint16_t *ptrs_symbols,
uint8_t duration_in_symbols, uint8_t duration_in_symbols,
uint8_t start_symbol, uint8_t start_symbol,
uint8_t L_ptrs, uint8_t L_ptrs,
uint16_t ul_dmrs_symb_pos); uint16_t dmrs_symb_pos);
uint8_t is_ptrs_subcarrier(uint16_t k, uint8_t is_ptrs_subcarrier(uint16_t k,
uint16_t n_rnti, uint16_t n_rnti,
uint8_t dmrs_antenna_port,
uint8_t pusch_dmrs_type,
uint8_t K_ptrs, uint8_t K_ptrs,
uint16_t N_RB, uint16_t N_RB,
uint8_t k_RE_ref, uint8_t k_RE_ref,
...@@ -93,7 +89,6 @@ int8_t nr_ptrs_process_slot(uint16_t dmrsSymbPos, ...@@ -93,7 +89,6 @@ int8_t nr_ptrs_process_slot(uint16_t dmrsSymbPos,
/* general function to estimate common phase error based upon PTRS */ /* general function to estimate common phase error based upon PTRS */
void nr_ptrs_cpe_estimation(uint8_t K_ptrs, void nr_ptrs_cpe_estimation(uint8_t K_ptrs,
uint8_t ptrsReOffset, uint8_t ptrsReOffset,
uint8_t dmrsConfigType,
uint16_t nb_rb, uint16_t nb_rb,
uint16_t rnti, uint16_t rnti,
unsigned char Ns, unsigned char Ns,
......
...@@ -109,20 +109,19 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, ...@@ -109,20 +109,19 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
int16_t mod_dmrs[n_dmrs<<1] __attribute__ ((aligned(16))); int16_t mod_dmrs[n_dmrs<<1] __attribute__ ((aligned(16)));
/* PTRS */ /* PTRS */
uint16_t beta_ptrs = 1;
uint8_t ptrs_symbol = 0;
uint16_t dlPtrsSymPos = 0; uint16_t dlPtrsSymPos = 0;
uint16_t n_ptrs = 0; uint16_t n_ptrs = 0;
uint16_t ptrs_idx = 0; uint32_t ptrsSymbPerSlot = 0;
uint8_t is_ptrs_re = 0;
if(rel15->pduBitmap & 0x1) { if(rel15->pduBitmap & 0x1) {
set_ptrs_symb_idx(&dlPtrsSymPos, set_ptrs_symb_idx(&dlPtrsSymPos,
rel15->NrOfSymbols, rel15->NrOfSymbols,
rel15->StartSymbolIndex, rel15->StartSymbolIndex,
1<<rel15->PTRSTimeDensity, 1 << rel15->PTRSTimeDensity,
rel15->dlDmrsSymbPos); rel15->dlDmrsSymbPos);
n_ptrs = (rel15->rbSize + rel15->PTRSFreqDensity - 1)/rel15->PTRSFreqDensity; n_ptrs = (rel15->rbSize + rel15->PTRSFreqDensity - 1) / rel15->PTRSFreqDensity;
ptrsSymbPerSlot = get_ptrs_symbols_in_slot(dlPtrsSymPos, rel15->StartSymbolIndex, rel15->NrOfSymbols);
} }
harq->unav_res = ptrsSymbPerSlot * n_ptrs;
/// CRC, coding, interleaving and rate matching /// CRC, coding, interleaving and rate matching
AssertFatal(harq->pdu!=NULL,"harq->pdu is null\n"); AssertFatal(harq->pdu!=NULL,"harq->pdu is null\n");
...@@ -131,7 +130,15 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, ...@@ -131,7 +130,15 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
start_meas(dlsch_encoding_stats); start_meas(dlsch_encoding_stats);
if (nr_dlsch_encoding(gNB, if (nr_dlsch_encoding(gNB,
frame, slot, harq, frame_parms,output,tinput,tprep,tparity,toutput, frame,
slot,
harq,
frame_parms,
output,
tinput,
tprep,
tparity,
toutput,
dlsch_rate_matching_stats, dlsch_rate_matching_stats,
dlsch_interleaving_stats, dlsch_interleaving_stats,
dlsch_segmentation_stats) == -1) dlsch_segmentation_stats) == -1)
...@@ -300,16 +307,17 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, ...@@ -300,16 +307,17 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
} }
/* calculate if current symbol is PTRS symbols */ /* calculate if current symbol is PTRS symbols */
ptrs_idx = 0; uint16_t ptrs_idx = 0;
int16_t *mod_ptrs = NULL; int16_t *mod_ptrs = NULL;
uint8_t ptrs_symbol = 0;
if(rel15->pduBitmap & 0x1) { if(rel15->pduBitmap & 0x1) {
ptrs_symbol = is_ptrs_symbol(l,dlPtrsSymPos); ptrs_symbol = is_ptrs_symbol(l, dlPtrsSymPos);
if(ptrs_symbol) { if(ptrs_symbol) {
/* PTRS QPSK Modulation for each OFDM symbol in a slot */ /* PTRS QPSK Modulation for each OFDM symbol in a slot */
LOG_D(PHY,"Doing ptrs modulation for symbol %d, n_ptrs %d\n",l,n_ptrs); LOG_D(PHY,"Doing ptrs modulation for symbol %d, n_ptrs %d\n", l, n_ptrs);
int16_t mod_ptrsBuf[n_ptrs<<1] __attribute__ ((aligned(16))); int16_t mod_ptrsBuf[n_ptrs<<1] __attribute__ ((aligned(16)));
mod_ptrs =mod_ptrsBuf; mod_ptrs = mod_ptrsBuf;
nr_modulation(pdsch_dmrs[l][rel15->SCID], (n_ptrs<<1), DMRS_MOD_ORDER, mod_ptrs); nr_modulation(pdsch_dmrs[l][rel15->SCID], (n_ptrs << 1), DMRS_MOD_ORDER, mod_ptrs);
} }
} }
uint16_t k = start_sc; uint16_t k = start_sc;
...@@ -318,13 +326,11 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, ...@@ -318,13 +326,11 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
// Loop Over SCs: // Loop Over SCs:
for (int i=0; i<rel15->rbSize*NR_NB_SC_PER_RB; i++) { for (int i=0; i<rel15->rbSize*NR_NB_SC_PER_RB; i++) {
/* check if cuurent RE is PTRS RE*/ /* check if cuurent RE is PTRS RE*/
is_ptrs_re = 0; uint8_t is_ptrs_re = 0;
/* check for PTRS symbol and set flag for PTRS RE */ /* check for PTRS symbol and set flag for PTRS RE */
if(ptrs_symbol){ if(ptrs_symbol){
is_ptrs_re = is_ptrs_subcarrier(k, is_ptrs_re = is_ptrs_subcarrier(k,
rel15->rnti, rel15->rnti,
nl,
rel15->dmrsConfigType,
rel15->PTRSFreqDensity, rel15->PTRSFreqDensity,
rel15->rbSize, rel15->rbSize,
rel15->PTRSReOffset, rel15->PTRSReOffset,
...@@ -348,6 +354,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, ...@@ -348,6 +354,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
} }
/* Map PTRS Symbol */ /* Map PTRS Symbol */
else if(is_ptrs_re){ else if(is_ptrs_re){
uint16_t beta_ptrs = 1;
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = (beta_ptrs*amp*mod_ptrs[ptrs_idx<<1]) >> 15; txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) ] = (beta_ptrs*amp*mod_ptrs[ptrs_idx<<1]) >> 15;
txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (beta_ptrs*amp*mod_ptrs[(ptrs_idx<<1) + 1])>> 15; txdataF_precoding[nl][((l*frame_parms->ofdm_symbol_size + k)<<1) + 1] = (beta_ptrs*amp*mod_ptrs[(ptrs_idx<<1) + 1])>> 15;
#ifdef DEBUG_DLSCH_MAPPING #ifdef DEBUG_DLSCH_MAPPING
......
...@@ -159,10 +159,11 @@ void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch) { ...@@ -159,10 +159,11 @@ void clean_gNB_dlsch(NR_gNB_DLSCH_t *dlsch) {
dlsch->active = 0; dlsch->active = 0;
} }
void ldpc8blocks( void *p) { void ldpc8blocks(void *p)
{
encoder_implemparams_t *impp=(encoder_implemparams_t *) p; encoder_implemparams_t *impp=(encoder_implemparams_t *) p;
NR_DL_gNB_HARQ_t *harq = (NR_DL_gNB_HARQ_t *)impp->harq; NR_DL_gNB_HARQ_t *harq = (NR_DL_gNB_HARQ_t *)impp->harq;
uint16_t Kr= impp->K; uint16_t Kr = impp->K;
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &harq->pdsch_pdu.pdsch_pdu_rel15; nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &harq->pdsch_pdu.pdsch_pdu_rel15;
uint8_t mod_order = rel15->qamModOrder[0]; uint8_t mod_order = rel15->qamModOrder[0];
uint16_t nb_rb = rel15->rbSize; uint16_t nb_rb = rel15->rbSize;
...@@ -176,7 +177,7 @@ void ldpc8blocks( void *p) { ...@@ -176,7 +177,7 @@ void ldpc8blocks( void *p) {
else else
nb_re_dmrs = 4*rel15->numDmrsCdmGrpsNoData; nb_re_dmrs = 4*rel15->numDmrsCdmGrpsNoData;
unsigned int G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs,mod_order,rel15->nrOfLayers); unsigned int G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, harq->unav_res, mod_order, rel15->nrOfLayers);
LOG_D(PHY,"dlsch coding A %d Kr %d G %d (nb_rb %d, nb_symb_sch %d, nb_re_dmrs %d, length_dmrs %d, mod_order %d)\n", LOG_D(PHY,"dlsch coding A %d Kr %d G %d (nb_rb %d, nb_symb_sch %d, nb_re_dmrs %d, length_dmrs %d, mod_order %d)\n",
A,impp->K,G, nb_rb,nb_symb_sch,nb_re_dmrs,length_dmrs,(int)mod_order); A,impp->K,G, nb_rb,nb_symb_sch,nb_re_dmrs,length_dmrs,(int)mod_order);
// nrLDPC_encoder output is in "d" // nrLDPC_encoder output is in "d"
......
...@@ -34,10 +34,17 @@ ...@@ -34,10 +34,17 @@
#include "PHY/CODING/coding_defs.h" #include "PHY/CODING/coding_defs.h"
#include "PHY/defs_nr_common.h" #include "PHY/defs_nr_common.h"
uint32_t nr_get_G(uint16_t nb_rb, uint16_t nb_symb_sch,uint8_t nb_re_dmrs,uint16_t length_dmrs, uint8_t Qm, uint8_t Nl) { uint32_t nr_get_G(uint16_t nb_rb,
uint32_t G; uint16_t nb_symb_sch,
G = ((NR_NB_SC_PER_RB*nb_symb_sch)-(nb_re_dmrs*length_dmrs))*nb_rb*Qm*Nl; uint8_t nb_re_dmrs,
return(G); uint16_t length_dmrs,
uint32_t unav_res,
uint8_t Qm,
uint8_t Nl)
{
uint32_t G = ((NR_NB_SC_PER_RB * nb_symb_sch) - (nb_re_dmrs * length_dmrs)) * nb_rb * Qm * Nl;
G -= unav_res * Qm * Nl;
return(G);
} }
uint32_t nr_get_E(uint32_t G, uint8_t C, uint8_t Qm, uint8_t Nl, uint8_t r) { uint32_t nr_get_E(uint32_t G, uint8_t C, uint8_t Qm, uint8_t Nl, uint8_t r) {
......
...@@ -55,7 +55,13 @@ double nr_cyclic_shift_hopping(uint32_t n_id, ...@@ -55,7 +55,13 @@ double nr_cyclic_shift_hopping(uint32_t n_id,
int nr_slot_tx); int nr_slot_tx);
/** \brief Computes available bits G. */ /** \brief Computes available bits G. */
uint32_t nr_get_G(uint16_t nb_rb, uint16_t nb_symb_sch, uint8_t nb_re_dmrs, uint16_t length_dmrs, uint8_t Qm, uint8_t Nl); uint32_t nr_get_G(uint16_t nb_rb,
uint16_t nb_symb_sch,
uint8_t nb_re_dmrs,
uint16_t length_dmrs,
uint32_t unav_res,
uint8_t Qm,
uint8_t Nl);
uint32_t nr_get_E(uint32_t G, uint8_t C, uint8_t Qm, uint8_t Nl, uint8_t r); uint32_t nr_get_E(uint32_t G, uint8_t C, uint8_t Qm, uint8_t Nl, uint8_t r);
......
...@@ -1258,20 +1258,20 @@ static uint8_t nr_ulsch_mmse_2layers(NR_DL_FRAME_PARMS *frame_parms, ...@@ -1258,20 +1258,20 @@ static uint8_t nr_ulsch_mmse_2layers(NR_DL_FRAME_PARMS *frame_parms,
return(0); return(0);
} }
static void inner_rx (PHY_VARS_gNB *gNB, static void inner_rx(PHY_VARS_gNB *gNB,
int ulsch_id, int ulsch_id,
int slot, int slot,
NR_DL_FRAME_PARMS *frame_parms, NR_DL_FRAME_PARMS *frame_parms,
NR_gNB_PUSCH *pusch_vars, NR_gNB_PUSCH *pusch_vars,
nfapi_nr_pusch_pdu_t *rel15_ul, nfapi_nr_pusch_pdu_t *rel15_ul,
c16_t **rxF, c16_t **rxF,
c16_t **ul_ch, c16_t **ul_ch,
int16_t **llr, int16_t **llr,
int soffset, int soffset,
int length, int length,
int symbol, int symbol,
int output_shift, int output_shift,
uint32_t nvar) uint32_t nvar)
{ {
int nb_layer = rel15_ul->nrOfLayers; int nb_layer = rel15_ul->nrOfLayers;
int nb_rx_ant = frame_parms->nb_antennas_rx; int nb_rx_ant = frame_parms->nb_antennas_rx;
...@@ -1457,7 +1457,7 @@ int nr_rx_pusch_tp(PHY_VARS_gNB *gNB, ...@@ -1457,7 +1457,7 @@ int nr_rx_pusch_tp(PHY_VARS_gNB *gNB,
NR_gNB_PUSCH *pusch_vars = &gNB->pusch_vars[ulsch_id]; NR_gNB_PUSCH *pusch_vars = &gNB->pusch_vars[ulsch_id];
pusch_vars->dmrs_symbol = INVALID_VALUE; pusch_vars->dmrs_symbol = INVALID_VALUE;
gNB->nbSymb=0; gNB->nbSymb = 0;
bwp_start_subcarrier = ((rel15_ul->rb_start + rel15_ul->bwp_start)*NR_NB_SC_PER_RB + frame_parms->first_carrier_offset) % frame_parms->ofdm_symbol_size; bwp_start_subcarrier = ((rel15_ul->rb_start + rel15_ul->bwp_start)*NR_NB_SC_PER_RB + frame_parms->first_carrier_offset) % frame_parms->ofdm_symbol_size;
LOG_D(PHY,"pusch %d.%d : bwp_start_subcarrier %d, rb_start %d, first_carrier_offset %d\n", frame,slot,bwp_start_subcarrier, rel15_ul->rb_start, frame_parms->first_carrier_offset); LOG_D(PHY,"pusch %d.%d : bwp_start_subcarrier %d, rb_start %d, first_carrier_offset %d\n", frame,slot,bwp_start_subcarrier, rel15_ul->rb_start, frame_parms->first_carrier_offset);
LOG_D(PHY,"pusch %d.%d : ul_dmrs_symb_pos %x\n",frame,slot,rel15_ul->ul_dmrs_symb_pos); LOG_D(PHY,"pusch %d.%d : ul_dmrs_symb_pos %x\n",frame,slot,rel15_ul->ul_dmrs_symb_pos);
...@@ -1550,13 +1550,29 @@ int nr_rx_pusch_tp(PHY_VARS_gNB *gNB, ...@@ -1550,13 +1550,29 @@ int nr_rx_pusch_tp(PHY_VARS_gNB *gNB,
else else
nb_re_dmrs = 4*rel15_ul->num_dmrs_cdm_grps_no_data; nb_re_dmrs = 4*rel15_ul->num_dmrs_cdm_grps_no_data;
uint32_t unav_res = 0;
if (rel15_ul->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) {
uint16_t ptrsSymbPos = 0;
set_ptrs_symb_idx(&ptrsSymbPos,
rel15_ul->nr_of_symbols,
rel15_ul->start_symbol_index,
1 << rel15_ul->pusch_ptrs.ptrs_time_density,
rel15_ul->ul_dmrs_symb_pos);
int ptrsSymbPerSlot = get_ptrs_symbols_in_slot(ptrsSymbPos, rel15_ul->start_symbol_index, rel15_ul->nr_of_symbols);
int n_ptrs = (rel15_ul->rb_size + rel15_ul->pusch_ptrs.ptrs_freq_density - 1) / rel15_ul->pusch_ptrs.ptrs_freq_density;
unav_res = n_ptrs * ptrsSymbPerSlot;
}
// get how many bit in a slot // // get how many bit in a slot //
int G = nr_get_G(rel15_ul->rb_size, int G = nr_get_G(rel15_ul->rb_size,
rel15_ul->nr_of_symbols, rel15_ul->nr_of_symbols,
nb_re_dmrs, nb_re_dmrs,
number_dmrs_symbols, // number of dmrs symbols irrespective of single or double symbol dmrs number_dmrs_symbols, // number of dmrs symbols irrespective of single or double symbol dmrs
unav_res,
rel15_ul->qam_mod_order, rel15_ul->qam_mod_order,
rel15_ul->nrOfLayers); rel15_ul->nrOfLayers);
gNB->ulsch[ulsch_id].unav_res = unav_res;
// initialize scrambling sequence // // initialize scrambling sequence //
int16_t s[G+96] __attribute__((aligned(32))); int16_t s[G+96] __attribute__((aligned(32)));
......
...@@ -1777,7 +1777,6 @@ void nr_pdsch_ptrs_processing(PHY_VARS_NR_UE *ue, ...@@ -1777,7 +1777,6 @@ void nr_pdsch_ptrs_processing(PHY_VARS_NR_UE *ue,
uint16_t *ptrsSymbPos = NULL; uint16_t *ptrsSymbPos = NULL;
uint8_t *ptrsSymbIdx = NULL; uint8_t *ptrsSymbIdx = NULL;
uint8_t *ptrsReOffset = NULL; uint8_t *ptrsReOffset = NULL;
uint8_t *dmrsConfigType = NULL;
uint16_t *nb_rb = NULL; uint16_t *nb_rb = NULL;
int nscid = 0; int nscid = 0;
...@@ -1789,7 +1788,6 @@ void nr_pdsch_ptrs_processing(PHY_VARS_NR_UE *ue, ...@@ -1789,7 +1788,6 @@ void nr_pdsch_ptrs_processing(PHY_VARS_NR_UE *ue,
K_ptrs = &dlsch[0].dlsch_config.PTRSFreqDensity; K_ptrs = &dlsch[0].dlsch_config.PTRSFreqDensity;
dmrsSymbPos = &dlsch[0].dlsch_config.dlDmrsSymbPos; dmrsSymbPos = &dlsch[0].dlsch_config.dlDmrsSymbPos;
ptrsReOffset = &dlsch[0].dlsch_config.PTRSReOffset; ptrsReOffset = &dlsch[0].dlsch_config.PTRSReOffset;
dmrsConfigType = &dlsch[0].dlsch_config.dmrsConfigType;
nb_rb = &dlsch[0].dlsch_config.number_rbs; nb_rb = &dlsch[0].dlsch_config.number_rbs;
ptrsSymbPos = &dlsch[0].ptrs_symbols; ptrsSymbPos = &dlsch[0].ptrs_symbols;
ptrsSymbIdx = &dlsch[0].ptrs_symbol_index; ptrsSymbIdx = &dlsch[0].ptrs_symbol_index;
...@@ -1803,7 +1801,6 @@ void nr_pdsch_ptrs_processing(PHY_VARS_NR_UE *ue, ...@@ -1803,7 +1801,6 @@ void nr_pdsch_ptrs_processing(PHY_VARS_NR_UE *ue,
K_ptrs = &dlsch[1].dlsch_config.PTRSFreqDensity; K_ptrs = &dlsch[1].dlsch_config.PTRSFreqDensity;
dmrsSymbPos = &dlsch[1].dlsch_config.dlDmrsSymbPos; dmrsSymbPos = &dlsch[1].dlsch_config.dlDmrsSymbPos;
ptrsReOffset = &dlsch[1].dlsch_config.PTRSReOffset; ptrsReOffset = &dlsch[1].dlsch_config.PTRSReOffset;
dmrsConfigType = &dlsch[1].dlsch_config.dmrsConfigType;
nb_rb = &dlsch[1].dlsch_config.number_rbs; nb_rb = &dlsch[1].dlsch_config.number_rbs;
ptrsSymbPos = &dlsch[1].ptrs_symbols; ptrsSymbPos = &dlsch[1].ptrs_symbols;
ptrsSymbIdx = &dlsch[1].ptrs_symbol_index; ptrsSymbIdx = &dlsch[1].ptrs_symbol_index;
...@@ -1844,7 +1841,9 @@ void nr_pdsch_ptrs_processing(PHY_VARS_NR_UE *ue, ...@@ -1844,7 +1841,9 @@ void nr_pdsch_ptrs_processing(PHY_VARS_NR_UE *ue,
/*------------------------------------------------------------------------------------------------------- */ /*------------------------------------------------------------------------------------------------------- */
/* 1) Estimate common phase error per PTRS symbol */ /* 1) Estimate common phase error per PTRS symbol */
/*------------------------------------------------------------------------------------------------------- */ /*------------------------------------------------------------------------------------------------------- */
nr_ptrs_cpe_estimation(*K_ptrs,*ptrsReOffset,*dmrsConfigType,*nb_rb, nr_ptrs_cpe_estimation(*K_ptrs,
*ptrsReOffset,
*nb_rb,
rnti, rnti,
nr_slot_rx, nr_slot_rx,
symbol, symbol,
......
...@@ -276,9 +276,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -276,9 +276,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
uint8_t nr_slot_rx, uint8_t nr_slot_rx,
uint8_t harq_pid, uint8_t harq_pid,
int b_size, int b_size,
uint8_t b[b_size]) { uint8_t b[b_size])
uint32_t E; {
uint32_t G;
uint32_t ret,offset; uint32_t ret,offset;
uint32_t r,r_offset=0,Kr=8424,Kr_bytes; uint32_t r,r_offset=0,Kr=8424,Kr_bytes;
t_nrLDPC_dec_params decParams; t_nrLDPC_dec_params decParams;
...@@ -342,8 +341,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -342,8 +341,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
uint32_t A = dlsch->dlsch_config.TBS; uint32_t A = dlsch->dlsch_config.TBS;
ret = dlsch->max_ldpc_iterations + 1; ret = dlsch->max_ldpc_iterations + 1;
dlsch->last_iteration_cnt = ret; dlsch->last_iteration_cnt = ret;
harq_process->G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, dmrs_length, dlsch->dlsch_config.qamModOrder,dlsch->Nl); uint32_t G = harq_process->G;
G = harq_process->G;
// target_code_rate is in 0.1 units // target_code_rate is in 0.1 units
float Coderate = (float) dlsch->dlsch_config.targetCodeRate / 10240.0f; float Coderate = (float) dlsch->dlsch_config.targetCodeRate / 10240.0f;
...@@ -406,7 +404,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -406,7 +404,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
set_abort(&harq_process->abort_decode, false); set_abort(&harq_process->abort_decode, false);
for (r=0; r<harq_process->C; r++) { for (r=0; r<harq_process->C; r++) {
//printf("start rx segment %d\n",r); //printf("start rx segment %d\n",r);
E = nr_get_E(G, harq_process->C, dlsch->dlsch_config.qamModOrder, dlsch->Nl, r); uint32_t E = nr_get_E(G, harq_process->C, dlsch->dlsch_config.qamModOrder, dlsch->Nl, r);
decParams.R = nr_get_R_ldpc_decoder(dlsch->dlsch_config.rv, E, decParams.BG, decParams.Z, &harq_process->llrLen, harq_process->DLround); decParams.R = nr_get_R_ldpc_decoder(dlsch->dlsch_config.rv, E, decParams.BG, decParams.Z, &harq_process->llrLen, harq_process->DLround);
union ldpcReqUnion id = {.s={dlsch->rnti,frame,nr_slot_rx,0,0}}; union ldpcReqUnion id = {.s={dlsch->rnti,frame,nr_slot_rx,0,0}};
notifiedFIFO_elt_t *req = newNotifiedFIFO_elt(sizeof(ldpcDecode_ue_t), id.p, &nf, &nr_processDLSegment); notifiedFIFO_elt_t *req = newNotifiedFIFO_elt(sizeof(ldpcDecode_ue_t), id.p, &nf, &nr_processDLSegment);
......
...@@ -602,37 +602,21 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, ...@@ -602,37 +602,21 @@ 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); 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]; dl_valid_re[symbol-1] -= ptrs_re_per_slot[0][symbol];
} }
/* at last symbol in a slot calculate LLR's for whole slot */ /* at last symbol in a slot calculate LLR's for whole slot */
if(symbol == (startSymbIdx + nbSymb -1)) { if(symbol == (startSymbIdx + nbSymb -1)) {
uint8_t nb_re_dmrs;
if (dlsch[0].dlsch_config.dmrsConfigType == NFAPI_NR_DMRS_TYPE1) {
nb_re_dmrs = 6*dlsch[0].dlsch_config.n_dmrs_cdm_groups;
}
else {
nb_re_dmrs = 4*dlsch[0].dlsch_config.n_dmrs_cdm_groups;
}
uint16_t dmrs_len = get_num_dmrs(dlsch[0].dlsch_config.dlDmrsSymbPos);
const uint32_t rx_llr_size = nr_get_G(dlsch[0].dlsch_config.number_rbs, const uint32_t rx_llr_layer_size = (dlsch0_harq->G + dlsch[0].Nl - 1) / dlsch[0].Nl;
dlsch[0].dlsch_config.number_symbols,
nb_re_dmrs,
dmrs_len,
dlsch[0].dlsch_config.qamModOrder,
dlsch[0].Nl);
const uint32_t rx_llr_layer_size = (rx_llr_size + dlsch[0].Nl - 1) / dlsch[0].Nl;
int16_t* layer_llr[NR_MAX_NB_LAYERS]; int16_t* layer_llr[NR_MAX_NB_LAYERS];
for (int i=0; i<NR_MAX_NB_LAYERS; i++) for (int i = 0; i < NR_MAX_NB_LAYERS; i++)
layer_llr[i] = (int16_t *)malloc16_clear(rx_llr_layer_size*sizeof(int16_t)); layer_llr[i] = (int16_t *)malloc16_clear(rx_llr_layer_size * sizeof(int16_t));
for(uint8_t i =startSymbIdx; i < (startSymbIdx+nbSymb);i++) { for(uint8_t i = startSymbIdx; i < (startSymbIdx+nbSymb); i++) {
/* re evaluating the first symbol flag as LLR's are done in symbol loop */ /* re evaluating the first symbol flag as LLR's are done in symbol loop */
if(i == startSymbIdx && i < 3) { if(i == startSymbIdx && i < 3)
first_symbol_flag =1; first_symbol_flag = 1;
} else
else { first_symbol_flag = 0;
first_symbol_flag=0;
}
/* Calculate LLR's for each symbol */ /* Calculate LLR's for each symbol */
nr_dlsch_llr(rx_size_symbol, nr_dlsch_llr(rx_size_symbol,
nbRx, nbRx,
...@@ -655,13 +639,6 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, ...@@ -655,13 +639,6 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
dlsch, dlsch,
llr_offset); llr_offset);
} }
dlsch0_harq->G = nr_get_G(dlsch[0].dlsch_config.number_rbs,
dlsch[0].dlsch_config.number_symbols,
nb_re_dmrs,
dmrs_len,
dlsch[0].dlsch_config.qamModOrder,
dlsch[0].Nl);
nr_dlsch_layer_demapping(llr, nr_dlsch_layer_demapping(llr,
dlsch[0].Nl, dlsch[0].Nl,
...@@ -1156,17 +1133,13 @@ void nr_dlsch_scale_channel(uint32_t rx_size_symbol, ...@@ -1156,17 +1133,13 @@ void nr_dlsch_scale_channel(uint32_t rx_size_symbol,
//compute average channel_level on each (TX,RX) antenna pair //compute average channel_level on each (TX,RX) antenna pair
void nr_dlsch_channel_level(uint32_t rx_size_symbol, void nr_dlsch_channel_level(uint32_t rx_size_symbol,
int32_t dl_ch_estimates_ext[][rx_size_symbol], int32_t dl_ch_estimates_ext[][rx_size_symbol],
NR_DL_FRAME_PARMS *frame_parms, NR_DL_FRAME_PARMS *frame_parms,
uint8_t n_tx, uint8_t n_tx,
int32_t *avg, int32_t *avg,
uint8_t symbol, uint8_t symbol,
uint32_t len, uint32_t len,
unsigned short nb_rb) unsigned short nb_rb)
{ {
short rb;
unsigned char aatx,aarx;
simde__m128i *dl_ch128, avg128D; simde__m128i *dl_ch128, avg128D;
//nb_rb*nre = y * 2^x //nb_rb*nre = y * 2^x
...@@ -1178,14 +1151,14 @@ void nr_dlsch_channel_level(uint32_t rx_size_symbol, ...@@ -1178,14 +1151,14 @@ void nr_dlsch_channel_level(uint32_t rx_size_symbol,
AssertFatal(y!=0,"Cannot divide by zero: in function %s of file %s\n", __func__, __FILE__); AssertFatal(y!=0,"Cannot divide by zero: in function %s of file %s\n", __func__, __FILE__);
for (aatx=0; aatx<n_tx; aatx++) for (int aatx = 0; aatx < n_tx; aatx++) {
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { for (int aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) {
//clear average level //clear average level
avg128D = simde_mm_setzero_si128(); avg128D = simde_mm_setzero_si128();
dl_ch128=(simde__m128i *)dl_ch_estimates_ext[(aatx*frame_parms->nb_antennas_rx)+aarx]; dl_ch128 = (simde__m128i *)dl_ch_estimates_ext[(aatx * frame_parms->nb_antennas_rx) + aarx];
for (rb=0;rb<nb_rb_0;rb++) { for (int rb = 0; rb < nb_rb_0; rb++) {
avg128D = simde_mm_add_epi32(avg128D,simde_mm_srai_epi32(simde_mm_madd_epi16(dl_ch128[0],dl_ch128[0]),x)); avg128D = simde_mm_add_epi32(avg128D,simde_mm_srai_epi32(simde_mm_madd_epi16(dl_ch128[0],dl_ch128[0]),x));
avg128D = simde_mm_add_epi32(avg128D,simde_mm_srai_epi32(simde_mm_madd_epi16(dl_ch128[1],dl_ch128[1]),x)); avg128D = simde_mm_add_epi32(avg128D,simde_mm_srai_epi32(simde_mm_madd_epi16(dl_ch128[1],dl_ch128[1]),x));
avg128D = simde_mm_add_epi32(avg128D,simde_mm_srai_epi32(simde_mm_madd_epi16(dl_ch128[2],dl_ch128[2]),x)); avg128D = simde_mm_add_epi32(avg128D,simde_mm_srai_epi32(simde_mm_madd_epi16(dl_ch128[2],dl_ch128[2]),x));
...@@ -1195,10 +1168,10 @@ void nr_dlsch_channel_level(uint32_t rx_size_symbol, ...@@ -1195,10 +1168,10 @@ void nr_dlsch_channel_level(uint32_t rx_size_symbol,
avg[(aatx*frame_parms->nb_antennas_rx)+aarx] =(((int32_t*)&avg128D)[0] + avg[(aatx*frame_parms->nb_antennas_rx)+aarx] =(((int32_t*)&avg128D)[0] +
((int32_t*)&avg128D)[1] + ((int32_t*)&avg128D)[1] +
((int32_t*)&avg128D)[2] + ((int32_t*)&avg128D)[2] +
((int32_t*)&avg128D)[3])/y; ((int32_t*)&avg128D)[3])/y;
// printf("Channel level : %d\n",avg[(aatx<<1)+aarx]); // printf("Channel level : %d\n",avg[(aatx<<1)+aarx]);
} }
}
simde_mm_empty(); simde_mm_empty();
simde_m_empty(); simde_m_empty();
} }
......
...@@ -162,12 +162,43 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -162,12 +162,43 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
N_RE_prime = NR_NB_SC_PER_RB*number_of_symbols - nb_dmrs_re_per_rb*number_dmrs_symbols - N_PRB_oh; N_RE_prime = NR_NB_SC_PER_RB*number_of_symbols - nb_dmrs_re_per_rb*number_dmrs_symbols - N_PRB_oh;
harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*nb_rb; harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*nb_rb;
/////////////////////////PTRS parameters' initialization/////////////////////////
///////////
uint8_t L_ptrs, K_ptrs = 0;
uint32_t unav_res = 0;
if (pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) {
K_ptrs = pusch_pdu->pusch_ptrs.ptrs_freq_density;
L_ptrs = 1 << pusch_pdu->pusch_ptrs.ptrs_time_density;
ulsch_ue->ptrs_symbols = 0;
set_ptrs_symb_idx(&ulsch_ue->ptrs_symbols,
number_of_symbols,
start_symbol,
L_ptrs,
ul_dmrs_symb_pos);
int n_ptrs = (nb_rb + K_ptrs - 1) / K_ptrs;
int ptrsSymbPerSlot = get_ptrs_symbols_in_slot(ulsch_ue->ptrs_symbols,
start_symbol,
number_of_symbols);
unav_res = n_ptrs * ptrsSymbPerSlot;
}
///////////
////////////////////////////////////////////////////////////////////
/////////////////////////ULSCH coding///////////////////////// /////////////////////////ULSCH coding/////////////////////////
/////////// ///////////
unsigned int G = nr_get_G(nb_rb, number_of_symbols, unsigned int G = nr_get_G(nb_rb,
nb_dmrs_re_per_rb, number_dmrs_symbols, mod_order, Nl); number_of_symbols,
nb_dmrs_re_per_rb,
number_dmrs_symbols,
unav_res,
mod_order,
Nl);
trace_NRpdu(DIRECTION_UPLINK, trace_NRpdu(DIRECTION_UPLINK,
harq_process_ul_ue->a, harq_process_ul_ue->a,
...@@ -177,7 +208,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -177,7 +208,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
if (nr_ulsch_encoding(UE, ulsch_ue, frame_parms, harq_pid, tb_size, G) == -1) if (nr_ulsch_encoding(UE, ulsch_ue, frame_parms, harq_pid, tb_size, G) == -1)
return; return;
/////////// ///////////
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
...@@ -230,32 +260,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -230,32 +260,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
/////////////////////////PTRS parameters' initialization/////////////////////////
///////////
int16_t mod_ptrs[nb_rb] __attribute((aligned(16))); // assume maximum number of PTRS per pusch allocation
uint8_t L_ptrs, K_ptrs = 0;
uint16_t beta_ptrs = 1; // temp value until power control is implemented
if (pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) {
K_ptrs = pusch_pdu->pusch_ptrs.ptrs_freq_density;
L_ptrs = 1<<pusch_pdu->pusch_ptrs.ptrs_time_density;
beta_ptrs = 1; // temp value until power control is implemented
ulsch_ue->ptrs_symbols = 0;
set_ptrs_symb_idx(&ulsch_ue->ptrs_symbols,
number_of_symbols,
start_symbol,
L_ptrs,
ul_dmrs_symb_pos);
}
///////////
////////////////////////////////////////////////////////////////////////////////
/////////////////////////ULSCH layer mapping///////////////////////// /////////////////////////ULSCH layer mapping/////////////////////////
/////////// ///////////
...@@ -377,6 +381,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -377,6 +381,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
uint8_t is_ptrs_sym = 0; uint8_t is_ptrs_sym = 0;
uint16_t dmrs_idx = 0, ptrs_idx = 0; uint16_t dmrs_idx = 0, ptrs_idx = 0;
int16_t mod_ptrs[nb_rb] __attribute((aligned(16))); // assume maximum number of PTRS per pusch allocation
if ((ul_dmrs_symb_pos >> l) & 0x01) { if ((ul_dmrs_symb_pos >> l) & 0x01) {
is_dmrs_sym = 1; is_dmrs_sym = 1;
...@@ -416,8 +422,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -416,8 +422,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
} else if (is_ptrs_sym) { } else if (is_ptrs_sym) {
is_ptrs = is_ptrs_subcarrier(k, is_ptrs = is_ptrs_subcarrier(k,
rnti, rnti,
nl,
dmrs_type,
K_ptrs, K_ptrs,
nb_rb, nb_rb,
pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset, pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset,
...@@ -447,6 +451,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -447,6 +451,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
n+=(k_prime)?0:1; n+=(k_prime)?0:1;
} else if (is_ptrs == 1) { } else if (is_ptrs == 1) {
uint16_t beta_ptrs = 1; // temp value until power control is implemented
((int16_t*)tx_precoding[nl])[(sample_offsetF)<<1] = (beta_ptrs*AMP*mod_ptrs[ptrs_idx<<1]) >> 15; ((int16_t*)tx_precoding[nl])[(sample_offsetF)<<1] = (beta_ptrs*AMP*mod_ptrs[ptrs_idx<<1]) >> 15;
((int16_t*)tx_precoding[nl])[((sample_offsetF)<<1) + 1] = (beta_ptrs*AMP*mod_ptrs[(ptrs_idx<<1) + 1]) >> 15; ((int16_t*)tx_precoding[nl])[((sample_offsetF)<<1) + 1] = (beta_ptrs*AMP*mod_ptrs[(ptrs_idx<<1) + 1]) >> 15;
ptrs_idx++; ptrs_idx++;
......
...@@ -87,6 +87,8 @@ typedef struct { ...@@ -87,6 +87,8 @@ typedef struct {
uint8_t *f; uint8_t *f;
/// LDPC lifting size /// LDPC lifting size
uint32_t Z; uint32_t Z;
/// REs unavailable for DLSCH (overlapping with PTRS, CSIRS etc.)
uint32_t unav_res;
} NR_DL_gNB_HARQ_t; } NR_DL_gNB_HARQ_t;
typedef struct { typedef struct {
...@@ -262,6 +264,7 @@ typedef struct { ...@@ -262,6 +264,7 @@ typedef struct {
typedef struct { typedef struct {
uint32_t frame; uint32_t frame;
uint32_t slot; uint32_t slot;
uint32_t unav_res;
/// Pointers to 16 HARQ processes for the ULSCH /// Pointers to 16 HARQ processes for the ULSCH
NR_UL_gNB_HARQ_t *harq_process; NR_UL_gNB_HARQ_t *harq_process;
/// HARQ process mask, indicates which processes are currently active /// HARQ process mask, indicates which processes are currently active
......
...@@ -374,6 +374,7 @@ static int nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ...@@ -374,6 +374,7 @@ static int nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int
number_symbols, number_symbols,
nb_re_dmrs, nb_re_dmrs,
number_dmrs_symbols, // number of dmrs symbols irrespective of single or double symbol dmrs number_dmrs_symbols, // number of dmrs symbols irrespective of single or double symbol dmrs
gNB->ulsch[ULSCH_id].unav_res,
pusch_pdu->qam_mod_order, pusch_pdu->qam_mod_order,
pusch_pdu->nrOfLayers); pusch_pdu->nrOfLayers);
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "PHY/phy_extern_nr_ue.h" #include "PHY/phy_extern_nr_ue.h"
#include "PHY/MODULATION/modulation_UE.h" #include "PHY/MODULATION/modulation_UE.h"
#include "PHY/INIT/nr_phy_init.h" #include "PHY/INIT/nr_phy_init.h"
#include "PHY/NR_REFSIG/ptrs_nr.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
#include "PHY/NR_UE_TRANSPORT/srs_modulation_nr.h" #include "PHY/NR_UE_TRANSPORT/srs_modulation_nr.h"
...@@ -491,8 +492,8 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, ...@@ -491,8 +492,8 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc, UE_nr_rxtx_proc_t *proc,
NR_UE_DLSCH_t dlsch[2], NR_UE_DLSCH_t dlsch[2],
int16_t *llr[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 frame_rx = proc->frame_rx; int frame_rx = proc->frame_rx;
int nr_slot_rx = proc->nr_slot_rx; int nr_slot_rx = proc->nr_slot_rx;
int m; int m;
...@@ -692,14 +693,6 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, ...@@ -692,14 +693,6 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
return false; return false;
} }
// start ldpc decode for CW 0
dl_harq0->G = nr_get_G(dlsch[0].dlsch_config.number_rbs,
nb_symb_sch,
nb_re_dmrs,
dmrs_len,
dlsch[0].dlsch_config.qamModOrder,
dlsch[0].Nl);
start_meas(&ue->dlsch_unscrambling_stats); start_meas(&ue->dlsch_unscrambling_stats);
nr_dlsch_unscrambling(llr[0], nr_dlsch_unscrambling(llr[0],
dl_harq0->G, dl_harq0->G,
...@@ -776,11 +769,25 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, ...@@ -776,11 +769,25 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
if(is_cw1_active) { if(is_cw1_active) {
// start ldpc decode for CW 1 // start ldpc decode for CW 1
dl_harq1->G = nr_get_G(dlsch[1].dlsch_config.number_rbs, fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config = &dlsch[1].dlsch_config;
uint32_t unav_res = 0;
if(dlsch_config->pduBitmap & 0x1) {
uint16_t ptrsSymbPos = 0;
set_ptrs_symb_idx(&ptrsSymbPos,
dlsch_config->number_symbols,
dlsch_config->start_symbol,
1 << dlsch_config->PTRSTimeDensity,
dlsch_config->dlDmrsSymbPos);
int n_ptrs = (dlsch_config->number_rbs + dlsch_config->PTRSFreqDensity - 1) / dlsch_config->PTRSFreqDensity;
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_symb_sch,
nb_re_dmrs, nb_re_dmrs,
dmrs_len, dmrs_len,
dlsch[1].dlsch_config.qamModOrder, unav_res,
dlsch_config->qamModOrder,
dlsch[1].Nl); dlsch[1].Nl);
start_meas(&ue->dlsch_unscrambling_stats); start_meas(&ue->dlsch_unscrambling_stats);
nr_dlsch_unscrambling(llr[1], nr_dlsch_unscrambling(llr[1],
...@@ -1012,8 +1019,8 @@ void pbch_pdcch_processing(PHY_VARS_NR_UE *ue, ...@@ -1012,8 +1019,8 @@ void pbch_pdcch_processing(PHY_VARS_NR_UE *ue,
void pdsch_processing(PHY_VARS_NR_UE *ue, void pdsch_processing(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc, UE_nr_rxtx_proc_t *proc,
nr_phy_data_t *phy_data) { nr_phy_data_t *phy_data)
{
int frame_rx = proc->frame_rx; int frame_rx = proc->frame_rx;
int nr_slot_rx = proc->nr_slot_rx; int nr_slot_rx = proc->nr_slot_rx;
int gNB_id = proc->gNB_id; int gNB_id = proc->gNB_id;
...@@ -1027,10 +1034,10 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, ...@@ -1027,10 +1034,10 @@ void pdsch_processing(PHY_VARS_NR_UE *ue,
const uint32_t rxdataF_sz = ue->frame_parms.samples_per_slot_wCP; const uint32_t rxdataF_sz = ue->frame_parms.samples_per_slot_wCP;
__attribute__ ((aligned(32))) c16_t rxdataF[ue->frame_parms.nb_antennas_rx][rxdataF_sz]; __attribute__ ((aligned(32))) c16_t rxdataF[ue->frame_parms.nb_antennas_rx][rxdataF_sz];
if (dlsch[0].active) { if (dlsch[0].active) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PDSCH, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PDSCH, VCD_FUNCTION_IN);
uint16_t nb_symb_sch = dlsch[0].dlsch_config.number_symbols; fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config = &dlsch[0].dlsch_config;
uint16_t start_symb_sch = dlsch[0].dlsch_config.start_symbol; uint16_t nb_symb_sch = dlsch_config->number_symbols;
uint16_t start_symb_sch = dlsch_config->start_symbol;
LOG_D(PHY," ------ --> PDSCH ChannelComp/LLR Frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx); LOG_D(PHY," ------ --> PDSCH ChannelComp/LLR Frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx);
//to update from pdsch config //to update from pdsch config
...@@ -1044,25 +1051,38 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, ...@@ -1044,25 +1051,38 @@ void pdsch_processing(PHY_VARS_NR_UE *ue,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PDSCH, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PDSCH, VCD_FUNCTION_OUT);
uint8_t nb_re_dmrs; uint8_t nb_re_dmrs;
if (dlsch[0].dlsch_config.dmrsConfigType == NFAPI_NR_DMRS_TYPE1) { if (dlsch_config->dmrsConfigType == NFAPI_NR_DMRS_TYPE1) {
nb_re_dmrs = 6*dlsch[0].dlsch_config.n_dmrs_cdm_groups; nb_re_dmrs = 6 * dlsch_config->n_dmrs_cdm_groups;
} }
else { else {
nb_re_dmrs = 4*dlsch[0].dlsch_config.n_dmrs_cdm_groups; nb_re_dmrs = 4 * dlsch_config->n_dmrs_cdm_groups;
} }
uint16_t dmrs_len = get_num_dmrs(dlsch[0].dlsch_config.dlDmrsSymbPos); uint16_t dmrs_len = get_num_dmrs(dlsch_config->dlDmrsSymbPos);
uint32_t unav_res = 0;
const uint32_t rx_llr_size = nr_get_G(dlsch[0].dlsch_config.number_rbs, if(dlsch_config->pduBitmap & 0x1) {
dlsch[0].dlsch_config.number_symbols, uint16_t ptrsSymbPos = 0;
nb_re_dmrs, set_ptrs_symb_idx(&ptrsSymbPos,
dmrs_len, dlsch_config->number_symbols,
dlsch[0].dlsch_config.qamModOrder, dlsch_config->start_symbol,
dlsch[0].Nl); 1 << dlsch_config->PTRSTimeDensity,
const uint32_t rx_llr_buf_sz = ((rx_llr_size+15)/16)*16; dlsch_config->dlDmrsSymbPos);
int n_ptrs = (dlsch_config->number_rbs + dlsch_config->PTRSFreqDensity - 1) / dlsch_config->PTRSFreqDensity;
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;
const uint32_t nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1; const uint32_t nb_codewords = NR_MAX_NB_LAYERS > 4 ? 2 : 1;
int16_t* llr[2]; int16_t* llr[2];
for (int i=0; i<nb_codewords; i++) for (int i = 0; i < nb_codewords; i++)
llr[i] = (int16_t *)malloc16_clear(rx_llr_buf_sz*sizeof(int16_t)); llr[i] = (int16_t *)malloc16_clear(rx_llr_buf_sz * sizeof(int16_t));
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_C, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_C, VCD_FUNCTION_IN);
ret_pdsch = nr_ue_pdsch_procedures(ue, ret_pdsch = nr_ue_pdsch_procedures(ue,
...@@ -1073,7 +1093,7 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, ...@@ -1073,7 +1093,7 @@ void pdsch_processing(PHY_VARS_NR_UE *ue,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_C, VCD_FUNCTION_OUT); 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, rx_llr_size, 0); UEscopeCopy(ue, pdschLlr, llr[0], sizeof(int16_t), 1, dlsch0_harq->G, 0);
LOG_D(PHY, "DLSCH data reception at nr_slot_rx: %d\n", nr_slot_rx); 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); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN);
...@@ -1084,7 +1104,7 @@ void pdsch_processing(PHY_VARS_NR_UE *ue, ...@@ -1084,7 +1104,7 @@ void pdsch_processing(PHY_VARS_NR_UE *ue,
nr_ue_dlsch_procedures(ue, proc, dlsch, llr); nr_ue_dlsch_procedures(ue, proc, dlsch, llr);
else else
// don't wait anymore // don't wait anymore
send_slot_ind(ue->tx_resume_ind_fifo[(proc->nr_slot_rx + dlsch[0].dlsch_config.k1_feedback) % ue->frame_parms.slots_per_frame], proc->nr_slot_rx); send_slot_ind(ue->tx_resume_ind_fifo[(proc->nr_slot_rx + dlsch_config->k1_feedback) % ue->frame_parms.slots_per_frame], proc->nr_slot_rx);
stop_meas(&ue->dlsch_procedures_stat); stop_meas(&ue->dlsch_procedures_stat);
if (cpumeas(CPUMEAS_GETSTATE)) { if (cpumeas(CPUMEAS_GETSTATE)) {
......
...@@ -446,7 +446,7 @@ int main(int argc, char **argv) ...@@ -446,7 +446,7 @@ int main(int argc, char **argv)
// dlsch->harq_processes[0]->nb_rb,dlsch->harq_processes[0]->mcs,dlsch->harq_processes[0]->Nl); // dlsch->harq_processes[0]->nb_rb,dlsch->harq_processes[0]->mcs,dlsch->harq_processes[0]->Nl);
unsigned char mod_order = nr_get_Qm_dl(Imcs, mcs_table); unsigned char mod_order = nr_get_Qm_dl(Imcs, mcs_table);
uint16_t rate = nr_get_code_rate_dl(Imcs, mcs_table); uint16_t rate = nr_get_code_rate_dl(Imcs, mcs_table);
unsigned int available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, 1); unsigned int available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, 0, mod_order, Nl);
TBS = nr_compute_tbs(mod_order,rate, nb_rb, nb_symb_sch, nb_re_dmrs*length_dmrs, 0, 0, Nl); TBS = nr_compute_tbs(mod_order,rate, nb_rb, nb_symb_sch, nb_re_dmrs*length_dmrs, 0, 0, Nl);
printf("available bits %u TBS %u mod_order %d\n", available_bits, TBS, mod_order); printf("available bits %u TBS %u mod_order %d\n", available_bits, TBS, mod_order);
//dlsch->harq_ids[subframe]= 0; //dlsch->harq_ids[subframe]= 0;
...@@ -472,6 +472,7 @@ int main(int argc, char **argv) ...@@ -472,6 +472,7 @@ int main(int argc, char **argv)
unsigned char estimated_output_bit[16 * 68 * 384]; unsigned char estimated_output_bit[16 * 68 * 384];
NR_UE_DLSCH_t *dlsch0_ue = &dlsch_ue[0]; NR_UE_DLSCH_t *dlsch0_ue = &dlsch_ue[0];
NR_DL_UE_HARQ_t *harq_process = &UE->dl_harq_processes[0][harq_pid]; NR_DL_UE_HARQ_t *harq_process = &UE->dl_harq_processes[0][harq_pid];
harq_process->G = available_bits;
harq_process->first_rx = 1; harq_process->first_rx = 1;
dlsch0_ue->dlsch_config.mcs = Imcs; dlsch0_ue->dlsch_config.mcs = Imcs;
dlsch0_ue->dlsch_config.mcs_table = mcs_table; dlsch0_ue->dlsch_config.mcs_table = mcs_table;
......
...@@ -1018,8 +1018,8 @@ int main(int argc, char **argv) ...@@ -1018,8 +1018,8 @@ int main(int argc, char **argv)
1<<pdsch_pdu_rel15->PTRSTimeDensity, 1<<pdsch_pdu_rel15->PTRSTimeDensity,
pdsch_pdu_rel15->dlDmrsSymbPos); pdsch_pdu_rel15->dlDmrsSymbPos);
ptrsSymbPerSlot = get_ptrs_symbols_in_slot(dlPtrsSymPos, pdsch_pdu_rel15->StartSymbolIndex, pdsch_pdu_rel15->NrOfSymbols); ptrsSymbPerSlot = get_ptrs_symbols_in_slot(dlPtrsSymPos, pdsch_pdu_rel15->StartSymbolIndex, pdsch_pdu_rel15->NrOfSymbols);
ptrsRePerSymb = ((rel15->rbSize + rel15->PTRSFreqDensity - 1)/rel15->PTRSFreqDensity); ptrsRePerSymb = ((rel15->rbSize + rel15->PTRSFreqDensity - 1) / rel15->PTRSFreqDensity);
LOG_D(PHY,"[DLSIM] PTRS Symbols in a slot: %2u, RE per Symbol: %3u, RE in a slot %4d\n", ptrsSymbPerSlot,ptrsRePerSymb, ptrsSymbPerSlot*ptrsRePerSymb ); LOG_D(PHY,"[DLSIM] PTRS Symbols in a slot: %2u, RE per Symbol: %3u, RE in a slot %4d\n", ptrsSymbPerSlot, ptrsRePerSymb, ptrsSymbPerSlot * ptrsRePerSymb);
} }
msgDataTx->ssb[0].ssb_pdu.ssb_pdu_rel15.bchPayload=0x001234; msgDataTx->ssb[0].ssb_pdu.ssb_pdu_rel15.bchPayload=0x001234;
...@@ -1125,12 +1125,11 @@ int main(int argc, char **argv) ...@@ -1125,12 +1125,11 @@ int main(int argc, char **argv)
uint8_t nb_re_dmrs = rel15->dmrsConfigType == NFAPI_NR_DMRS_TYPE1 ? 6*dlsch0->dlsch_config.n_dmrs_cdm_groups : 4*dlsch0->dlsch_config.n_dmrs_cdm_groups; uint8_t nb_re_dmrs = rel15->dmrsConfigType == NFAPI_NR_DMRS_TYPE1 ? 6*dlsch0->dlsch_config.n_dmrs_cdm_groups : 4*dlsch0->dlsch_config.n_dmrs_cdm_groups;
uint8_t mod_order = rel15->qamModOrder[0]; uint8_t mod_order = rel15->qamModOrder[0];
uint8_t nb_symb_sch = rel15->NrOfSymbols; uint8_t nb_symb_sch = rel15->NrOfSymbols;
uint32_t unav_res = ptrsSymbPerSlot * ptrsRePerSymb;
available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, rel15->nrOfLayers); available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, unav_res, mod_order, rel15->nrOfLayers);
if (pdu_bit_map & 0x1) { if (pdu_bit_map & 0x1) {
available_bits -= (ptrsSymbPerSlot * ptrsRePerSymb * rel15->nrOfLayers * 2);
if (trial == 0 && round == 0) { if (trial == 0 && round == 0) {
printf("[DLSIM][PTRS] Available bits are: %5u, removed PTRS bits are: %5u \n", available_bits, (ptrsSymbPerSlot * ptrsRePerSymb * rel15->nrOfLayers * 2)); printf("[DLSIM][PTRS] Available bits are: %5u, removed PTRS bits are: %5u \n", available_bits, (ptrsSymbPerSlot * ptrsRePerSymb * rel15->nrOfLayers * mod_order));
} }
} }
......
...@@ -464,7 +464,7 @@ int main(int argc, char **argv) ...@@ -464,7 +464,7 @@ int main(int argc, char **argv)
mod_order = nr_get_Qm_ul(Imcs, mcs_table); mod_order = nr_get_Qm_ul(Imcs, mcs_table);
code_rate = nr_get_code_rate_ul(Imcs, mcs_table); code_rate = nr_get_code_rate_ul(Imcs, mcs_table);
available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, Nl); available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, 0, mod_order, Nl);
TBS = nr_compute_tbs(mod_order,code_rate, nb_rb, nb_symb_sch, nb_re_dmrs*length_dmrs, 0, 0, Nl); TBS = nr_compute_tbs(mod_order,code_rate, nb_rb, nb_symb_sch, nb_re_dmrs*length_dmrs, 0, 0, Nl);
printf("\nAvailable bits %u TBS %u mod_order %d\n", available_bits, TBS, mod_order); printf("\nAvailable bits %u TBS %u mod_order %d\n", available_bits, TBS, mod_order);
...@@ -519,7 +519,7 @@ int main(int argc, char **argv) ...@@ -519,7 +519,7 @@ int main(int argc, char **argv)
/////////////////////////ULSCH coding///////////////////////// /////////////////////////ULSCH coding/////////////////////////
/////////// ///////////
unsigned int G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs, mod_order, Nl); unsigned int G = available_bits;
if (input_fd == NULL) { if (input_fd == NULL) {
nr_ulsch_encoding(UE, ulsch_ue, frame_parms, harq_pid, TBS>>3, G); nr_ulsch_encoding(UE, ulsch_ue, frame_parms, harq_pid, TBS>>3, G);
...@@ -586,13 +586,6 @@ int main(int argc, char **argv) ...@@ -586,13 +586,6 @@ int main(int argc, char **argv)
exit(-1); exit(-1);
#endif #endif
uint32_t G = nr_get_G(rel15_ul->rb_size,
rel15_ul->nr_of_symbols,
nb_re_dmrs,
1, // FIXME only single dmrs is implemented
rel15_ul->qam_mod_order,
rel15_ul->nrOfLayers);
int nbDecode = nr_ulsch_decoding(gNB, UE_id, channel_output_fixed, frame_parms, rel15_ul, frame, subframe, harq_pid, G); int nbDecode = nr_ulsch_decoding(gNB, UE_id, channel_output_fixed, frame_parms, rel15_ul, frame, subframe, harq_pid, G);
int nb_ok = 0; int nb_ok = 0;
if (nbDecode > 0) if (nbDecode > 0)
......
...@@ -791,18 +791,12 @@ int main(int argc, char *argv[]) ...@@ -791,18 +791,12 @@ int main(int argc, char *argv[])
} }
nb_re_dmrs = nb_re_dmrs * num_dmrs_cdm_grps_no_data; nb_re_dmrs = nb_re_dmrs * num_dmrs_cdm_grps_no_data;
unsigned int available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, number_dmrs_symbols, mod_order, precod_nbr_layers);
unsigned int TBS = nr_compute_tbs(mod_order, code_rate, nb_rb, nb_symb_sch, nb_re_dmrs * number_dmrs_symbols, 0, 0, precod_nbr_layers); unsigned int TBS = nr_compute_tbs(mod_order, code_rate, nb_rb, nb_symb_sch, nb_re_dmrs * number_dmrs_symbols, 0, 0, precod_nbr_layers);
printf("[ULSIM]: length_dmrs: %u, l_prime_mask: %u number_dmrs_symbols: %u, mapping_type: %u add_pos: %d \n", length_dmrs, l_prime_mask, number_dmrs_symbols, mapping_type, add_pos); printf("[ULSIM]: length_dmrs: %u, l_prime_mask: %u number_dmrs_symbols: %u, mapping_type: %u add_pos: %d \n", length_dmrs, l_prime_mask, number_dmrs_symbols, mapping_type, add_pos);
printf("[ULSIM]: CDM groups: %u, dmrs_config_type: %d, num_rbs: %u, nb_symb_sch: %u\n", num_dmrs_cdm_grps_no_data, dmrs_config_type, nb_rb, nb_symb_sch); printf("[ULSIM]: CDM groups: %u, dmrs_config_type: %d, num_rbs: %u, nb_symb_sch: %u\n", num_dmrs_cdm_grps_no_data, dmrs_config_type, nb_rb, nb_symb_sch);
printf("[ULSIM]: MCS: %d, mod order: %u, code_rate: %u\n", Imcs, mod_order, code_rate); printf("[ULSIM]: MCS: %d, mod order: %u, code_rate: %u\n", Imcs, mod_order, code_rate);
printf("[ULSIM]: VALUE OF G: %u, TBS: %u\n", available_bits, TBS);
uint8_t ulsch_input_buffer[TBS/8]; uint8_t ulsch_input_buffer[TBS/8];
ulsch_input_buffer[0] = 0x31; ulsch_input_buffer[0] = 0x31;
...@@ -812,7 +806,6 @@ int main(int argc, char *argv[]) ...@@ -812,7 +806,6 @@ int main(int argc, char *argv[])
uint8_t ptrs_time_density = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, Imcs, mcs_table); uint8_t ptrs_time_density = get_L_ptrs(ptrs_mcs1, ptrs_mcs2, ptrs_mcs3, Imcs, mcs_table);
uint8_t ptrs_freq_density = get_K_ptrs(n_rb0, n_rb1, nb_rb); uint8_t ptrs_freq_density = get_K_ptrs(n_rb0, n_rb1, nb_rb);
int ptrs_symbols = 0; // to calculate total PTRS RE's in a slot
double ts = 1.0/(frame_parms->subcarrier_spacing * frame_parms->ofdm_symbol_size); double ts = 1.0/(frame_parms->subcarrier_spacing * frame_parms->ofdm_symbol_size);
...@@ -834,6 +827,18 @@ int main(int argc, char *argv[]) ...@@ -834,6 +827,18 @@ int main(int argc, char *argv[])
printf("\n"); printf("\n");
uint32_t unav_res = 0;
if (pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) {
set_ptrs_symb_idx(&ptrsSymPos, nb_symb_sch, start_symbol, 1 << ptrs_time_density, l_prime_mask);
ptrsSymbPerSlot = get_ptrs_symbols_in_slot(ptrsSymPos, start_symbol, nb_symb_sch);
ptrsRePerSymb = ((nb_rb + ptrs_freq_density - 1) / ptrs_freq_density);
unav_res = ptrsSymbPerSlot * ptrsRePerSymb;
LOG_D(PHY, "[ULSIM] PTRS Symbols in a slot: %2u, RE per Symbol: %3u, RE in a slot %4d\n", ptrsSymbPerSlot, ptrsRePerSymb, unav_res);
}
unsigned int available_bits = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, number_dmrs_symbols, unav_res, mod_order, precod_nbr_layers);
printf("[ULSIM]: VALUE OF G: %u, TBS: %u\n", available_bits, TBS);
int frame_length_complex_samples = frame_parms->samples_per_subframe*NR_NUMBER_OF_SUBFRAMES_PER_FRAME; int frame_length_complex_samples = frame_parms->samples_per_subframe*NR_NUMBER_OF_SUBFRAMES_PER_FRAME;
for (int aatx=0; aatx<n_tx; aatx++) { for (int aatx=0; aatx<n_tx; aatx++) {
s_re[aatx] = calloc(1,frame_length_complex_samples*sizeof(double)); s_re[aatx] = calloc(1,frame_length_complex_samples*sizeof(double));
...@@ -1210,13 +1215,6 @@ int main(int argc, char *argv[]) ...@@ -1210,13 +1215,6 @@ int main(int argc, char *argv[])
} /*End input_fd */ } /*End input_fd */
if (pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) {
set_ptrs_symb_idx(&ptrsSymPos, pusch_pdu->nr_of_symbols, pusch_pdu->start_symbol_index, 1 << ptrs_time_density, pusch_pdu->ul_dmrs_symb_pos);
ptrsSymbPerSlot = get_ptrs_symbols_in_slot(ptrsSymPos, pusch_pdu->start_symbol_index, pusch_pdu->nr_of_symbols);
ptrsRePerSymb = ((pusch_pdu->rb_size + ptrs_freq_density - 1) / ptrs_freq_density);
LOG_D(PHY, "[ULSIM] PTRS Symbols in a slot: %2u, RE per Symbol: %3u, RE in a slot %4d\n", ptrsSymbPerSlot, ptrsRePerSymb, ptrsSymbPerSlot * ptrsRePerSymb);
}
//---------------------------------------------------------- //----------------------------------------------------------
//------------------- gNB phy procedures ------------------- //------------------- gNB phy procedures -------------------
//---------------------------------------------------------- //----------------------------------------------------------
...@@ -1452,13 +1450,8 @@ int main(int argc, char *argv[]) ...@@ -1452,13 +1450,8 @@ int main(int argc, char *argv[])
//---------------------------------------------------------- //----------------------------------------------------------
if ((pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) && (SNR == snr0) && (trial == 0) && (round == 0)) { if ((pusch_pdu->pdu_bit_map & PUSCH_PDU_BITMAP_PUSCH_PTRS) && (SNR == snr0) && (trial == 0) && (round == 0)) {
ptrs_symbols = 0; printf("[ULSIM][PTRS] Available bits are: %5u, removed PTRS bits are: %5d \n",
for (int i = pusch_pdu->start_symbol_index; i < pusch_pdu->start_symbol_index + pusch_pdu->nr_of_symbols; i++) available_bits, (ptrsSymbPerSlot * ptrsRePerSymb * mod_order * precod_nbr_layers));
ptrs_symbols += ((pusch_vars->ptrs_symbols) >> i) & 1;
/* 2*5*(50/2), for RB = 50,K = 2 for 5 OFDM PTRS symbols */
available_bits -= 2 * ptrs_symbols * ((nb_rb + ptrs_freq_density - 1) / ptrs_freq_density);
printf("[ULSIM][PTRS] Available bits are: %5u, removed PTRS bits are: %5d \n", available_bits, (ptrsSymbPerSlot * ptrsRePerSymb * 2));
} }
for (i = 0; i < available_bits; i++) { for (i = 0; i < available_bits; i++) {
......
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