Commit 7db4dfec authored by Rupanjali's avatar Rupanjali

Created common ML LLR and MMSE for 2 layers functions being shared by both gNB...

Created common ML LLR and MMSE for 2 layers functions being shared by both gNB and UE. Disabled ML based LLR due to lareg compute time
Signed-off-by: default avatarRupanjali <rupanjali.srivastava@openairinterface.org>
parent e2676b51
......@@ -924,7 +924,6 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_ulsch.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_sch_dmrs.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_prach.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_ulsch_llr_computation.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c
${OPENAIR1_DIR}/PHY/NR_REFSIG/ul_ref_seq_nr.c
${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_dmrs_rx.c
......
......@@ -106,62 +106,9 @@ int nr_rx_pusch_tp(PHY_VARS_gNB *gNB,
*/
void nr_idft(int32_t *z, uint32_t Msc_PUSCH);
void nr_ulsch_qpsk_qpsk(c16_t *stream0_in,
c16_t *stream1_in,
c16_t *stream0_out,
c16_t *rho01,
uint32_t length);
void nr_ulsch_qam16_qam16(c16_t *stream0_in,
c16_t *stream1_in,
c16_t *ch_mag,
c16_t *ch_mag_i,
c16_t *stream0_out,
c16_t *rho01,
uint32_t length);
void nr_ulsch_qam64_qam64(c16_t *stream0_in,
c16_t *stream1_in,
c16_t *ch_mag,
c16_t *ch_mag_i,
c16_t *stream0_out,
c16_t *rho01,
uint32_t length);
/** \brief This function computes the log-likelihood ratios for 4, 16, and 64 QAM
@param rxdataF_comp Compensated channel output
@param ul_ch_mag uplink channel magnitude multiplied by the 1st amplitude threshold in QAM 64
@param ul_ch_magb uplink channel magnitude multiplied by the 2bd amplitude threshold in QAM 64
@param ulsch_llr llr output
@param nb_re number of REs for this allocation
@param symbol OFDM symbol index in sub-frame
@param mod_order modulation order
*/
void nr_ulsch_compute_llr(c16_t *rxdataF_comp,
c16_t *ul_ch_mag,
c16_t *ul_ch_magb,
c16_t *ul_ch_magc,
int16_t *ulsch_llr,
uint32_t nb_re,
uint8_t symbol,
uint8_t mod_order);
void reset_active_stats(PHY_VARS_gNB *gNB, int frame);
void reset_active_ulsch(PHY_VARS_gNB *gNB, int frame);
void nr_ulsch_compute_ML_llr(c16_t *rxdataF_comp0,
c16_t *rxdataF_comp1,
c16_t *ul_ch_mag0,
c16_t *ul_ch_mag1,
int16_t *llr_layers0,
int16_t *llr_layers1,
c16_t *rho0,
c16_t *rho1,
uint32_t nb_re,
uint8_t mod_order);
void nr_ulsch_shift_llr(int16_t **llr_layers, uint32_t nb_re, uint32_t rxdataF_ext_offset, uint8_t mod_order, int shift);
void nr_fill_ulsch(PHY_VARS_gNB *gNB,
int frame,
int slot,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -782,7 +782,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
c16_t ptrs_phase_per_slot[][NR_SYMBOLS_PER_SLOT],
int32_t ptrs_re_per_slot[][NR_SYMBOLS_PER_SLOT],
uint32_t nvar,
pdsch_scope_req_t *scope_req)
pdsch_scope_req_t *scope_req,
c16_t rho_dl[][dlsch->cw_info.Nl * dlsch->cw_info.Nl][rx_size_symbol])
{
NR_DL_FRAME_PARMS *fp = &ue->frame_parms;
const int nl = dlsch->cw_info.Nl;
......@@ -830,7 +831,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
uint8_t pilots = (dlsch_config->dlDmrsSymbPos >> symbol) & 1;
uint8_t config_type = dlsch_config->dmrsConfigType;
const bool need_rho __attribute__((unused)) = do_ml ? (nl == 2 && dlsch_config->cw_info->qamModOrder <= 6) : false;
const bool need_rho = do_ml ? (nl == 2 && dlsch_config->cw_info->qamModOrder <= 6) : false;
//----------------------------------------------------------
//--------------------- RBs extraction ---------------------
......@@ -1001,7 +1002,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
dl_ch_magb[symbol],
dl_ch_magr[symbol],
p_rxComp,
NULL,
need_rho ? (c16_t(*)[nl][rx_size_symbol])rho_dl[symbol] : NULL,
dlsch->cw_info.qamModOrder,
0, // symbol already baked into p_rxComp
*log2_maxh);
......@@ -1039,20 +1040,40 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
// MRC is performed inline by nr_channel_compensation; apply MMSE for multi-layer
start_meas_nr_ue_phy(ue, DLSCH_MRC_MMSE_STATS);
if (nl >= 2 && nb_re_pdsch)
nr_dlsch_mmse(rx_size_symbol,
nbRx,
nl,
rxdataF_comp,
dl_ch_mag[symbol],
dl_ch_magb[symbol],
dl_ch_magr[symbol],
dl_ch_estimates_ext,
dlsch->cw_info.qamModOrder,
*log2_maxh,
symbol,
nb_re_pdsch,
nvar);
if (nb_re_pdsch) {
const uint8_t qamModOrder = dlsch->cw_info.qamModOrder;
if ((nl > 2) || (nl == 2 && !do_ml)) {
nr_dlsch_mmse(rx_size_symbol,
nbRx,
nl,
rxdataF_comp,
dl_ch_mag[symbol],
dl_ch_magb[symbol],
dl_ch_magr[symbol],
dl_ch_estimates_ext,
qamModOrder,
*log2_maxh,
symbol,
nb_re_pdsch,
nvar);
} else if ((nl == 2) && (qamModOrder > 6) && do_ml) {
nr_mmse_2layers(p_rxComp,
rx_size_symbol,
nbRx,
nl,
dl_ch_mag[symbol],
dl_ch_magb[symbol],
dl_ch_magr[symbol],
chFext,
freq_alloc->num_rbs,
qamModOrder,
*log2_maxh,
0,
nb_re_pdsch,
nvar);
}
}
stop_meas_nr_ue_phy(ue, DLSCH_MRC_MMSE_STATS);
if (meas_enabled) {
......@@ -1105,18 +1126,35 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
__attribute__((aligned(32))) int16_t layer_llr[NR_SYMBOLS_PER_SLOT][nl][llr_per_symbol];
// Generate LLR from PTRS compensated signal
const uint8_t qamModOrder = dlsch->cw_info.qamModOrder;
start_meas_nr_ue_phy(ue, DLSCH_LLR_STATS);
for (int llr_sym = startSymbIdx; llr_sym < startSymbIdx + nbSymb; llr_sym++) {
nr_dlsch_llr(dlsch,
dl_valid_re[llr_sym],
rx_size_symbol,
dl_ch_mag[llr_sym][0],
dl_ch_magb[llr_sym][0],
dl_ch_magr[llr_sym][0],
nbRx,
rxdataF_comp[llr_sym],
llr_per_symbol,
layer_llr[llr_sym]);
if (nl == 2 && qamModOrder <= 6 && do_ml) {
// 2-layer QPSK/16QAM/64QAM: joint ML-LLR using inter-layer Tx correlation
// rho_dl[llr_sym] is laid out as [nl*nl][rx_size_symbol]:
// index 1 = rho[0][1], index nl (=2) = rho[1][0]
nr_compute_ML_llr(rxdataF_comp[llr_sym][0],
rxdataF_comp[llr_sym][nbRx],
dl_ch_mag[llr_sym][0],
dl_ch_mag[llr_sym][1],
layer_llr[llr_sym][0],
layer_llr[llr_sym][1],
rho_dl[llr_sym][1],
rho_dl[llr_sym][nl],
dl_valid_re[llr_sym],
qamModOrder);
} else {
nr_dlsch_llr(dlsch,
dl_valid_re[llr_sym],
rx_size_symbol,
dl_ch_mag[llr_sym][0],
dl_ch_magb[llr_sym][0],
dl_ch_magr[llr_sym][0],
nbRx,
rxdataF_comp[llr_sym],
llr_per_symbol,
layer_llr[llr_sym]);
}
}
stop_meas_nr_ue_phy(ue, DLSCH_LLR_STATS);
start_meas_nr_ue_phy(ue, DLSCH_LAYER_DEMAPPING);
......
......@@ -284,7 +284,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
c16_t ptrs_phase_per_slot[][NR_SYMBOLS_PER_SLOT],
int32_t ptrs_re_per_slot[][NR_SYMBOLS_PER_SLOT],
uint32_t nvar,
pdsch_scope_req_t *scope_req);
pdsch_scope_req_t *scope_req,
c16_t rho_dl[][dlsch->cw_info.Nl * dlsch->cw_info.Nl][rx_size_symbol]);
int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, int frame, uint8_t slot, c16_t **txData);
void apply_ntn_config(PHY_VARS_NR_UE *UE,
......
......@@ -413,4 +413,57 @@ void nr_channel_compensation(uint32_t buffer_length,
int mod_order,
uint32_t symbol,
uint32_t output_shift);
void nr_compute_llr(c16_t *rxdataF_comp,
c16_t *ch_mag,
c16_t *ch_magb,
c16_t *ch_magc,
int16_t *llr,
uint32_t nb_re,
uint8_t symbol,
uint8_t mod_order);
void nr_qpsk_llr_2layer(c16_t *stream0_in, c16_t *stream1_in, int16_t *stream0_out, c16_t *rho01, uint32_t length);
void nr_qam16_llr_2layer(c16_t *stream0_in,
c16_t *stream1_in,
c16_t *ch_mag,
c16_t *ch_mag_i,
int16_t *stream0_out,
c16_t *rho01,
uint32_t length);
void nr_qam64_llr_2layer(c16_t *stream0_in,
c16_t *stream1_in,
c16_t *ch_mag,
c16_t *ch_mag_i,
int16_t *stream0_out,
c16_t *rho01,
uint32_t length);
void nr_compute_ML_llr(c16_t *rxdataF_comp0,
c16_t *rxdataF_comp1,
c16_t *ch_mag0,
c16_t *ch_mag1,
int16_t *llr_layers0,
int16_t *llr_layers1,
c16_t *rho0,
c16_t *rho1,
uint32_t nb_re,
uint8_t mod_order);
uint8_t nr_mmse_2layers(c16_t **rxdataF_comp,
uint32_t buffer_length,
int nb_rx_ant,
int nb_layers,
c16_t ch_mag[nb_layers][buffer_length],
c16_t ch_magb[nb_layers][buffer_length],
c16_t ch_magc[nb_layers][buffer_length],
c16_t ul_ch_estimates_ext[][nb_rx_ant][buffer_length],
unsigned short nb_rb,
unsigned char mod_order,
int shift,
unsigned char symbol,
int length,
uint32_t noise_var);
#endif
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -570,6 +570,9 @@ static int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue,
allocCast3D(dl_ch_magb, c16_t, toFree4, NR_SYMBOLS_PER_SLOT, dlsch->cw_info.Nl, rx_size_symbol, false);
fourDimArray_t *toFree5 = NULL;
allocCast3D(dl_ch_magr, c16_t, toFree5, NR_SYMBOLS_PER_SLOT, dlsch->cw_info.Nl, rx_size_symbol, false);
fourDimArray_t *toFreeRho = NULL;
allocCast3D(rho_dl, c16_t, toFreeRho, NR_SYMBOLS_PER_SLOT, dlsch->cw_info.Nl * dlsch->cw_info.Nl, rx_size_symbol, false);
for (int m = dlschCfg->start_symbol; m < (dlschCfg->number_symbols + dlschCfg->start_symbol); m++) {
bool first_symbol_flag = false;
if (m == first_symbol_with_data)
......@@ -601,7 +604,8 @@ static int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue,
ptrs_phase_per_slot,
ptrs_re_per_slot,
nvar,
&scope_req)
&scope_req,
rho_dl)
< 0) {
if (scope_req.copy_chanest_to_scope) {
UEunlockScopeData(ue, pdschChanEstimates);
......@@ -624,6 +628,7 @@ static int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue,
free(toFree3);
free(toFree4);
free(toFree5);
free(toFreeRho);
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