Commit 6a5a9f18 authored by Raymond Knopp's avatar Raymond Knopp

testing sci2/slsch

parent 4bf5166a
...@@ -1072,6 +1072,8 @@ set(PHY_SRC_UE ...@@ -1072,6 +1072,8 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_dci_tools.c ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_dci_tools.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_ulsch_decoding.c ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_ulsch_decoding.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_ulsch.c ${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_ulsch.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_ulsch_llr_computation.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c ${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c ${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c
${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c ${OPENAIR1_DIR}/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
...@@ -1097,6 +1099,8 @@ set(PHY_SRC_UE ...@@ -1097,6 +1099,8 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c ${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/nr_adjust_synch_ue.c
${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c ${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/nr_ue_measurements.c
${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/nr_adjust_gain.c ${OPENAIR1_DIR}/PHY/NR_UE_ESTIMATION/nr_adjust_gain.c
${OPENAIR1_DIR}/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c
${OPENAIR1_DIR}/PHY/NR_ESTIMATION/nr_measurements_gNB.c
${OPENAIR1_DIR}/PHY/TOOLS/file_output.c ${OPENAIR1_DIR}/PHY/TOOLS/file_output.c
${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c ${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c
# ${OPENAIR1_DIR}/PHY/TOOLS/lte_dfts.c # ${OPENAIR1_DIR}/PHY/TOOLS/lte_dfts.c
...@@ -1363,7 +1367,7 @@ set (MAC_NR_SRC ...@@ -1363,7 +1367,7 @@ set (MAC_NR_SRC
set (MAC_SRC_UE set (MAC_SRC_UE
${PHY_INTERFACE_DIR}/phy_stub_UE.c # ${PHY_INTERFACE_DIR}/phy_stub_UE.c
${PHY_INTERFACE_DIR}/queue_t.c ${PHY_INTERFACE_DIR}/queue_t.c
${MAC_DIR}/main_ue.c ${MAC_DIR}/main_ue.c
${MAC_DIR}/ue_procedures.c ${MAC_DIR}/ue_procedures.c
......
...@@ -790,7 +790,34 @@ int get_NREsci2(const int sci2_alpha, ...@@ -790,7 +790,34 @@ int get_NREsci2(const int sci2_alpha,
uint32_t R10240 = nr_get_code_rate_ul(mcs,mcs_tb_ind); uint32_t R10240 = nr_get_code_rate_ul(mcs,mcs_tb_ind);
LOG_D(NR_PHY,"R10240 %d\n",R10240);
uint32_t tmp = (uint32_t)ceil((Osci2 + 24)*beta_offset_sci2/(R10240/5120));
float tmp2 = 12.0*pssch_numsym;
int N_REsci1 = 12*pscch_numrbs*pscch_numsym;
tmp2 *= l_subch*subchannel_size;
tmp2 -= N_REsci1;
tmp2 *= ((float)sci2_alpha/100.0);
return min(tmp,(int)ceil(tmp2));
}
int get_NREsci2_2(const int sci2_alpha,
const int sci2_payload_len,
const int sci2_beta_offset,
const int pssch_numsym,
const int pscch_numsym,
const int pscch_numrbs,
const int l_subch,
const int subchannel_size,
const int target_coderate) {
float Osci2 = (float)sci2_payload_len;
AssertFatal(sci2_beta_offset < MAX_EL_213_9_3_2, "illegal sci2_beta_offset %d\n",sci2_beta_offset);
float beta_offset_sci2 = tab38_213_9_3_2[sci2_beta_offset];
uint32_t R10240 = target_coderate;
LOG_D(NR_PHY,"R10240 = %d\n",R10240);
uint32_t tmp = (uint32_t)ceil((Osci2 + 24)*beta_offset_sci2/(R10240/5120)); uint32_t tmp = (uint32_t)ceil((Osci2 + 24)*beta_offset_sci2/(R10240/5120));
float tmp2 = 12.0*pssch_numsym; float tmp2 = 12.0*pssch_numsym;
int N_REsci1 = 12*pscch_numrbs*pscch_numsym; int N_REsci1 = 12*pscch_numrbs*pscch_numsym;
......
...@@ -641,7 +641,7 @@ void processSlotTX(void *arg) { ...@@ -641,7 +641,7 @@ void processSlotTX(void *arg) {
sl_indication.phy_data = &phy_data; sl_indication.phy_data = &phy_data;
sl_indication.slot_type = SIDELINK_SLOT_TYPE_TX; sl_indication.slot_type = SIDELINK_SLOT_TYPE_TX;
LOG_I(NR_PHY,"Sending SL indication RX %d.%d TX %d.%d\n",proc->frame_rx,proc->nr_slot_rx,proc->frame_tx,proc->nr_slot_tx); LOG_D(NR_PHY,"Sending SL indication RX %d.%d TX %d.%d\n",proc->frame_rx,proc->nr_slot_rx,proc->frame_tx,proc->nr_slot_tx);
UE->if_inst->sl_indication(&sl_indication); UE->if_inst->sl_indication(&sl_indication);
stop_meas(&UE->ue_ul_indication_stats); stop_meas(&UE->ue_ul_indication_stats);
...@@ -722,7 +722,7 @@ nr_phy_data_t UE_dl_preprocessing(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc) ...@@ -722,7 +722,7 @@ nr_phy_data_t UE_dl_preprocessing(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc)
UE->if_inst->sl_indication(&sl_indication); UE->if_inst->sl_indication(&sl_indication);
} }
uint64_t a=rdtsc_oai(); uint64_t a=rdtsc_oai();
psbch_pscch_processing(UE, proc, &phy_data); psbch_pscch_pssch_processing(UE, proc, &phy_data);
LOG_D(PHY, "In %s: slot %d:%d, time %llu\n", __FUNCTION__, proc->frame_rx, proc->nr_slot_rx, (rdtsc_oai()-a)/3500); LOG_D(PHY, "In %s: slot %d:%d, time %llu\n", __FUNCTION__, proc->frame_rx, proc->nr_slot_rx, (rdtsc_oai()-a)/3500);
} }
} else { } else {
......
...@@ -572,7 +572,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB) ...@@ -572,7 +572,7 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB)
nr_generate_modulation_table(); nr_generate_modulation_table();
gNB->pdcch_gold_init = cfg->cell_config.phy_cell_id.value; gNB->pdcch_gold_init = cfg->cell_config.phy_cell_id.value;
nr_init_pdcch_dmrs(&gNB->frame_parms,gNB->pdcch_dmrs, cfg->cell_config.phy_cell_id.value); nr_init_pdcch_dmrs(&gNB->frame_parms,gNB->nr_gold_pdcch_dmrs, cfg->cell_config.phy_cell_id.value);
nr_init_pbch_interleaver(gNB->nr_pbch_interleaver); nr_init_pbch_interleaver(gNB->nr_pbch_interleaver);
//PDSCH DMRS init //PDSCH DMRS init
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "PHY/MODULATION/nr_modulation.h" #include "PHY/MODULATION/nr_modulation.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_TRANSPORT/nr_ulsch.h"
#include "PHY/NR_REFSIG/pss_nr.h" #include "PHY/NR_REFSIG/pss_nr.h"
#include "PHY/NR_REFSIG/ul_ref_seq_nr.h" #include "PHY/NR_REFSIG/ul_ref_seq_nr.h"
#include "PHY/NR_REFSIG/refsig_defs_ue.h" #include "PHY/NR_REFSIG/refsig_defs_ue.h"
...@@ -36,6 +37,8 @@ ...@@ -36,6 +37,8 @@
#include "openair2/COMMON/prs_nr_paramdef.h" #include "openair2/COMMON/prs_nr_paramdef.h"
#include "SCHED_NR_UE/harq_nr.h" #include "SCHED_NR_UE/harq_nr.h"
#include "PHY/NR_REFSIG/nr_mod_table.h" #include "PHY/NR_REFSIG/nr_mod_table.h"
#include <math.h>
#include <complex.h>
void RCconfig_nrUE_prs(void *cfg) void RCconfig_nrUE_prs(void *cfg)
{ {
...@@ -918,6 +921,18 @@ static void sl_generate_pss_ifft_samples(sl_nr_ue_phy_params_t *sl_ue_params, SL ...@@ -918,6 +921,18 @@ static void sl_generate_pss_ifft_samples(sl_nr_ue_phy_params_t *sl_ue_params, SL
} }
void init_ul_delay_table(NR_DL_FRAME_PARMS *fp)
{
for (int delay = -MAX_UL_DELAY_COMP; delay <= MAX_UL_DELAY_COMP; delay++) {
for (int k = 0; k < fp->ofdm_symbol_size; k++) {
double complex delay_cexp = cexp(I * (2.0 * M_PI * k * delay / fp->ofdm_symbol_size));
fp->ul_delay_table[MAX_UL_DELAY_COMP + delay][k].r = (int16_t)round(256 * creal(delay_cexp));
fp->ul_delay_table[MAX_UL_DELAY_COMP + delay][k].i = (int16_t)round(256 * cimag(delay_cexp));
}
}
}
void sl_ue_phy_init(PHY_VARS_NR_UE *UE) { void sl_ue_phy_init(PHY_VARS_NR_UE *UE) {
uint16_t scaling_value = ONE_OVER_SQRT2_Q15; uint16_t scaling_value = ONE_OVER_SQRT2_Q15;
...@@ -983,5 +998,72 @@ void sl_ue_phy_init(PHY_VARS_NR_UE *UE) { ...@@ -983,5 +998,72 @@ void sl_ue_phy_init(PHY_VARS_NR_UE *UE) {
sl_generate_pss_ifft_samples(&UE->SL_UE_PHY_PARAMS, &UE->SL_UE_PHY_PARAMS.init_params); sl_generate_pss_ifft_samples(&UE->SL_UE_PHY_PARAMS, &UE->SL_UE_PHY_PARAMS.init_params);
UE->max_nb_slsch = NR_SLSCH_RX_MAX;
UE->slsch = (NR_gNB_ULSCH_t *)malloc16(UE->max_nb_slsch * sizeof(NR_gNB_ULSCH_t));
for (int i = 0; i < UE->max_nb_slsch; i++) {
LOG_I(PHY, "Allocating Transport Channel Buffers for SLSCH %d/%d\n", i, UE->max_nb_slsch);
UE->slsch[i] = new_gNB_ulsch(UE->max_ldpc_iterations, sl_fp->N_RB_UL);
}
int Prx=sl_fp->nb_antennas_rx;
int Ptx=sl_fp->nb_antennas_tx;
int N_RB_UL = sl_fp->N_RB_UL;
int n_buf = 2*Prx;
int nb_re_pusch = N_RB_UL * NR_NB_SC_PER_RB;
int nb_re_pusch2 = nb_re_pusch + (nb_re_pusch&7);
UE->pssch_vars = (NR_gNB_PUSCH *)malloc16_clear(UE->max_nb_slsch * sizeof(NR_gNB_PUSCH));
for (int SLSCH_id = 0; SLSCH_id < NR_SLSCH_RX_MAX; SLSCH_id++) {
NR_gNB_PUSCH *pssch = &UE->pssch_vars[SLSCH_id];
pssch->rxdataF_ext = (int32_t **)malloc16(Prx * sizeof(int32_t *));
pssch->ul_ch_estimates = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pssch->ul_ch_estimates_ext = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pssch->ptrs_phase_per_slot = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pssch->ul_ch_estimates_time = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pssch->rxdataF_comp = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pssch->ul_ch_mag0 = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pssch->ul_ch_magb0 = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pssch->ul_ch_magc0 = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pssch->ul_ch_mag = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pssch->ul_ch_magb = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pssch->ul_ch_magc = (int32_t **)malloc16(n_buf * sizeof(int32_t *));
pssch->rho = (int32_t ***)malloc16(Prx * sizeof(int32_t **));
pssch->llr_layers = (int16_t **)malloc16(2 * sizeof(int32_t *));
for (int i = 0; i < Prx; i++) {
pssch->rxdataF_ext[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * sl_fp->symbols_per_slot);
pssch->rho[i] = (int32_t **)malloc16_clear(2 * 2 * sizeof(int32_t *));
for (int j = 0; j < 2; j++) {
for (int k = 0; k < 2; k++) {
pssch->rho[i][j * 2 + k] =
(int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * sl_fp->symbols_per_slot);
}
}
}
for (int i = 0; i < n_buf; i++) {
pssch->ul_ch_estimates[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * sl_fp->ofdm_symbol_size * sl_fp->symbols_per_slot);
pssch->ul_ch_estimates_ext[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * sl_fp->symbols_per_slot);
pssch->ul_ch_estimates_time[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * sl_fp->ofdm_symbol_size);
pssch->ptrs_phase_per_slot[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * sl_fp->symbols_per_slot); // symbols per slot
pssch->rxdataF_comp[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * sl_fp->symbols_per_slot);
pssch->ul_ch_mag0[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * sl_fp->symbols_per_slot);
pssch->ul_ch_magb0[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * sl_fp->symbols_per_slot);
pssch->ul_ch_magc0[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * sl_fp->symbols_per_slot);
pssch->ul_ch_mag[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * sl_fp->symbols_per_slot);
pssch->ul_ch_magb[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * sl_fp->symbols_per_slot);
pssch->ul_ch_magc[i] = (int32_t *)malloc16_clear(sizeof(int32_t) * nb_re_pusch2 * sl_fp->symbols_per_slot);
}
for (int i=0; i< 2; i++) {
pssch->llr_layers[i] = (int16_t *)malloc16_clear((8 * ((3 * 8 * 6144) + 12))
* sizeof(int16_t)); // [hna] 6144 is LTE and (8*((3*8*6144)+12)) is not clear
}
pssch->llr = (int16_t *)malloc16_clear((8 * ((3 * 8 * 6144) + 12))
* sizeof(int16_t)); // [hna] 6144 is LTE and (8*((3*8*6144)+12)) is not clear
pssch->ul_valid_re_per_slot = (int16_t *)malloc16_clear(sizeof(int16_t) * sl_fp->symbols_per_slot);
} // ulsch_id
UE->sl_measurements = calloc(1,sizeof(struct PHY_MEASUREMENTS_gNB_s));
init_ul_delay_table(sl_fp);
} }
...@@ -66,7 +66,7 @@ void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRA ...@@ -66,7 +66,7 @@ void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRA
void nr_normal_prefix_mod(c16_t *txdataF, c16_t *txdata, uint8_t nsymb, const NR_DL_FRAME_PARMS *frame_parms, uint32_t slot) void nr_normal_prefix_mod(c16_t *txdataF, c16_t *txdata, uint8_t nsymb, const NR_DL_FRAME_PARMS *frame_parms, uint32_t slot)
{ {
// This function works only slot wise. For more generic symbol generation refer nr_feptx0() // This function works only slot wise. For more generic symbol generation refer nr_feptx0()
LOG_I(NR_PHY,"normal_prefix_mod: prefix0 %d, prefix %d, nsymb %d\n",frame_parms->nb_prefix_samples0,frame_parms->nb_prefix_samples,nsymb); LOG_D(NR_PHY,"normal_prefix_mod: prefix0 %d, prefix %d, nsymb %d\n",frame_parms->nb_prefix_samples0,frame_parms->nb_prefix_samples,nsymb);
if (frame_parms->numerology_index != 0) { // case where numerology != 0 if (frame_parms->numerology_index != 0) { // case where numerology != 0
if (!(slot%(frame_parms->slots_per_subframe/2))) { if (!(slot%(frame_parms->slots_per_subframe/2))) {
PHY_ofdm_mod((int *)txdataF, PHY_ofdm_mod((int *)txdataF,
......
...@@ -131,7 +131,7 @@ int slot_fep(PHY_VARS_UE *ue, ...@@ -131,7 +131,7 @@ int slot_fep(PHY_VARS_UE *ue,
// (frame_parms->ofdm_symbol_size+nb_prefix_samples)*(l-1); // (frame_parms->ofdm_symbol_size+nb_prefix_samples)*(l-1);
#ifdef DEBUG_FEP #ifdef DEBUG_FEP
// if (ue->frame <100) // if (ue->frame <100)
LOG_I(PHY,"slot_fep: frame %d: slot %d, symbol %d, nb_prefix_samples %d, nb_prefix_samples0 %d, slot_offset %d, subframe_offset %d, sample_offset %d,rx_offset %d, frame_length_samples %d\n", LOG_D(PHY,"slot_fep: frame %d: slot %d, symbol %d, nb_prefix_samples %d, nb_prefix_samples0 %d, slot_offset %d, subframe_offset %d, sample_offset %d,rx_offset %d, frame_length_samples %d\n",
ue->proc.proc_rxtx[(Ns>>1)&1].frame_rx,Ns, symbol, ue->proc.proc_rxtx[(Ns>>1)&1].frame_rx,Ns, symbol,
nb_prefix_samples,nb_prefix_samples0,slot_offset,subframe_offset,sample_offset,rx_offset,frame_length_samples); nb_prefix_samples,nb_prefix_samples0,slot_offset,subframe_offset,sample_offset,rx_offset,frame_length_samples);
#endif #endif
...@@ -206,7 +206,7 @@ int slot_fep(PHY_VARS_UE *ue, ...@@ -206,7 +206,7 @@ int slot_fep(PHY_VARS_UE *ue,
} }
#ifdef DEBUG_FEP #ifdef DEBUG_FEP
printf("slot_fep: done\n"); printf("slot_fep: Ns %d l %d, done\n",Ns,l);
#endif #endif
return(0); return(0);
} }
...@@ -316,7 +316,7 @@ int front_end_fft(PHY_VARS_UE *ue, ...@@ -316,7 +316,7 @@ int front_end_fft(PHY_VARS_UE *ue,
// (frame_parms->ofdm_symbol_size+nb_prefix_samples)*(l-1); // (frame_parms->ofdm_symbol_size+nb_prefix_samples)*(l-1);
#ifdef DEBUG_FEP #ifdef DEBUG_FEP
// if (ue->frame <100) // if (ue->frame <100)
LOG_I(PHY, LOG_D(PHY,
"slot_fep: frame %d: slot %d, threadId %d, symbol %d, nb_prefix_samples %d, nb_prefix_samples0 %d, slot_offset %d, subframe_offset %d, sample_offset %d,rx_offset %d, frame_length_samples %d\n", "slot_fep: frame %d: slot %d, threadId %d, symbol %d, nb_prefix_samples %d, nb_prefix_samples0 %d, slot_offset %d, subframe_offset %d, sample_offset %d,rx_offset %d, frame_length_samples %d\n",
ue->proc.proc_rxtx[threadId].frame_rx,Ns, threadId,symbol, ue->proc.proc_rxtx[threadId].frame_rx,Ns, threadId,symbol,
nb_prefix_samples,nb_prefix_samples0,slot_offset,subframe_offset,sample_offset,rx_offset,frame_length_samples); nb_prefix_samples,nb_prefix_samples0,slot_offset,subframe_offset,sample_offset,rx_offset,frame_length_samples);
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "PHY/NR_UE_ESTIMATION/nr_estimation.h" #include "PHY/NR_UE_ESTIMATION/nr_estimation.h"
#include <common/utils/LOG/log.h> #include <common/utils/LOG/log.h>
//#define DEBUG_FEP #define DEBUG_FEP
/*#ifdef LOG_I /*#ifdef LOG_I
#undef LOG_I #undef LOG_I
...@@ -165,11 +165,11 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -165,11 +165,11 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
// rx_offset -= (nb_prefix_samples / frame_parms->ofdm_offset_divisor); // rx_offset -= (nb_prefix_samples / frame_parms->ofdm_offset_divisor);
rx_offset += 1; rx_offset += 1;
//#ifdef DEBUG_FEP #ifdef DEBUG_FEP
// if (ue->frame <100) // if (ue->frame <100)
LOG_I(PHY,"slot_fep: slot %d, symbol %d, nb_prefix_samples %u, nb_prefix_samples0 %u, rx_offset %u energy %d\n", LOG_I(PHY,"slot_fep: slot %d, symbol %d, nb_prefix_samples %u, nb_prefix_samples0 %u, rx_offset %u energy %d\n",
Ns, symbol, nb_prefix_samples, nb_prefix_samples0, rx_offset, dB_fixed(signal_energy((int32_t *)&common_vars->rxdata[0][rx_offset],frame_parms->ofdm_symbol_size))); Ns, symbol, nb_prefix_samples, nb_prefix_samples0, rx_offset, dB_fixed(signal_energy((int32_t *)&common_vars->rxdata[0][rx_offset],frame_parms->ofdm_symbol_size)));
//#endif #endif
for (unsigned char aa=0; aa<frame_parms->nb_antennas_rx; aa++) { for (unsigned char aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
int16_t *rxdata_ptr = (int16_t *)&common_vars->rxdata[aa][rx_offset]; int16_t *rxdata_ptr = (int16_t *)&common_vars->rxdata[aa][rx_offset];
...@@ -204,12 +204,10 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -204,12 +204,10 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
symbol, symbol,
linktype); linktype);
*/ */
for (int i=1413;i<1422;i+=4)
printf("i : %d,%d\n", rxdataF[aa][i + (frame_parms->ofdm_symbol_size*symbol)].r,rxdataF[aa][i+(frame_parms->ofdm_symbol_size*symbol)].i);
} }
#ifdef DEBUG_FEP #ifdef DEBUG_FEP
printf("slot_fep: done\n"); LOG_I(NR_PHY,"slot_fep: done for Ns %d symbol %d\n",Ns,symbol);
#endif #endif
return 0; return 0;
......
...@@ -220,7 +220,8 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb ...@@ -220,7 +220,8 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb
// //
// Todo: // Todo:
// - averaging IIR filter for RX power and noise // - averaging IIR filter for RX power and noise
void nr_gnb_measurements(PHY_VARS_gNB *gNB, void nr_gnb_measurements(PHY_MEASUREMENTS_gNB *meas,
NR_DL_FRAME_PARMS *fp,
NR_gNB_ULSCH_t *ulsch, NR_gNB_ULSCH_t *ulsch,
NR_gNB_PUSCH *pusch_vars, NR_gNB_PUSCH *pusch_vars,
unsigned char symbol, unsigned char symbol,
...@@ -232,8 +233,6 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB, ...@@ -232,8 +233,6 @@ void nr_gnb_measurements(PHY_VARS_gNB *gNB,
double rx_gain = openair0_cfg[0].rx_gain[0]; double rx_gain = openair0_cfg[0].rx_gain[0];
double rx_gain_offset = openair0_cfg[0].rx_gain_offset[0]; double rx_gain_offset = openair0_cfg[0].rx_gain_offset[0];
PHY_MEASUREMENTS_gNB *meas = &gNB->measurements;
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
int ch_offset = fp->ofdm_symbol_size * symbol; int ch_offset = fp->ofdm_symbol_size * symbol;
int N_RB_UL = ulsch->harq_process->ulsch_pdu.rb_size; int N_RB_UL = ulsch->harq_process->ulsch_pdu.rb_size;
ulsch_measurements_gNB *ulsch_measurements = &ulsch->ulsch_measurements; ulsch_measurements_gNB *ulsch_measurements = &ulsch->ulsch_measurements;
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "PHY/defs_gNB.h" #include "PHY/defs_gNB.h"
#include "PHY/defs_nr_UE.h"
/** @addtogroup _PHY_PARAMETER_ESTIMATION_BLOCKS_ /** @addtogroup _PHY_PARAMETER_ESTIMATION_BLOCKS_
* @{ * @{
*/ */
...@@ -41,12 +42,16 @@ ...@@ -41,12 +42,16 @@
*/ */
int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
PHY_VARS_NR_UE *ue,
int rxFSz,
c16_t rxdataF[][rxFSz],
unsigned char Ns, unsigned char Ns,
unsigned short p, unsigned short p,
unsigned char symbol, unsigned char symbol,
int ul_id, int ul_id,
unsigned short bwp_start_subcarrier, unsigned short bwp_start_subcarrier,
nfapi_nr_pusch_pdu_t *pusch_pdu, nfapi_nr_pusch_pdu_t *pusch_pdu,
sl_nr_rx_config_pssch_sci_pdu_t *pssch_pdu,
int *max_ch, int *max_ch,
uint32_t *nvar); uint32_t *nvar);
...@@ -54,7 +59,8 @@ void dump_nr_I0_stats(FILE *fd,PHY_VARS_gNB *gNB); ...@@ -54,7 +59,8 @@ void dump_nr_I0_stats(FILE *fd,PHY_VARS_gNB *gNB);
void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot,int first_symb,int num_symb); void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot,int first_symb,int num_symb);
void nr_gnb_measurements(PHY_VARS_gNB *gNB, void nr_gnb_measurements(PHY_MEASUREMENTS_gNB *meas,
NR_DL_FRAME_PARMS *fp,
NR_gNB_ULSCH_t *ulsch, NR_gNB_ULSCH_t *ulsch,
NR_gNB_PUSCH *pusch_vars, NR_gNB_PUSCH *pusch_vars,
unsigned char symbol, unsigned char symbol,
...@@ -68,8 +74,10 @@ int nr_est_timing_advance_srs(const NR_DL_FRAME_PARMS *frame_parms, ...@@ -68,8 +74,10 @@ int nr_est_timing_advance_srs(const NR_DL_FRAME_PARMS *frame_parms,
const int32_t srs_estimated_channel_time[][frame_parms->ofdm_symbol_size]); const int32_t srs_estimated_channel_time[][frame_parms->ofdm_symbol_size]);
void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB, void nr_pusch_ptrs_processing(PHY_VARS_gNB *gNB,
struct PHY_VARS_NR_UE_s *ue,
NR_DL_FRAME_PARMS *frame_parms, NR_DL_FRAME_PARMS *frame_parms,
nfapi_nr_pusch_pdu_t *rel15_ul, nfapi_nr_pusch_pdu_t *rel15_ul,
sl_nr_rx_config_pssch_sci_pdu_t *pssch_pdu,
uint8_t ulsch_id, uint8_t ulsch_id,
uint8_t nr_tti_rx, uint8_t nr_tti_rx,
unsigned char symbol, unsigned char symbol,
......
...@@ -63,7 +63,7 @@ int nr_pusch_dmrs_delta(uint8_t dmrs_config_type, unsigned short p) { ...@@ -63,7 +63,7 @@ int nr_pusch_dmrs_delta(uint8_t dmrs_config_type, unsigned short p) {
} }
} }
int nr_pusch_dmrs_rx(PHY_VARS_gNB *gNB, int nr_pusch_dmrs_rx(int Ncp,
unsigned int Ns, unsigned int Ns,
unsigned int *nr_gold_pusch, unsigned int *nr_gold_pusch,
int32_t *output, int32_t *output,
...@@ -86,7 +86,7 @@ int nr_pusch_dmrs_rx(PHY_VARS_gNB *gNB, ...@@ -86,7 +86,7 @@ int nr_pusch_dmrs_rx(PHY_VARS_gNB *gNB,
LOG_E(PHY,"PUSCH DMRS config type %d not valid\n", dmrs_type+1); LOG_E(PHY,"PUSCH DMRS config type %d not valid\n", dmrs_type+1);
if ((p>=1000) && (p<((dmrs_type==pusch_dmrs_type1) ? 1008 : 1012))) { if ((p>=1000) && (p<((dmrs_type==pusch_dmrs_type1) ? 1008 : 1012))) {
if (gNB->frame_parms.Ncp == NORMAL) { if (Ncp == NORMAL) {
nb_dmrs = ((dmrs_type==pusch_dmrs_type1) ? 6:4); nb_dmrs = ((dmrs_type==pusch_dmrs_type1) ? 6:4);
for (int i=dmrs_offset; i<dmrs_offset+(nb_pusch_rb*nb_dmrs); i++) { for (int i=dmrs_offset; i<dmrs_offset+(nb_pusch_rb*nb_dmrs); i++) {
k = i-dmrs_offset; k = i-dmrs_offset;
......
...@@ -51,7 +51,7 @@ void nr_gold_pusch(PHY_VARS_gNB* gNB, int nscid, uint32_t nid); ...@@ -51,7 +51,7 @@ void nr_gold_pusch(PHY_VARS_gNB* gNB, int nscid, uint32_t nid);
int nr_pusch_dmrs_delta(uint8_t dmrs_config_type, unsigned short p); int nr_pusch_dmrs_delta(uint8_t dmrs_config_type, unsigned short p);
int nr_pusch_dmrs_rx(PHY_VARS_gNB *gNB, int nr_pusch_dmrs_rx(int Ncp,
unsigned int Ns, unsigned int Ns,
unsigned int *nr_gold_pusch, unsigned int *nr_gold_pusch,
int32_t *output, int32_t *output,
......
...@@ -45,12 +45,13 @@ void nr_pdcch_scrambling(uint32_t *in, ...@@ -45,12 +45,13 @@ void nr_pdcch_scrambling(uint32_t *in,
uint32_t size, uint32_t size,
uint32_t Nid, uint32_t Nid,
uint32_t scrambling_RNTI, uint32_t scrambling_RNTI,
uint32_t *out) { uint32_t *out,
int sci_flag) {
uint8_t reset; uint8_t reset;
uint32_t x1 = 0, x2 = 0, s = 0; uint32_t x1 = 0, x2 = 0, s = 0;
reset = 1; reset = 1;
x2 = (scrambling_RNTI<<16) + Nid; if (sci_flag==0) x2 = (scrambling_RNTI<<16) + Nid;
LOG_D(PHY,"PDCCH Scrambling x2 %x : scrambling_RNTI %x \n", x2, scrambling_RNTI); else x2 = (Nid<<15) + 1010;
for (int i=0; i<size; i++) { for (int i=0; i<size; i++) {
if ((i&0x1f)==0) { if ((i&0x1f)==0) {
s = lte_gold_generic(&x1, &x2, reset); s = lte_gold_generic(&x1, &x2, reset);
...@@ -114,8 +115,8 @@ uint32_t nr_generate_dci(PHY_VARS_gNB *gNB, PHY_VARS_NR_UE *ue, ...@@ -114,8 +115,8 @@ uint32_t nr_generate_dci(PHY_VARS_gNB *gNB, PHY_VARS_NR_UE *ue,
cset_start_symb = pdcch_pdu_rel15->StartSymbolIndex; cset_start_symb = pdcch_pdu_rel15->StartSymbolIndex;
cset_nsymb = pdcch_pdu_rel15->DurationSymbols; cset_nsymb = pdcch_pdu_rel15->DurationSymbols;
dci_idx = 0; dci_idx = 0;
LOG_D(PHY, "pdcch: Coreset rb_offset %d, nb_rb %d BWP Start %d\n",rb_offset,n_rb,pdcch_pdu_rel15->BWPStart); LOG_D(NR_PHY, "pdcch: Coreset rb_offset %d, nb_rb %d BWP Start %d\n",rb_offset,n_rb,pdcch_pdu_rel15->BWPStart);
LOG_D(PHY, "pdcch: Coreset starting subcarrier %d on symbol %d (%d symbols)\n", cset_start_sc, cset_start_symb, cset_nsymb); LOG_D(NR_PHY, "pdcch: Coreset starting subcarrier %d on symbol %d (%d symbols)\n", cset_start_sc, cset_start_symb, cset_nsymb);
// DMRS length is per OFDM symbol // DMRS length is per OFDM symbol
uint32_t dmrs_length = (n_rb+pdcch_pdu_rel15->BWPStart)*6; //2(QPSK)*3(per RB)*6(REG per CCE) uint32_t dmrs_length = (n_rb+pdcch_pdu_rel15->BWPStart)*6; //2(QPSK)*3(per RB)*6(REG per CCE)
uint32_t encoded_length = gNB ? dci_pdu->AggregationLevel*108:dci_pdu->AggregationLevel*18; //2(QPSK)*9(per RB)*6(REG per CCE) uint32_t encoded_length = gNB ? dci_pdu->AggregationLevel*108:dci_pdu->AggregationLevel*18; //2(QPSK)*9(per RB)*6(REG per CCE)
...@@ -163,9 +164,9 @@ uint32_t nr_generate_dci(PHY_VARS_gNB *gNB, PHY_VARS_NR_UE *ue, ...@@ -163,9 +164,9 @@ uint32_t nr_generate_dci(PHY_VARS_gNB *gNB, PHY_VARS_NR_UE *ue,
#endif #endif
/// Scrambling /// Scrambling
uint32_t scrambled_output[NR_MAX_DCI_SIZE_DWORD]= {0}; uint32_t scrambled_output[NR_MAX_DCI_SIZE_DWORD]= {0};
nr_pdcch_scrambling(encoder_output, encoded_length, Nid, scrambling_RNTI, scrambled_output); nr_pdcch_scrambling(encoder_output, encoded_length, Nid, scrambling_RNTI, scrambled_output,0);
#ifdef DEBUG_CHANNEL_CODING #ifdef DEBUG_CHANNEL_CODING
printf("scrambled output: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\t [4]->0x%08x\t [5]->0x%08x\t \ printf("scrambled output: [0]->0x%08x \t [1]->0x%08x \t [2]->0x%08x \t [3]->0x%08x\t [4]->0x%08x\t [5]->0x%08x\n \
[6]->0x%08x \t [7]->0x%08x \t [8]->0x%08x \t [9]->0x%08x\t [10]->0x%08x\t [11]->0x%08x\n", [6]->0x%08x \t [7]->0x%08x \t [8]->0x%08x \t [9]->0x%08x\t [10]->0x%08x\t [11]->0x%08x\n",
scrambled_output[0], scrambled_output[1], scrambled_output[2], scrambled_output[3], scrambled_output[4],scrambled_output[5], scrambled_output[0], scrambled_output[1], scrambled_output[2], scrambled_output[3], scrambled_output[4],scrambled_output[5],
scrambled_output[6], scrambled_output[7], scrambled_output[8], scrambled_output[9], scrambled_output[10],scrambled_output[11] ); scrambled_output[6], scrambled_output[7], scrambled_output[8], scrambled_output[9], scrambled_output[10],scrambled_output[11] );
......
...@@ -39,7 +39,8 @@ void nr_pdcch_scrambling(uint32_t *in, ...@@ -39,7 +39,8 @@ void nr_pdcch_scrambling(uint32_t *in,
uint32_t size, uint32_t size,
uint32_t Nid, uint32_t Nid,
uint32_t n_RNTI, uint32_t n_RNTI,
uint32_t *out); uint32_t *out,
int sci_flag);
int16_t find_nr_pdcch(int frame,int slot, PHY_VARS_gNB *gNB,find_type_t type); int16_t find_nr_pdcch(int frame,int slot, PHY_VARS_gNB *gNB,find_type_t type);
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "PHY/defs_nr_common.h" #include "PHY/defs_nr_common.h"
#include "PHY/defs_gNB.h" #include "PHY/defs_gNB.h"
#include "PHY/defs_nr_UE.h"
#define NR_PBCH_PDU_BITS 24 #define NR_PBCH_PDU_BITS 24
...@@ -126,6 +127,11 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch, uint16_t N_RB, const NR_DL_FRAME_PARM ...@@ -126,6 +127,11 @@ void free_gNB_dlsch(NR_gNB_DLSCH_t *dlsch, uint16_t N_RB, const NR_DL_FRAME_PARM
@param harq_pid HARQ process ID @param harq_pid HARQ process ID
*/ */
void nr_rx_pusch(PHY_VARS_gNB *gNB, void nr_rx_pusch(PHY_VARS_gNB *gNB,
PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
nr_phy_data_t *phy_data,
int rxFSz,
c16_t rxdataF[][rxFSz],
uint8_t UE_id, uint8_t UE_id,
uint32_t frame, uint32_t frame,
uint8_t slot, uint8_t slot,
...@@ -140,12 +146,18 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB, ...@@ -140,12 +146,18 @@ void nr_rx_pusch(PHY_VARS_gNB *gNB,
@param nb_rb_pusch The number of RBs allocated (used for Resource Allocation Type 1 in NR) @param nb_rb_pusch The number of RBs allocated (used for Resource Allocation Type 1 in NR)
@param frame_parms, Pointer to frame descriptor structure @param frame_parms, Pointer to frame descriptor structure
*/ */
void nr_ulsch_extract_rbs(c16_t **rxdataF, void nr_ulsch_extract_rbs(int rxFSz,
c16_t rxdataF[][rxFSz],
NR_gNB_PUSCH *pusch_vars, NR_gNB_PUSCH *pusch_vars,
int slot, int slot,
unsigned char symbol, unsigned char symbol,
uint8_t is_dmrs_symbol, uint8_t is_dmrs_symbol,
nfapi_nr_pusch_pdu_t *pusch_pdu, uint32_t bwp_start,
uint32_t rb_start,
uint32_t rb_size,
uint32_t nrOfLayers,
uint32_t num_dmrs_cdm_grps_no_data,
uint32_t dmrs_config_type,
NR_DL_FRAME_PARMS *frame_parms); NR_DL_FRAME_PARMS *frame_parms);
void nr_ulsch_scale_channel(int32_t **ul_ch_estimates_ext, void nr_ulsch_scale_channel(int32_t **ul_ch_estimates_ext,
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
*/ */
#include "PHY/defs_gNB.h" #include "PHY/defs_gNB.h"
#include "PHY/defs_nr_UE.h"
#include "common/utils/threadPool/thread-pool.h" #include "common/utils/threadPool/thread-pool.h"
void free_gNB_ulsch(NR_gNB_ULSCH_t *ulsch, uint16_t N_RB_UL); void free_gNB_ulsch(NR_gNB_ULSCH_t *ulsch, uint16_t N_RB_UL);
...@@ -50,6 +51,7 @@ NR_gNB_ULSCH_t new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL); ...@@ -50,6 +51,7 @@ NR_gNB_ULSCH_t new_gNB_ulsch(uint8_t max_ldpc_iterations, uint16_t N_RB_UL);
*/ */
int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
struct PHY_VARS_NR_UE_s *UE,
uint8_t UE_id, uint8_t UE_id,
short *ulsch_llr, short *ulsch_llr,
NR_DL_FRAME_PARMS *frame_parms, NR_DL_FRAME_PARMS *frame_parms,
...@@ -57,7 +59,9 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -57,7 +59,9 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
uint32_t frame, uint32_t frame,
uint8_t nr_tti_rx, uint8_t nr_tti_rx,
uint8_t harq_pid, uint8_t harq_pid,
uint32_t G); uint32_t G,
UE_nr_rxtx_proc_t *proc,
nr_phy_data_t *phy_data);
/*! \brief Perform PUSCH unscrambling. TS 38.211 V15.4.0 subclause 6.3.1.1 /*! \brief Perform PUSCH unscrambling. TS 38.211 V15.4.0 subclause 6.3.1.1
@param llr, Pointer to llr bits @param llr, Pointer to llr bits
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
*/ */
#include "PHY/defs_nr_UE.h"
// [from gNB coding] // [from gNB coding]
#include "PHY/defs_gNB.h" #include "PHY/defs_gNB.h"
#include "PHY/CODING/coding_extern.h" #include "PHY/CODING/coding_extern.h"
...@@ -47,6 +48,8 @@ ...@@ -47,6 +48,8 @@
#include "common/utils/LOG/vcd_signal_dumper.h" #include "common/utils/LOG/vcd_signal_dumper.h"
#include "common/utils/LOG/log.h" #include "common/utils/LOG/log.h"
#include <syscall.h> #include <syscall.h>
#include "executables/nr-uesoftmodem.h"
//#define DEBUG_ULSCH_DECODING //#define DEBUG_ULSCH_DECODING
//#define gNB_DEBUG_TRACE //#define gNB_DEBUG_TRACE
...@@ -251,16 +254,23 @@ static void nr_processULSegment(void *arg) ...@@ -251,16 +254,23 @@ static void nr_processULSegment(void *arg)
//stop_meas(&phy_vars_gNB->ulsch_ldpc_decoding_stats); //stop_meas(&phy_vars_gNB->ulsch_ldpc_decoding_stats);
} }
int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
uint8_t ULSCH_id, struct PHY_VARS_NR_UE_s *UE,
short *ulsch_llr, uint8_t ULSCH_id,
NR_DL_FRAME_PARMS *frame_parms, short *ulsch_llr,
nfapi_nr_pusch_pdu_t *pusch_pdu, NR_DL_FRAME_PARMS *frame_parms,
uint32_t frame, nfapi_nr_pusch_pdu_t *pusch_pdu,
uint8_t nr_tti_rx, uint32_t frame,
uint8_t harq_pid, uint8_t nr_tti_rx,
uint32_t G) uint8_t harq_pid,
uint32_t G,
UE_nr_rxtx_proc_t *proc,
nr_phy_data_t *phy_data)
{ {
AssertFatal((phy_vars_gNB && !UE) || (!phy_vars_gNB && UE),"Only one of gNB or UE must be non-null`");
if (!ulsch_llr) { if (!ulsch_llr) {
LOG_E(PHY, "ulsch_decoding.c: NULL ulsch_llr pointer\n"); LOG_E(PHY, "ulsch_decoding.c: NULL ulsch_llr pointer\n");
return -1; return -1;
...@@ -268,8 +278,8 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -268,8 +278,8 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_ULSCH_DECODING, 1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_ULSCH_DECODING, 1);
NR_gNB_ULSCH_t *ulsch = &phy_vars_gNB->ulsch[ULSCH_id]; NR_gNB_ULSCH_t *ulsch = phy_vars_gNB ? &phy_vars_gNB->ulsch[ULSCH_id] : &UE->slsch[ULSCH_id];
NR_gNB_PUSCH *pusch = &phy_vars_gNB->pusch_vars[ULSCH_id]; NR_gNB_PUSCH *pusch = phy_vars_gNB ? &phy_vars_gNB->pusch_vars[ULSCH_id] : &UE->pssch_vars[ULSCH_id];
NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_process; NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_process;
if (!harq_process) { if (!harq_process) {
...@@ -382,7 +392,7 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -382,7 +392,7 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
Kr_bytes = Kr >> 3; Kr_bytes = Kr >> 3;
uint32_t offset = 0; uint32_t offset = 0;
if (phy_vars_gNB->ldpc_offload_flag && mcs > 9) { if (phy_vars_gNB && phy_vars_gNB->ldpc_offload_flag && mcs > 9) {
int8_t llrProcBuf[22 * 384]; int8_t llrProcBuf[22 * 384];
// if (dtx_det==0) { // if (dtx_det==0) {
int16_t z_ol[68 * 384]; int16_t z_ol[68 * 384];
...@@ -464,7 +474,7 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -464,7 +474,7 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_ULSCH_DECODING, 0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_gNB_ULSCH_DECODING, 0);
if (harq_process->processedSegments == harq_process->C) { if (harq_process->processedSegments == harq_process->C) {
LOG_D(PHY, "[gNB %d] ULSCH: Setting ACK for slot %d TBS %d\n", phy_vars_gNB->Mod_id, ulsch->slot, harq_process->TBS); LOG_D(PHY, "[%s %d] ULSCH: Setting ACK for slot %d TBS %d\n", phy_vars_gNB ? "gNB" : "UE", phy_vars_gNB ? phy_vars_gNB->Mod_id : 0, ulsch->slot, harq_process->TBS);
ulsch->active = false; ulsch->active = false;
harq_process->round = 0; harq_process->round = 0;
...@@ -473,8 +483,8 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -473,8 +483,8 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
} else { } else {
LOG_D(PHY, LOG_D(PHY,
"[gNB %d] ULSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d)\n", "[%s %d] ULSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d)\n",
phy_vars_gNB->Mod_id, phy_vars_gNB ? "gNB" : "UE", phy_vars_gNB ? phy_vars_gNB->Mod_id : 0,
ulsch->frame, ulsch->frame,
ulsch->slot, ulsch->slot,
harq_pid, harq_pid,
...@@ -492,13 +502,16 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -492,13 +502,16 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
else { else {
dtx_det = 0; dtx_det = 0;
set_abort(&harq_process->abort_decode, false); set_abort(&harq_process->abort_decode, false);
notifiedFIFO_t nf;
if (UE) initNotifiedFIFO(&nf);
for (int r = 0; r < harq_process->C; r++) { for (int r = 0; r < harq_process->C; r++) {
int E = nr_get_E(G, harq_process->C, Qm, n_layers, r); int E = nr_get_E(G, harq_process->C, Qm, n_layers, r);
union ldpcReqUnion id = {.s = {ulsch->rnti, frame, nr_tti_rx, 0, 0}}; union ldpcReqUnion id = {.s = {ulsch->rnti, frame, nr_tti_rx, 0, 0}};
notifiedFIFO_elt_t *req = newNotifiedFIFO_elt(sizeof(ldpcDecode_t), id.p, &phy_vars_gNB->respDecode, &nr_processULSegment); notifiedFIFO_elt_t *req = newNotifiedFIFO_elt(sizeof(ldpcDecode_t), id.p, phy_vars_gNB ? &phy_vars_gNB->respDecode : &nf, &nr_processULSegment);
ldpcDecode_t *rdata = (ldpcDecode_t *)NotifiedFifoData(req); ldpcDecode_t *rdata = (ldpcDecode_t *)NotifiedFifoData(req);
decParams.R = nr_get_R_ldpc_decoder(pusch_pdu->pusch_data.rv_index, E, decParams.BG, decParams.Z, &harq_process->llrLen, harq_process->round); decParams.R = nr_get_R_ldpc_decoder(pusch_pdu->pusch_data.rv_index, E, decParams.BG, decParams.Z, &harq_process->llrLen, harq_process->round);
rdata->gNB = phy_vars_gNB; rdata->gNB = phy_vars_gNB;
rdata->UE = UE;
rdata->ulsch_harq = harq_process; rdata->ulsch_harq = harq_process;
rdata->decoderParms = decParams; rdata->decoderParms = decParams;
rdata->ulsch_llr = ulsch_llr; rdata->ulsch_llr = ulsch_llr;
...@@ -516,12 +529,25 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, ...@@ -516,12 +529,25 @@ int nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
rdata->ulsch = ulsch; rdata->ulsch = ulsch;
rdata->ulsch_id = ULSCH_id; rdata->ulsch_id = ULSCH_id;
rdata->tbslbrm = pusch_pdu->maintenance_parms_v3.tbSizeLbrmBytes; rdata->tbslbrm = pusch_pdu->maintenance_parms_v3.tbSizeLbrmBytes;
pushTpool(&phy_vars_gNB->threadPool, req); pushTpool(phy_vars_gNB ? &phy_vars_gNB->threadPool : &get_nrUE_params()->Tpool, req);
LOG_D(PHY, "Added a block to decode, in pipe: %d\n", r); LOG_D(PHY, "Added a block to decode, in pipe: %d\n", r);
r_offset += E; r_offset += E;
offset += (Kr_bytes - (harq_process->F >> 3) - ((harq_process->C > 1) ? 3 : 0)); offset += (Kr_bytes - (harq_process->F >> 3) - ((harq_process->C > 1) ? 3 : 0));
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
} }
if (UE) {
int num_seg_ok = 0;
int nbDecode = harq_process->C;
while (nbDecode) {
notifiedFIFO_elt_t *req=pullTpool(&nf, &get_nrUE_params()->Tpool);
if (req == NULL)
break; // Tpool has been stopped
nr_postDecode_slsch(UE, req,proc,phy_data);
delNotifiedFIFO_elt(req);
nbDecode--;
}
}
} }
return harq_process->C; return harq_process->C;
} }
...@@ -704,7 +704,7 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, ...@@ -704,7 +704,7 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
memset(llr, 0, sizeof(llr)); memset(llr, 0, sizeof(llr));
LOG_I(NR_PHY,"pdcch coreset: freq %x, n_rb %d, rb_offset %d\n", LOG_D(NR_PHY,"pdcch coreset: freq %x, n_rb %d, rb_offset %d\n",
rel15->coreset.frequency_domain_resource[0],n_rb,rb_offset); rel15->coreset.frequency_domain_resource[0],n_rb,rb_offset);
for (int s=rel15->coreset.StartSymbolIndex; s<(rel15->coreset.StartSymbolIndex+rel15->coreset.duration); s++) { for (int s=rel15->coreset.StartSymbolIndex; s<(rel15->coreset.StartSymbolIndex+rel15->coreset.duration); s++) {
LOG_D(NR_PHY,"in nr_pdcch_extract_rbs_single(rxdataF -> rxdataF_ext || dl_ch_estimates -> dl_ch_estimates_ext)\n"); LOG_D(NR_PHY,"in nr_pdcch_extract_rbs_single(rxdataF -> rxdataF_ext || dl_ch_estimates -> dl_ch_estimates_ext)\n");
...@@ -722,7 +722,7 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, ...@@ -722,7 +722,7 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
n_rb, n_rb,
rel15->BWPStart); rel15->BWPStart);
if (pscch_flag == 1) if (pscch_flag == 1 && dB_fixed(signal_energy_nodc(&pdcch_dl_ch_estimates_ext[0][s*n_rb*NBR_RE_PER_RB_WITH_DMRS],n_rb*NBR_RE_PER_RB_WITH_DMRS)) > 30)
LOG_I(NR_PHY,"PSCCH: %d.%d rx level0_%d %d ch_level0_%d %d\n",proc->frame_rx,proc->nr_slot_rx, s, dB_fixed(signal_energy_nodc(&rxdataF_ext[0][s*n_rb*NBR_RE_PER_RB_WITH_DMRS],n_rb*NBR_RE_PER_RB_WITH_DMRS)),s,dB_fixed(signal_energy_nodc(&pdcch_dl_ch_estimates_ext[0][s*n_rb*NBR_RE_PER_RB_WITH_DMRS],n_rb*NBR_RE_PER_RB_WITH_DMRS))); LOG_I(NR_PHY,"PSCCH: %d.%d rx level0_%d %d ch_level0_%d %d\n",proc->frame_rx,proc->nr_slot_rx, s, dB_fixed(signal_energy_nodc(&rxdataF_ext[0][s*n_rb*NBR_RE_PER_RB_WITH_DMRS],n_rb*NBR_RE_PER_RB_WITH_DMRS)),s,dB_fixed(signal_energy_nodc(&pdcch_dl_ch_estimates_ext[0][s*n_rb*NBR_RE_PER_RB_WITH_DMRS],n_rb*NBR_RE_PER_RB_WITH_DMRS)));
LOG_D(PHY,"we enter nr_pdcch_channel_level(avgP=%d) => compute channel level based on ofdm symbol 0, pdcch_vars[eNB_id]->dl_ch_estimates_ext\n",*avgP); LOG_D(PHY,"we enter nr_pdcch_channel_level(avgP=%d) => compute channel level based on ofdm symbol 0, pdcch_vars[eNB_id]->dl_ch_estimates_ext\n",*avgP);
LOG_D(PHY,"in nr_pdcch_channel_level(dl_ch_estimates_ext -> dl_ch_estimates_ext)\n"); LOG_D(PHY,"in nr_pdcch_channel_level(dl_ch_estimates_ext -> dl_ch_estimates_ext)\n");
...@@ -811,7 +811,8 @@ void nr_pdcch_unscrambling(int16_t *e_rx, ...@@ -811,7 +811,8 @@ void nr_pdcch_unscrambling(int16_t *e_rx,
uint16_t scrambling_RNTI, uint16_t scrambling_RNTI,
uint32_t length, uint32_t length,
uint16_t pdcch_DMRS_scrambling_id, uint16_t pdcch_DMRS_scrambling_id,
int16_t *z2) { int16_t *z2,
int sci_flag) {
int i; int i;
uint8_t reset; uint8_t reset;
uint32_t x1 = 0, x2 = 0, s = 0; uint32_t x1 = 0, x2 = 0, s = 0;
...@@ -820,7 +821,7 @@ void nr_pdcch_unscrambling(int16_t *e_rx, ...@@ -820,7 +821,7 @@ void nr_pdcch_unscrambling(int16_t *e_rx,
reset = 1; reset = 1;
// x1 is set in first call to lte_gold_generic // x1 is set in first call to lte_gold_generic
n_id = pdcch_DMRS_scrambling_id; n_id = pdcch_DMRS_scrambling_id;
x2 = ((rnti<<16) + n_id); //mod 2^31 is implicit //this is c_init in 38.211 v15.1.0 Section 7.3.2.3 x2 = sci_flag == 0 ? ((rnti<<16) + n_id) : ((n_id<<15) + 1010); //mod 2^31 is implicit //this is c_init in 38.211 v15.1.0 Section 7.3.2.3
LOG_D(PHY,"PDCCH Unscrambling x2 %x : scrambling_RNTI %x\n", x2, rnti); LOG_D(PHY,"PDCCH Unscrambling x2 %x : scrambling_RNTI %x\n", x2, rnti);
...@@ -914,7 +915,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, ...@@ -914,7 +915,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
proc->frame_rx, proc->nr_slot_rx, j, rel15->number_of_candidates, CCEind, e_rx_cand_idx, L, dci_length, nr_dci_format_string[rel15->dci_format_options[k]]); proc->frame_rx, proc->nr_slot_rx, j, rel15->number_of_candidates, CCEind, e_rx_cand_idx, L, dci_length, nr_dci_format_string[rel15->dci_format_options[k]]);
nr_pdcch_unscrambling(&pdcch_e_rx[e_rx_cand_idx], rel15->coreset.scrambling_rnti, pscch_flag==0 ? L*108 : L*18, rel15->coreset.pdcch_dmrs_scrambling_id, tmp_e); nr_pdcch_unscrambling(&pdcch_e_rx[e_rx_cand_idx], rel15->coreset.scrambling_rnti, pscch_flag==0 ? L*108 : L*18, rel15->coreset.pdcch_dmrs_scrambling_id, tmp_e,0);
#ifdef DEBUG_DCI_DECODING #ifdef DEBUG_DCI_DECODING
uint32_t *z = (uint32_t *) &pdcch_e_rx[e_rx_cand_idx]; uint32_t *z = (uint32_t *) &pdcch_e_rx[e_rx_cand_idx];
...@@ -932,7 +933,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, ...@@ -932,7 +933,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
pscch_flag == 0 ? NR_POLAR_DCI_MESSAGE_TYPE : NR_POLAR_SCI_MESSAGE_TYPE, dci_length, L); pscch_flag == 0 ? NR_POLAR_DCI_MESSAGE_TYPE : NR_POLAR_SCI_MESSAGE_TYPE, dci_length, L);
n_rnti = rel15->rnti; n_rnti = rel15->rnti;
LOG_D(PHY, "(%i.%i) %s indication (rnti %x,format %s,n_CCE %d,payloadSize %d,payload %llx )\n", if (crc == 0) LOG_I(PHY, "(%i.%i) %s indication (rnti %x,format %s,n_CCE %d,payloadSize %d,payload %llx )\n",
proc->frame_rx, proc->nr_slot_rx,pscch_flag==0?"dci":"sci",n_rnti,pscch_flag==0?nr_dci_format_string[rel15->dci_format_options[k]]:"1A",CCEind,dci_length, *(unsigned long long*)dci_estimation); proc->frame_rx, proc->nr_slot_rx,pscch_flag==0?"dci":"sci",n_rnti,pscch_flag==0?nr_dci_format_string[rel15->dci_format_options[k]]:"1A",CCEind,dci_length, *(unsigned long long*)dci_estimation);
if (crc == n_rnti) { if (crc == n_rnti) {
LOG_I(PHY, "(%i.%i) Received %s indication (rnti %x,dci format %s,n_CCE %d,payloadSize %d,payload %llx)\n", LOG_I(PHY, "(%i.%i) Received %s indication (rnti %x,dci format %s,n_CCE %d,payloadSize %d,payload %llx)\n",
...@@ -977,7 +978,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, ...@@ -977,7 +978,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
break; // If DCI is found, no need to check for remaining DCI lengths break; // If DCI is found, no need to check for remaining DCI lengths
} }
} else { } else {
LOG_I(PHY,"(%i.%i) Decoded crc %x does not match rnti %x for DCI format %d\n", proc->frame_rx, proc->nr_slot_rx, crc, n_rnti, rel15->dci_format_options[k]); LOG_D(PHY,"(%i.%i) Decoded crc %x does not match rnti %x for DCI format %d\n", proc->frame_rx, proc->nr_slot_rx, crc, n_rnti, rel15->dci_format_options[k]);
} }
} }
e_rx_cand_idx += 9*L*6*2; //e_rx index for next candidate (L CCEs, 6 REGs per CCE and 9 REs per REG and 2 uint16_t per RE) e_rx_cand_idx += 9*L*6*2; //e_rx index for next candidate (L CCEs, 6 REGs per CCE and 9 REs per REG and 2 uint16_t per RE)
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "PHY/MODULATION/modulation_UE.h" #include "PHY/MODULATION/modulation_UE.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
#include "SCHED_NR_UE/defs.h" #include "SCHED_NR_UE/defs.h"
#include "common/utils/colors.h"
//#define SL_DEBUG //#define SL_DEBUG
...@@ -57,8 +58,8 @@ static int sl_nr_pss_correlation(PHY_VARS_NR_UE *UE, int frame_index) ...@@ -57,8 +58,8 @@ static int sl_nr_pss_correlation(PHY_VARS_NR_UE *UE, int frame_index)
int shift = log2_approx(maxval);//*(sl_fp->ofdm_symbol_size + sl_fp->nb_prefix_samples)*2); int shift = log2_approx(maxval);//*(sl_fp->ofdm_symbol_size + sl_fp->nb_prefix_samples)*2);
#ifdef SL_DEBUG #ifdef SL_DEBUG
LOG_I(PHY,"SIDELINK SLSS SEARCH: Function:%s\n", __func__); LOG_I(NR_PHY,"SIDELINK SLSS SEARCH: Function:%s\n", __func__);
LOG_I(PHY,"maxval:%d, shift:%d\n", maxval, shift); LOG_I(NR_PHY,"maxval:%d, shift:%d\n", maxval, shift);
#endif #endif
for (int pss_index = 0; pss_index < SL_NR_NUM_IDs_IN_PSS; pss_index++) { for (int pss_index = 0; pss_index < SL_NR_NUM_IDs_IN_PSS; pss_index++) {
...@@ -159,8 +160,8 @@ static int sl_nr_pss_correlation(PHY_VARS_NR_UE *UE, int frame_index) ...@@ -159,8 +160,8 @@ static int sl_nr_pss_correlation(PHY_VARS_NR_UE *UE, int frame_index)
sync_params->N_sl_id2 = pss_source; sync_params->N_sl_id2 = pss_source;
LOG_I(PHY,"PSS Source = %d, Peak found at pos %d, val = %llu (%d dB) avg %d dB, ffo %lf, freq offset:%d Hz\n", LOG_I(NR_PHY,"%sPSS Source = %d, Peak found at pos %d, val = %llu (%d dB) avg %d dB, ffo %lf, freq offset:%d Hz\n",
pss_source, peak_position, (unsigned long long)peak_value, dB_fixed64(peak_value),dB_fixed64(avg[pss_source]),ffo_est, sync_params->freq_offset); KRED,pss_source, peak_position, (unsigned long long)peak_value, dB_fixed64(peak_value),dB_fixed64(avg[pss_source]),ffo_est, sync_params->freq_offset);
if (peak_value < 5*avg[pss_source]) if (peak_value < 5*avg[pss_source])
return(-1); return(-1);
...@@ -372,7 +373,7 @@ static void sl_nr_extract_sss(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, ...@@ -372,7 +373,7 @@ static void sl_nr_extract_sss(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc,
ue->SL_UE_PHY_PARAMS.sync_params.N_sl_id1 = Nid1; ue->SL_UE_PHY_PARAMS.sync_params.N_sl_id1 = Nid1;
ue->SL_UE_PHY_PARAMS.sync_params.N_sl_id = ue->SL_UE_PHY_PARAMS.sync_params.N_sl_id1 + 336 * ue->SL_UE_PHY_PARAMS.sync_params.N_sl_id2; ue->SL_UE_PHY_PARAMS.sync_params.N_sl_id = ue->SL_UE_PHY_PARAMS.sync_params.N_sl_id1 + 336 * ue->SL_UE_PHY_PARAMS.sync_params.N_sl_id2;
LOG_I(PHY, "UE[%d]NR-SL SLSS SEARCH: SSS Processing over. id2 from SSS:%d, id1 from PSS:%d, SLSS id:%d\n", LOG_I(NR_PHY, "%sUE[%d]NR-SL SLSS SEARCH: SSS Processing over. id2 from SSS:%d, id1 from PSS:%d, SLSS id:%d\n",KRED,
ue->Mod_id, ue->SL_UE_PHY_PARAMS.sync_params.N_sl_id1, ue->SL_UE_PHY_PARAMS.sync_params.N_sl_id2, ue->Mod_id, ue->SL_UE_PHY_PARAMS.sync_params.N_sl_id1, ue->SL_UE_PHY_PARAMS.sync_params.N_sl_id2,
ue->SL_UE_PHY_PARAMS.sync_params.N_sl_id); ue->SL_UE_PHY_PARAMS.sync_params.N_sl_id);
...@@ -431,7 +432,7 @@ int sl_nr_slss_search(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc, int num_frame ...@@ -431,7 +432,7 @@ int sl_nr_slss_search(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc, int num_frame
sync_pos = sl_nr_pss_correlation(UE, frame_index); sync_pos = sl_nr_pss_correlation(UE, frame_index);
if (sync_pos == -1) { if (sync_pos == -1) {
LOG_I(PHY,"SIDELINK SEARCH SLSS: No PSSS found in this frame\n"); LOG_I(NR_PHY,"SIDELINK SEARCH SLSS: No PSSS found in this frame\n");
continue; continue;
} }
...@@ -455,7 +456,7 @@ int sl_nr_slss_search(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc, int num_frame ...@@ -455,7 +456,7 @@ int sl_nr_slss_search(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc, int num_frame
#define SL_NR_NUM_SYMBOLS_FOR_PSBCH_NORMAL_CP 14 #define SL_NR_NUM_SYMBOLS_FOR_PSBCH_NORMAL_CP 14
LOG_I(PHY,"UE[%d]SIDELINK SEARCH SLSS: PSS Peak at %d, PSS sym:%d, Estimated PSS position %d\n", LOG_I(NR_PHY,"%sUE[%d]SIDELINK SEARCH SLSS: PSS Peak at %d, PSS sym:%d, Estimated PSS position %d\n",KRED,
UE->Mod_id,sync_pos,pss_sym,sync_params->ssb_offset); UE->Mod_id,sync_pos,pss_sym,sync_params->ssb_offset);
int slss_block_samples = (SL_NR_NUM_SYMBOLS_FOR_PSBCH_NORMAL_CP * sl_fp->ofdm_symbol_size) + int slss_block_samples = (SL_NR_NUM_SYMBOLS_FOR_PSBCH_NORMAL_CP * sl_fp->ofdm_symbol_size) +
...@@ -479,7 +480,7 @@ int sl_nr_slss_search(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc, int num_frame ...@@ -479,7 +480,7 @@ int sl_nr_slss_search(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc, int num_frame
int end = ssb_end_position; // loop over samples in all symbols (ssb size), including prefix int end = ssb_end_position; // loop over samples in all symbols (ssb size), including prefix
LOG_I(PHY,"SLSS SEARCH: FREQ comp of SLSS samples. Freq_OFSET:%d, startpos:%d, end_pos:%d\n", LOG_I(NR_PHY,"%sSLSS SEARCH: FREQ comp of SLSS samples. Freq_OFSET:%d, startpos:%d, end_pos:%d\n",KRED,
sync_params->freq_offset, start, end); sync_params->freq_offset, start, end);
for(int n=start; n<end; n++) { for(int n=start; n<end; n++) {
for (int ar=0; ar<sl_fp->nb_antennas_rx; ar++) { for (int ar=0; ar<sl_fp->nb_antennas_rx; ar++) {
...@@ -550,7 +551,7 @@ int sl_nr_slss_search(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc, int num_frame ...@@ -550,7 +551,7 @@ int sl_nr_slss_search(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc, int num_frame
//rx_offset points to remaining samples needed to fill a frame //rx_offset points to remaining samples needed to fill a frame
sync_params->rx_offset = sync_params->ssb_offset % sl_fp->samples_per_frame; sync_params->rx_offset = sync_params->ssb_offset % sl_fp->samples_per_frame;
LOG_I(PHY,"UE[%d]SIDELINK SLSS SEARCH: PSBCH RX OK. Remainingframes:%d, rx_offset:%d\n", LOG_I(NR_PHY,"%sUE[%d]SIDELINK SLSS SEARCH: PSBCH RX OK. Remainingframes:%d, rx_offset:%d\n",KRED,
UE->Mod_id,sync_params->remaining_frames, sync_params->rx_offset); UE->Mod_id,sync_params->remaining_frames, sync_params->rx_offset);
uint32_t psbch_payload = (*(uint32_t *)decoded_output); uint32_t psbch_payload = (*(uint32_t *)decoded_output);
...@@ -558,7 +559,7 @@ int sl_nr_slss_search(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc, int num_frame ...@@ -558,7 +559,7 @@ int sl_nr_slss_search(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc, int num_frame
sync_params->DFN = (((psbch_payload & 0x0700) >> 1) | ((psbch_payload & 0xFE0000) >> 17)); sync_params->DFN = (((psbch_payload & 0x0700) >> 1) | ((psbch_payload & 0xFE0000) >> 17));
sync_params->slot_offset = (((psbch_payload & 0x010000) >> 10) | ((psbch_payload & 0xFC000000) >> 26)); sync_params->slot_offset = (((psbch_payload & 0x010000) >> 10) | ((psbch_payload & 0xFC000000) >> 26));
LOG_I(PHY, "UE[%d]SIDELINK SLSS SEARCH: SL-MIB: DFN:%d, slot:%d.\n", LOG_I(NR_PHY, "%sUE[%d]SIDELINK SLSS SEARCH: SL-MIB: DFN:%d, slot:%d.\n",KRED,
UE->Mod_id, sync_params->DFN, sync_params->slot_offset); UE->Mod_id, sync_params->DFN, sync_params->slot_offset);
nr_sl_psbch_rsrp_measurements(sl_ue,frame_parms,rxdataF, false); nr_sl_psbch_rsrp_measurements(sl_ue,frame_parms,rxdataF, false);
...@@ -582,7 +583,7 @@ int sl_nr_slss_search(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc, int num_frame ...@@ -582,7 +583,7 @@ int sl_nr_slss_search(PHY_VARS_NR_UE *UE, UE_nr_rxtx_proc_t *proc, int num_frame
break; break;
} }
LOG_I(PHY,"SIDELINK SLSS SEARCH: SLSS ID: %d metric %d, phase %d, psbch CRC %s\n", LOG_I(NR_PHY,"SIDELINK SLSS SEARCH: SLSS ID: %d metric %d, phase %d, psbch CRC %s\n",
sl_ue->sync_params.N_sl_id,metric_tdd_ncp,phase_tdd_ncp,(ret == 0) ? "OK" : "NOT OK"); sl_ue->sync_params.N_sl_id,metric_tdd_ncp,phase_tdd_ncp,(ret == 0) ? "OK" : "NOT OK");
} else { } else {
......
...@@ -254,7 +254,6 @@ void nr_pbch_channel_compensation(struct complex16 rxdataF_ext[][PBCH_MAX_RE_PER ...@@ -254,7 +254,6 @@ void nr_pbch_channel_compensation(struct complex16 rxdataF_ext[][PBCH_MAX_RE_PER
vect128 *dl_ch128 = (vect128 *)dl_ch_estimates_ext[aarx]; vect128 *dl_ch128 = (vect128 *)dl_ch_estimates_ext[aarx];
vect128 *rxdataF128 = (vect128 *)rxdataF_ext[aarx]; vect128 *rxdataF128 = (vect128 *)rxdataF_ext[aarx];
vect128 *rxdataF_comp128 = (vect128 *)rxdataF_comp[aarx]; vect128 *rxdataF_comp128 = (vect128 *)rxdataF_comp[aarx];
for (int re=0; re<nb_re; re+=12) { for (int re=0; re<nb_re; re+=12) {
*rxdataF_comp128++ = mulByConjugate128(rxdataF128++, dl_ch128++, output_shift); *rxdataF_comp128++ = mulByConjugate128(rxdataF128++, dl_ch128++, output_shift);
*rxdataF_comp128++ = mulByConjugate128(rxdataF128++, dl_ch128++, output_shift); *rxdataF_comp128++ = mulByConjugate128(rxdataF128++, dl_ch128++, output_shift);
......
...@@ -163,8 +163,9 @@ int nr_rx_psbch(PHY_VARS_NR_UE *ue, ...@@ -163,8 +163,9 @@ int nr_rx_psbch(PHY_VARS_NR_UE *ue,
for (int symbol=0; symbol<numsym;) { for (int symbol=0; symbol<numsym;) {
const uint16_t nb_re = SL_NR_NUM_PSBCH_DATA_RE_IN_ONE_SYMBOL; const uint16_t nb_re = SL_NR_NUM_PSBCH_DATA_RE_IN_ONE_SYMBOL;
__attribute__ ((aligned(32))) struct complex16 rxdataF_ext[frame_parms->nb_antennas_rx][nb_re]; uint16_t nb_re2 = (nb_re/12)*12 + ((nb_re % 12)>0 ? 12 : 0);
__attribute__ ((aligned(32))) struct complex16 dl_ch_estimates_ext[frame_parms->nb_antennas_rx][nb_re]; __attribute__ ((aligned(32))) struct complex16 rxdataF_ext[frame_parms->nb_antennas_rx][nb_re2];
__attribute__ ((aligned(32))) struct complex16 dl_ch_estimates_ext[frame_parms->nb_antennas_rx][nb_re2];
//memset(dl_ch_estimates_ext,0, sizeof dl_ch_estimates_ext); //memset(dl_ch_estimates_ext,0, sizeof dl_ch_estimates_ext);
nr_psbch_extract(frame_parms->samples_per_slot_wCP, nr_psbch_extract(frame_parms->samples_per_slot_wCP,
rxdataF, rxdataF,
...@@ -191,7 +192,7 @@ int nr_rx_psbch(PHY_VARS_NR_UE *ue, ...@@ -191,7 +192,7 @@ int nr_rx_psbch(PHY_VARS_NR_UE *ue,
LOG_I(PHY,"PSBCH RX log2_maxh = %f (%d)\n", log2_maxh, max_h); LOG_I(PHY,"PSBCH RX log2_maxh = %f (%d)\n", log2_maxh, max_h);
#endif #endif
__attribute__ ((aligned(32))) struct complex16 rxdataF_comp[frame_parms->nb_antennas_rx][nb_re]; __attribute__ ((aligned(32))) struct complex16 rxdataF_comp[frame_parms->nb_antennas_rx][nb_re2];
nr_pbch_channel_compensation(rxdataF_ext, nr_pbch_channel_compensation(rxdataF_ext,
dl_ch_estimates_ext, dl_ch_estimates_ext,
nb_re, nb_re,
......
...@@ -364,7 +364,7 @@ void nr_pdcch_unscrambling(int16_t *z, ...@@ -364,7 +364,7 @@ void nr_pdcch_unscrambling(int16_t *z,
uint16_t scrambling_RNTI, uint16_t scrambling_RNTI,
uint32_t length, uint32_t length,
uint16_t pdcch_DMRS_scrambling_id, uint16_t pdcch_DMRS_scrambling_id,
int16_t *z2); int16_t *z2,int sci_flag);
uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc, UE_nr_rxtx_proc_t *proc,
......
...@@ -75,9 +75,9 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, ...@@ -75,9 +75,9 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_UE_ULSCH_ENCODING, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_UE_ULSCH_ENCODING, VCD_FUNCTION_IN);
LOG_D(NR_PHY, "ulsch coding nb_rb %d, Nl = %d\n", nb_rb, num_layers); LOG_I(NR_PHY, "%s coding nb_rb %d, Nl = %d\n", pscch_pssch_pdu == NULL ? "ULSCH":"SLSCH",nb_rb, num_layers);
LOG_D(NR_PHY, "ulsch coding A %d G %d mod_order %d Coderate %f\n", A, G, mod_order, Coderate); LOG_I(NR_PHY, "%s coding A %d G %d mod_order %d Coderate %f\n", pscch_pssch_pdu == NULL ? "ULSCH" : "SLSCH",A, G, mod_order, Coderate);
LOG_D(NR_PHY, "harq_pid %d harq_process->ndi %d, pusch_data.new_data_indicator %d\n", LOG_I(NR_PHY, "harq_pid %d harq_process->ndi %d, pusch_data.new_data_indicator %d\n",
harq_pid,harq_process->ndi,ndi); harq_pid,harq_process->ndi,ndi);
if (harq_process->first_tx == 1 || if (harq_process->first_tx == 1 ||
...@@ -239,7 +239,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, ...@@ -239,7 +239,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
} }
LOG_D(PHY,"Rate Matching, Code segment %d (coded bits (G) %u, unpunctured/repeated bits per code segment %d, mod_order %d, nb_rb %d, rvidx %d)...\n", LOG_I(PHY,"Rate Matching, Code segment %d (coded bits (G) %u, unpunctured/repeated bits per code segment %d, mod_order %d, nb_rb %d, rvidx %d)...\n",
r, r,
G, G,
Kr*3, Kr*3,
...@@ -262,7 +262,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue, ...@@ -262,7 +262,7 @@ int nr_ulsch_encoding(PHY_VARS_NR_UE *ue,
harq_process->C, harq_process->C,
F, F,
Kr-F-2*(*pz), Kr-F-2*(*pz),
ulsch->pusch_pdu.pusch_data.rv_index, rv_index,
E) == -1) E) == -1)
return -1; return -1;
......
This diff is collapsed.
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#define __PHY_DEFS_GNB__H__ #define __PHY_DEFS_GNB__H__
#include "defs_nr_common.h" #include "defs_nr_common.h"
#include "defs_nr_UE.h"
#include "CODING/nrPolar_tools/nr_polar_pbch_defs.h" #include "CODING/nrPolar_tools/nr_polar_pbch_defs.h"
#include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h" #include "openair2/NR_PHY_INTERFACE/NR_IF_Module.h"
#include "PHY/NR_TRANSPORT/nr_transport_common_proto.h" #include "PHY/NR_TRANSPORT/nr_transport_common_proto.h"
...@@ -43,6 +44,7 @@ ...@@ -43,6 +44,7 @@
#include "PHY/CODING/nrLDPC_decoder/nrLDPC_types.h" #include "PHY/CODING/nrLDPC_decoder/nrLDPC_types.h"
#include "executables/rt_profiling.h" #include "executables/rt_profiling.h"
#include "nfapi_nr_interface_scf.h" #include "nfapi_nr_interface_scf.h"
#include "sidelink_nr_ue_interface.h"
#define MAX_NUM_RU_PER_gNB 8 #define MAX_NUM_RU_PER_gNB 8
#define MAX_PUCCH0_NID 8 #define MAX_PUCCH0_NID 8
...@@ -188,6 +190,10 @@ typedef struct { ...@@ -188,6 +190,10 @@ typedef struct {
typedef struct { typedef struct {
/// Nfapi ULSCH PDU /// Nfapi ULSCH PDU
nfapi_nr_pusch_pdu_t ulsch_pdu; nfapi_nr_pusch_pdu_t ulsch_pdu;
/// PSSCH PDU
sl_nr_rx_config_pssch_sci_pdu_t *pssch_pdu;
/// SLSCH PDU
sl_nr_rx_config_pssch_pdu_t *slsch_pdu;
/// Index of current HARQ round for this DLSCH /// Index of current HARQ round for this DLSCH
uint8_t round; uint8_t round;
bool new_rx; bool new_rx;
...@@ -264,7 +270,7 @@ typedef struct { ...@@ -264,7 +270,7 @@ typedef struct {
int pusch_delay_max_val; int pusch_delay_max_val;
} NR_ULSCH_delay_t; } NR_ULSCH_delay_t;
typedef struct { typedef struct NR_gNB_ULSCH_s {
uint32_t frame; uint32_t frame;
uint32_t slot; uint32_t slot;
/// Pointers to 16 HARQ processes for the ULSCH /// Pointers to 16 HARQ processes for the ULSCH
...@@ -325,7 +331,7 @@ typedef struct { ...@@ -325,7 +331,7 @@ typedef struct {
} NR_gNB_COMMON; } NR_gNB_COMMON;
typedef struct { typedef struct NR_gNB_PUSCH_s {
/// \brief Holds the received data in the frequency domain for the allocated RBs in repeated format. /// \brief Holds the received data in the frequency domain for the allocated RBs in repeated format.
/// - first index: rx antenna id [0..nb_antennas_rx[ /// - first index: rx antenna id [0..nb_antennas_rx[
/// - second index: ? [0..2*ofdm_symbol_size[ /// - second index: ? [0..2*ofdm_symbol_size[
...@@ -548,7 +554,7 @@ typedef struct gNB_L1_proc_t_s { ...@@ -548,7 +554,7 @@ typedef struct gNB_L1_proc_t_s {
gNB_L1_rxtx_proc_t L1_proc, L1_proc_tx; gNB_L1_rxtx_proc_t L1_proc, L1_proc_tx;
} gNB_L1_proc_t; } gNB_L1_proc_t;
typedef struct { typedef struct PHY_MEASUREMENTS_gNB_s {
// common measurements // common measurements
//! estimated noise power (linear) //! estimated noise power (linear)
unsigned int n0_power[MAX_NUM_RU_PER_gNB]; unsigned int n0_power[MAX_NUM_RU_PER_gNB];
...@@ -782,6 +788,7 @@ typedef struct PHY_VARS_gNB_s { ...@@ -782,6 +788,7 @@ typedef struct PHY_VARS_gNB_s {
typedef struct LDPCDecode_s { typedef struct LDPCDecode_s {
PHY_VARS_gNB *gNB; PHY_VARS_gNB *gNB;
struct PHY_VARS_NR_UE_s *UE;
NR_UL_gNB_HARQ_t *ulsch_harq; NR_UL_gNB_HARQ_t *ulsch_harq;
t_nrLDPC_dec_params decoderParms; t_nrLDPC_dec_params decoderParms;
NR_gNB_ULSCH_t *ulsch; NR_gNB_ULSCH_t *ulsch;
......
...@@ -37,7 +37,8 @@ ...@@ -37,7 +37,8 @@
#define _Atomic(X) std::atomic< X > #define _Atomic(X) std::atomic< X >
#endif #endif
#include "defs_nr_common.h" #include "PHY/defs_nr_common.h"
#include "PHY/defs_gNB.h"
#include "CODING/nrPolar_tools/nr_polar_pbch_defs.h" #include "CODING/nrPolar_tools/nr_polar_pbch_defs.h"
#include "PHY/defs_nr_sl_UE.h" #include "PHY/defs_nr_sl_UE.h"
...@@ -96,6 +97,8 @@ ...@@ -96,6 +97,8 @@
#include "impl_defs_top.h" #include "impl_defs_top.h"
#include "impl_defs_nr.h" #include "impl_defs_nr.h"
// This is for ULSCH RX structures used for Sidelink
#include "defs_gNB.h"
#include "time_meas.h" #include "time_meas.h"
#include "PHY/CODING/coding_defs.h" #include "PHY/CODING/coding_defs.h"
#include "PHY/TOOLS/tools_defs.h" #include "PHY/TOOLS/tools_defs.h"
...@@ -311,7 +314,7 @@ typedef struct { ...@@ -311,7 +314,7 @@ typedef struct {
#define NR_PSBCH_MAX_NB_MOD_SYMBOLS 99 #define NR_PSBCH_MAX_NB_MOD_SYMBOLS 99
#define NR_PSBCH_DMRS_LENGTH 297 // in mod symbols #define NR_PSBCH_DMRS_LENGTH 297 // in mod symbols
#define NR_PSBCH_DMRS_LENGTH_DWORD 20 // ceil(2(QPSK)*NR_PBCH_DMRS_LENGTH/32) #define NR_PSBCH_DMRS_LENGTH_DWORD 20 // ceil(2(QPSK)*NR_PBCH_DMRS_LENGTH/32)
#define NR_SLSCH_RX_MAX 2
/* NR Sidelink PSBCH payload fields /* NR Sidelink PSBCH payload fields
TODO: This will be removed in the future and TODO: This will be removed in the future and
filled in by the upper layers once developed. */ filled in by the upper layers once developed. */
...@@ -364,7 +367,7 @@ typedef struct UE_NR_SCAN_INFO_s { ...@@ -364,7 +367,7 @@ typedef struct UE_NR_SCAN_INFO_s {
} UE_NR_SCAN_INFO_t; } UE_NR_SCAN_INFO_t;
/// Top-level PHY Data Structure for UE /// Top-level PHY Data Structure for UE
typedef struct { typedef struct PHY_VARS_NR_UE_s {
/// \brief Module ID indicator for this instance /// \brief Module ID indicator for this instance
uint8_t Mod_id; uint8_t Mod_id;
/// \brief Component carrier ID for this PHY instance /// \brief Component carrier ID for this PHY instance
...@@ -437,7 +440,6 @@ typedef struct { ...@@ -437,7 +440,6 @@ typedef struct {
uint8_t prs_active_gNBs; uint8_t prs_active_gNBs;
NR_DL_UE_HARQ_t dl_harq_processes[2][NR_MAX_DLSCH_HARQ_PROCESSES]; NR_DL_UE_HARQ_t dl_harq_processes[2][NR_MAX_DLSCH_HARQ_PROCESSES];
NR_UL_UE_HARQ_t ul_harq_processes[NR_MAX_ULSCH_HARQ_PROCESSES]; NR_UL_UE_HARQ_t ul_harq_processes[NR_MAX_ULSCH_HARQ_PROCESSES];
//Paging parameters //Paging parameters
uint32_t IMSImod1024; uint32_t IMSImod1024;
uint32_t PF; uint32_t PF;
...@@ -655,6 +657,11 @@ typedef struct { ...@@ -655,6 +657,11 @@ typedef struct {
//Sidelink parameters //Sidelink parameters
sl_nr_sidelink_mode_t sl_mode; sl_nr_sidelink_mode_t sl_mode;
sl_nr_ue_phy_params_t SL_UE_PHY_PARAMS; sl_nr_ue_phy_params_t SL_UE_PHY_PARAMS;
struct PHY_MEASUREMENTS_gNB_s *sl_measurements;
int max_nb_slsch;
// we use the gNB ULSCH context for SLSCH reception
struct NR_gNB_ULSCH_s *slsch;
struct NR_gNB_PUSCH_s *pssch_vars;
bool phy_config_request_sent; bool phy_config_request_sent;
int pscch_dmrs_gold_init; int pscch_dmrs_gold_init;
/// PDCCH DMRS for TX /// PDCCH DMRS for TX
...@@ -699,6 +706,7 @@ typedef struct nr_phy_data_s { ...@@ -699,6 +706,7 @@ typedef struct nr_phy_data_s {
sl_nr_rx_config_type_enum_t sl_rx_action; sl_nr_rx_config_type_enum_t sl_rx_action;
sl_nr_rx_config_pscch_pdu_t nr_sl_pscch_pdu; sl_nr_rx_config_pscch_pdu_t nr_sl_pscch_pdu;
sl_nr_rx_config_pssch_sci_pdu_t nr_sl_pssch_sci_pdu; sl_nr_rx_config_pssch_sci_pdu_t nr_sl_pssch_sci_pdu;
sl_nr_rx_config_pssch_pdu_t nr_sl_pssch_pdu;
} nr_phy_data_t; } nr_phy_data_t;
/* this structure is used to pass both UE phy vars and /* this structure is used to pass both UE phy vars and
* proc to the function UE_thread_rxn_txnp4 * proc to the function UE_thread_rxn_txnp4
......
...@@ -281,7 +281,7 @@ static void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) ...@@ -281,7 +281,7 @@ static void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req)
ulsch->active = false; ulsch->active = false;
ulsch_harq->round = 0; ulsch_harq->round = 0;
LOG_D(PHY, "ULSCH received ok \n"); LOG_D(PHY, "ULSCH received ok \n");
nr_fill_indication(gNB, ulsch->frame, ulsch->slot, rdata->ulsch_id, rdata->harq_pid, 0, 0); nr_fill_indication((void*)gNB, ulsch->frame, ulsch->slot, rdata->ulsch_id, rdata->harq_pid, 0, 0);
//dumpsig=1; //dumpsig=1;
} else { } else {
LOG_D(PHY, LOG_D(PHY,
...@@ -301,7 +301,7 @@ static void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req) ...@@ -301,7 +301,7 @@ static void nr_postDecode(PHY_VARS_gNB *gNB, notifiedFIFO_elt_t *req)
r); r);
ulsch->handled = 1; ulsch->handled = 1;
LOG_D(PHY, "ULSCH %d in error\n",rdata->ulsch_id); LOG_D(PHY, "ULSCH %d in error\n",rdata->ulsch_id);
nr_fill_indication(gNB, ulsch->frame, ulsch->slot, rdata->ulsch_id, rdata->harq_pid, 1, 0); nr_fill_indication((void*)gNB, ulsch->frame, ulsch->slot, rdata->ulsch_id, rdata->harq_pid, 1, 0);
// dumpsig=1; // dumpsig=1;
} }
ulsch->last_iteration_cnt = rdata->decodeIterations; ulsch->last_iteration_cnt = rdata->decodeIterations;
...@@ -406,14 +406,15 @@ static int nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ...@@ -406,14 +406,15 @@ static int nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int
start_meas(&gNB->ulsch_decoding_stats); start_meas(&gNB->ulsch_decoding_stats);
int nbDecode = int nbDecode =
nr_ulsch_decoding(gNB, ULSCH_id, gNB->pusch_vars[ULSCH_id].llr, frame_parms, pusch_pdu, frame_rx, slot_rx, harq_pid, G); nr_ulsch_decoding(gNB, NULL, ULSCH_id, gNB->pusch_vars[ULSCH_id].llr, frame_parms, pusch_pdu, frame_rx, slot_rx, harq_pid, G,NULL,NULL);
stop_meas(&gNB->ulsch_decoding_stats); stop_meas(&gNB->ulsch_decoding_stats);
return nbDecode; return nbDecode;
} }
void nr_fill_indication(PHY_VARS_gNB *gNB, int frame, int slot_rx, int ULSCH_id, uint8_t harq_pid, uint8_t crc_flag, int dtx_flag) void nr_fill_indication(void* p, int frame, int slot_rx, int ULSCH_id, uint8_t harq_pid, uint8_t crc_flag, int dtx_flag)
{ {
PHY_VARS_gNB *gNB = (PHY_VARS_gNB *)p;
if (!get_softmodem_params()->reorder_thread_disable) if (!get_softmodem_params()->reorder_thread_disable)
pthread_mutex_lock(&gNB->UL_INFO_mutex); pthread_mutex_lock(&gNB->UL_INFO_mutex);
...@@ -889,7 +890,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -889,7 +890,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RX_PUSCH, 1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_RX_PUSCH, 1);
start_meas(&gNB->rx_pusch_stats); start_meas(&gNB->rx_pusch_stats);
nr_rx_pusch(gNB, ULSCH_id, frame_rx, slot_rx, ulsch->harq_pid); nr_rx_pusch(gNB, NULL, gNB->common_vars.rxdataF,ULSCH_id, frame_rx, slot_rx, ulsch->harq_pid);
NR_gNB_PUSCH *pusch_vars = &gNB->pusch_vars[ULSCH_id]; NR_gNB_PUSCH *pusch_vars = &gNB->pusch_vars[ULSCH_id];
pusch_vars->ulsch_power_tot = 0; pusch_vars->ulsch_power_tot = 0;
pusch_vars->ulsch_noise_power_tot = 0; pusch_vars->ulsch_noise_power_tot = 0;
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#define __openair_SCHED_H__ #define __openair_SCHED_H__
#include "PHY/defs_nr_UE.h" #include "PHY/defs_nr_UE.h"
#include <stdbool.h>
/*enum THREAD_INDEX { OPENAIR_THREAD_INDEX = 0, /*enum THREAD_INDEX { OPENAIR_THREAD_INDEX = 0,
TOP_LEVEL_SCHEDULER_THREAD_INDEX, TOP_LEVEL_SCHEDULER_THREAD_INDEX,
...@@ -193,9 +193,9 @@ int nr_ue_csi_im_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, c16_t r ...@@ -193,9 +193,9 @@ int nr_ue_csi_im_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, c16_t r
void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP]); void nr_ue_csi_rs_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, c16_t rxdataF[][ue->frame_parms.samples_per_slot_wCP]);
void psbch_pscch_processing(PHY_VARS_NR_UE *ue, void psbch_pscch_pssch_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 phy_procedures_nrUE_SL_TX(PHY_VARS_NR_UE *ue, int phy_procedures_nrUE_SL_TX(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc, UE_nr_rxtx_proc_t *proc,
nr_phy_data_tx_t *phy_data); nr_phy_data_tx_t *phy_data);
...@@ -215,5 +215,9 @@ void nr_fill_sl_rx_indication(sl_nr_rx_indication_t *rx_ind, ...@@ -215,5 +215,9 @@ void nr_fill_sl_rx_indication(sl_nr_rx_indication_t *rx_ind,
void *typeSpecific, void *typeSpecific,
uint16_t rx_slss_id); uint16_t rx_slss_id);
typedef struct {
ldpcDecode_t *rdata;
bool rxok;
} slsch_status_t;
#endif #endif
...@@ -714,6 +714,11 @@ int8_t sl_handle_scheduled_response(nr_scheduled_response_t *scheduled_response) ...@@ -714,6 +714,11 @@ int8_t sl_handle_scheduled_response(nr_scheduled_response_t *scheduled_response)
phy_data->nr_sl_pssch_sci_pdu = sl_rx_config->sl_rx_config_list[0].rx_sci2_config_pdu; phy_data->nr_sl_pssch_sci_pdu = sl_rx_config->sl_rx_config_list[0].rx_sci2_config_pdu;
LOG_I(NR_PHY, "Recvd CONFIG_TYPE_RX_PSSCH\n"); LOG_I(NR_PHY, "Recvd CONFIG_TYPE_RX_PSSCH\n");
break; break;
case SL_NR_CONFIG_TYPE_RX_PSSCH_SLSCH:
phy_data->sl_rx_action = SL_NR_CONFIG_TYPE_RX_PSSCH_SLSCH;
phy_data->nr_sl_pssch_pdu = sl_rx_config->sl_rx_config_list[0].rx_pssch_config_pdu;
LOG_I(NR_PHY, "Recvd CONFIG_TYPE_RX_PSSCH\n");
break;
default: default:
AssertFatal(0,"Incorrect sl_rx config req pdutype \n"); AssertFatal(0,"Incorrect sl_rx config req pdutype \n");
break; break;
......
...@@ -474,8 +474,7 @@ typedef struct { ...@@ -474,8 +474,7 @@ typedef struct {
NR_list_t feedback_sl_harq; NR_list_t feedback_sl_harq;
/// UL HARQ processes that await retransmission /// UL HARQ processes that await retransmission
NR_list_t retrans_sl_harq; NR_list_t retrans_sl_harq;
// // NR_SLSCH
// NR_SLSCH
} NR_SL_UE_sched_ctrl_t; } NR_SL_UE_sched_ctrl_t;
#define MAX_SL_UE_CONNECTIONS 8 #define MAX_SL_UE_CONNECTIONS 8
...@@ -615,6 +614,8 @@ typedef struct { ...@@ -615,6 +614,8 @@ typedef struct {
// SIDELINK Scheduling fields // SIDELINK Scheduling fields
NR_SL_UEs_t UE_info; NR_SL_UEs_t UE_info;
// current SCI pdu build from SCI1 and SCI2
nr_sci_pdu_t sci_pdu_rx;
} NR_UE_MAC_INST_t; } NR_UE_MAC_INST_t;
/*@}*/ /*@}*/
......
...@@ -3255,9 +3255,13 @@ bool nr_ue_sl_pssch_scheduler(nr_sidelink_indication_t *sl_ind, ...@@ -3255,9 +3255,13 @@ bool nr_ue_sl_pssch_scheduler(nr_sidelink_indication_t *sl_ind,
if (slot > 9 && get_nrUE_params()->sync_ref) return false; if (slot > 9 && get_nrUE_params()->sync_ref) return false;
if (slot < 10 && !get_nrUE_params()->sync_ref) return false; if (/*slot < 10 &&*/ !get_nrUE_params()->sync_ref) return false;
LOG_I(NR_MAC,"[UE%d] SL-PSSCH SCHEDULER: Frame:SLOT %d:%d, slot_type:%d\n", if ((frame&127) > 0) return false;
if ((slot % 10) != 6) return false;
LOG_D(NR_MAC,"[UE%d] SL-PSSCH SCHEDULER: Frame:SLOT %d:%d, slot_type:%d\n",
sl_ind->module_id, frame, slot,sl_ind->slot_type); sl_ind->module_id, frame, slot,sl_ind->slot_type);
nr_sci_pdu_t sci_pdu; nr_sci_pdu_t sci_pdu;
...@@ -3305,7 +3309,7 @@ void nr_ue_sl_pscch_rx_scheduler(nr_sidelink_indication_t *sl_ind, ...@@ -3305,7 +3309,7 @@ void nr_ue_sl_pscch_rx_scheduler(nr_sidelink_indication_t *sl_ind,
sl_res_pool); sl_res_pool);
LOG_I(NR_MAC, "[UE%d] TTI-%d:%d RX PSCCH REQ \n", sl_ind->module_id,sl_ind->frame_rx, sl_ind->slot_rx); LOG_D(NR_MAC, "[UE%d] TTI-%d:%d RX PSCCH REQ \n", sl_ind->module_id,sl_ind->frame_rx, sl_ind->slot_rx);
} }
/* /*
...@@ -3354,7 +3358,7 @@ uint8_t nr_ue_sl_psbch_scheduler(nr_sidelink_indication_t *sl_ind, ...@@ -3354,7 +3358,7 @@ uint8_t nr_ue_sl_psbch_scheduler(nr_sidelink_indication_t *sl_ind,
rx_config->slot = slot; rx_config->slot = slot;
rx_config->sl_rx_config_list[0].pdu_type = *config_type; rx_config->sl_rx_config_list[0].pdu_type = *config_type;
LOG_I(NR_MAC, "[UE%d] TTI-%d:%d RX PSBCH REQ- rx_slss_id:%d, numSSB:%d, next slot_SSB:%d\n", LOG_D(NR_MAC, "[UE%d] TTI-%d:%d RX PSBCH REQ- rx_slss_id:%d, numSSB:%d, next slot_SSB:%d\n",
sl_ind->module_id,frame, slot, sl_ind->module_id,frame, slot,
sl_cfg->sl_sync_source.rx_slss_id, sl_cfg->sl_sync_source.rx_slss_id,
sl_mac_params->rx_sl_bch.num_ssb, sl_mac_params->rx_sl_bch.num_ssb,
...@@ -3379,7 +3383,7 @@ uint8_t nr_ue_sl_psbch_scheduler(nr_sidelink_indication_t *sl_ind, ...@@ -3379,7 +3383,7 @@ uint8_t nr_ue_sl_psbch_scheduler(nr_sidelink_indication_t *sl_ind,
tx_config->tx_config_list[0].tx_psbch_config_pdu.psbch_tx_power = 0;//TBD... tx_config->tx_config_list[0].tx_psbch_config_pdu.psbch_tx_power = 0;//TBD...
memcpy(tx_config->tx_config_list[0].tx_psbch_config_pdu.psbch_payload, sl_mac_params->tx_sl_bch.sl_mib, 4); memcpy(tx_config->tx_config_list[0].tx_psbch_config_pdu.psbch_payload, sl_mac_params->tx_sl_bch.sl_mib, 4);
LOG_I(NR_MAC, "[UE%d] TTI-%d:%d TX PSBCH REQ- tx_slss_id:%d, sl-mib:%x, numSSB:%d, next SSB slot:%d\n", if ((frame&127) ==0 ) LOG_I(NR_MAC, "[SyncRefUE%d] TTI-%d:%d TX PSBCH REQ- tx_slss_id:%d, sl-mib:%x, numSSB:%d, next SSB slot:%d\n",
sl_ind->module_id,frame, slot, sl_ind->module_id,frame, slot,
sl_mac_params->tx_sl_bch.slss_id, sl_mac_params->tx_sl_bch.slss_id,
(*(uint32_t *)tx_config->tx_config_list[0].tx_psbch_config_pdu.psbch_payload), (*(uint32_t *)tx_config->tx_config_list[0].tx_psbch_config_pdu.psbch_payload),
...@@ -3475,7 +3479,7 @@ void nr_ue_sidelink_scheduler(nr_sidelink_indication_t *sl_ind) { ...@@ -3475,7 +3479,7 @@ void nr_ue_sidelink_scheduler(nr_sidelink_indication_t *sl_ind) {
if (sl_ind->slot_type==SIDELINK_SLOT_TYPE_TX || sl_ind->phy_data==NULL) rx_allowed=false; if (sl_ind->slot_type==SIDELINK_SLOT_TYPE_TX || sl_ind->phy_data==NULL) rx_allowed=false;
if (((get_nrUE_params()->sync_ref && sl_ind->slot_rx > 9) || if (((get_nrUE_params()->sync_ref && sl_ind->slot_rx > 9) ||
(!get_nrUE_params()->sync_ref && sl_ind->slot_rx < 10)) && rx_allowed) { (!get_nrUE_params()->sync_ref && sl_ind->slot_rx < 10)) && rx_allowed) {
LOG_I(NR_MAC,"Scheduling PSCCH RX processing slot %d, sync_ref %d\n",slot,get_nrUE_params()->sync_ref); LOG_D(NR_MAC,"Scheduling PSCCH RX processing slot %d, sync_ref %d\n",slot,get_nrUE_params()->sync_ref);
nr_ue_sl_pscch_rx_scheduler(sl_ind, mac->sl_bwp, mac->sl_rx_res_pool,&rx_config, &tti_action); nr_ue_sl_pscch_rx_scheduler(sl_ind, mac->sl_bwp, mac->sl_rx_res_pool,&rx_config, &tti_action);
} }
if (!is_psbch_slot && tx_allowed) { if (!is_psbch_slot && tx_allowed) {
......
This diff is collapsed.
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
#include "radio/ETHERNET/if_defs.h" #include "radio/ETHERNET/if_defs.h"
#include <stdio.h> #include <stdio.h>
#include "openair2/GNB_APP/MACRLC_nr_paramdef.h" #include "openair2/GNB_APP/MACRLC_nr_paramdef.h"
#include "common/utils/colors.h"
#define MAX_IF_MODULES 100 #define MAX_IF_MODULES 100
UL_IND_t *UL_INFO = NULL; UL_IND_t *UL_INFO = NULL;
...@@ -1430,7 +1430,7 @@ static void handle_sl_bch(module_id_t module_id,uint8_t *const sl_mib, ...@@ -1430,7 +1430,7 @@ static void handle_sl_bch(module_id_t module_id,uint8_t *const sl_mib,
uint16_t frame = frame_1 | frame_0; uint16_t frame = frame_1 | frame_0;
uint8_t slot = ((sl_mib[2] & 0x01) << 6) | ((sl_mib[3] & 0xFC) >> 2); uint8_t slot = ((sl_mib[2] & 0x01) << 6) | ((sl_mib[3] & 0xFC) >> 2);
LOG_I(NR_MAC, "[UE%d]In %d:%d Received SL-MIB:%x .Contents- SL-TDD config:%x, Incov:%d, FN:%d, Slot:%d\n", LOG_I(NR_MAC, "%s[UE%d]In %d:%d Received SL-MIB:%x .Contents- SL-TDD config:%x, Incov:%d, FN:%d, Slot:%d\n",KRED,
module_id, frame_rx, slot_rx,*((uint32_t *)sl_mib), module_id, frame_rx, slot_rx,*((uint32_t *)sl_mib),
*((uint16_t *)sl_tdd_config), incov,frame, slot); *((uint16_t *)sl_tdd_config), incov,frame, slot);
...@@ -1450,6 +1450,13 @@ void handle_sl_sci1a(module_id_t module_id,uint32_t frame, uint32_t slot, sl_nr_ ...@@ -1450,6 +1450,13 @@ void handle_sl_sci1a(module_id_t module_id,uint32_t frame, uint32_t slot, sl_nr_
nr_ue_process_sci1_indication_pdu(mac,module_id,frame,slot,sci,phy_data); nr_ue_process_sci1_indication_pdu(mac,module_id,frame,slot,sci,phy_data);
} }
void handle_sl_sci2(module_id_t module_id,uint32_t frame, uint32_t slot, sl_nr_sci_indication_pdu_t *const sci,void *phy_data) {
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
nr_ue_process_sci2_indication_pdu(mac,module_id,frame,slot,sci,phy_data);
}
/* /*
if PSBCH rx - handle_psbch() if PSBCH rx - handle_psbch()
- Extract FN, Slot - Extract FN, Slot
...@@ -1470,7 +1477,7 @@ void sl_nr_process_rx_ind(uint16_t mod_id, ...@@ -1470,7 +1477,7 @@ void sl_nr_process_rx_ind(uint16_t mod_id,
case SL_NR_RX_PDU_TYPE_SSB: case SL_NR_RX_PDU_TYPE_SSB:
if (rx_ind->rx_indication_body[num_pdus - 1].ssb_pdu.decode_status) { if (rx_ind->rx_indication_body[num_pdus - 1].ssb_pdu.decode_status) {
LOG_I(NR_MAC, "[UE%d]SL-MAC Received SL-SSB: RSRP:%d dBm/RE, rx_psbch_payload:%x, rx_slss_id:%d\n", LOG_I(NR_MAC, "%s[UE%d]SL-MAC Received SL-SSB: RSRP:%d dBm/RE, rx_psbch_payload:%x, rx_slss_id:%d\n",KRED,
mod_id,rx_ind->rx_indication_body[num_pdus - 1].ssb_pdu.rsrp_dbm, mod_id,rx_ind->rx_indication_body[num_pdus - 1].ssb_pdu.rsrp_dbm,
*((uint32_t *)rx_ind->rx_indication_body[num_pdus - 1].ssb_pdu.psbch_payload), *((uint32_t *)rx_ind->rx_indication_body[num_pdus - 1].ssb_pdu.psbch_payload),
rx_ind->rx_indication_body[num_pdus - 1].ssb_pdu.rx_slss_id); rx_ind->rx_indication_body[num_pdus - 1].ssb_pdu.rx_slss_id);
...@@ -1504,9 +1511,13 @@ void sl_nr_process_sci_ind(uint16_t module_id, uint32_t frame, uint32_t slot, sl ...@@ -1504,9 +1511,13 @@ void sl_nr_process_sci_ind(uint16_t module_id, uint32_t frame, uint32_t slot, sl
switch (sci_ind->sci_pdu[idx].sci_format_type) { switch (sci_ind->sci_pdu[idx].sci_format_type) {
case SL_SCI_FORMAT_1A_ON_PSCCH: case SL_SCI_FORMAT_1A_ON_PSCCH:
LOG_I(NR_MAC,"%d.%d Received PSCCH PDU %d/%d PSCCH RSRP %d, length %d, sub-channel index %d, Nid %x, payload %llx\n", sci_ind->sfn,sci_ind->slot,1+idx,num_SCIs,sci_ind->sci_pdu[idx].pscch_rsrp,sci_ind->sci_pdu[idx].sci_payloadlen,sci_ind->sci_pdu[idx].subch_index,sci_ind->sci_pdu[idx].Nid,*(unsigned long long*)sci_ind->sci_pdu[idx].sci_payloadBits); LOG_I(NR_MAC,"%s%d.%d Received PSCCH PDU %d/%d PSCCH RSRP %d, length %d, sub-channel index %d, Nid %x, payload %llx\n", KBLU,sci_ind->sfn,sci_ind->slot,1+idx,num_SCIs,sci_ind->sci_pdu[idx].pscch_rsrp,sci_ind->sci_pdu[idx].sci_payloadlen,sci_ind->sci_pdu[idx].subch_index,sci_ind->sci_pdu[idx].Nid,*(unsigned long long*)sci_ind->sci_pdu[idx].sci_payloadBits);
handle_sl_sci1a(module_id,frame,slot,&sci_ind->sci_pdu[idx],phy_data); handle_sl_sci1a(module_id,frame,slot,&sci_ind->sci_pdu[idx],phy_data);
break; break;
case SL_SCI_FORMAT_2_ON_PSSCH:
LOG_I(NR_MAC,"%s%d.%d Received PSSCH PDU %d/%d PSSCH RSRP %d, length %d, payload %llx\n", KBLU,sci_ind->sfn,sci_ind->slot,1+idx,num_SCIs,sci_ind->sci_pdu[idx].pscch_rsrp,sci_ind->sci_pdu[idx].sci_payloadlen,*(unsigned long long*)sci_ind->sci_pdu[idx].sci_payloadBits);
handle_sl_sci2(module_id,frame,slot,&sci_ind->sci_pdu[idx],phy_data);
break;
default: default:
AssertFatal(1==0,"Unhandled or unknown sci format %d\n",sci_ind->sci_pdu[idx].sci_format_type); AssertFatal(1==0,"Unhandled or unknown sci format %d\n",sci_ind->sci_pdu[idx].sci_format_type);
break; break;
...@@ -1539,7 +1550,7 @@ int nr_ue_sl_indication(nr_sidelink_indication_t *sl_indication) ...@@ -1539,7 +1550,7 @@ int nr_ue_sl_indication(nr_sidelink_indication_t *sl_indication)
} else { } else {
nr_ue_sidelink_scheduler(sl_indication); nr_ue_sidelink_scheduler(sl_indication);
} }
LOG_I(NR_MAC,"returning from nr_sl_indication\n"); LOG_D(NR_MAC,"returning from nr_sl_indication\n");
return 0; 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