Commit d247abb5 authored by francescomani's avatar francescomani

code cleanup

parent 82597e7e
...@@ -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,
......
...@@ -35,62 +35,16 @@ ...@@ -35,62 +35,16 @@
#include "dmrs_nr.h" #include "dmrs_nr.h"
#include "PHY/NR_REFSIG/ptrs_nr.h" #include "PHY/NR_REFSIG/ptrs_nr.h"
#include "PHY/NR_REFSIG/nr_refsig.h" #include "PHY/NR_REFSIG/nr_refsig.h"
/***********************************************************************/
//#define max(a,b) (((a) > (b)) ? (a) : (b))
// TS 38.211 Table 6.4.1.2.2.1-1: The parameter kRE_ref.
// The first 4 colomns are DM-RS Configuration type 1 and the last 4 colomns are DM-RS Configuration type 2.
static const int16_t table_6_4_1_2_2_1_1_pusch_ptrs_kRE_ref[6][8] = {
{0, 2, 6, 8, 0, 1, 6, 7},
{2, 4, 8, 10, 1, 6, 7, 0},
{1, 3, 7, 9, 2, 3, 8, 9},
{3, 5, 9, 11, 3, 8, 9, 2},
{-1, -1, -1, -1, 4, 5, 10, 11},
{-1, -1, -1, -1, 5, 10, 11, 4},
};
/*******************************************************************
*
* NAME : get_kRE_ref
*
* PARAMETERS : dmrs_antenna_port DMRS antenna port
* pusch_dmrs_type PUSCH DMRS type
* resourceElementOffset the parameter resourceElementOffset
*
* RETURN : the parameter k_RE_ref
*
* DESCRIPTION : 3GPP TS 38.211 Table 6.4.1.2.2.1-1
*
*********************************************************************/
int16_t get_kRE_ref(uint8_t dmrs_antenna_port, uint8_t pusch_dmrs_type, uint8_t resourceElementOffset) {
uint8_t colomn;
int16_t k_RE_ref;
colomn = resourceElementOffset;
if (pusch_dmrs_type == 2)
colomn += 4;
k_RE_ref = table_6_4_1_2_2_1_1_pusch_ptrs_kRE_ref[dmrs_antenna_port][colomn];
AssertFatal(k_RE_ref>=0,"invalid k_RE_ref < 0. Check PTRS Configuration\n");
return k_RE_ref;
}
/******************************************************************* /*******************************************************************
* *
* NAME : set_ptrs_symb_idx * NAME : set_ptrs_symb_idx
* *
* PARAMETERS : ptrs_symbols PTRS OFDM symbol indicies bit mask * PARAMETERS : ptrs_symbols PTRS OFDM symbol indicies bit mask
* duration_in_symbols number of scheduled PUSCH ofdm symbols * duration_in_symbols number of scheduled ofdm symbols
* start_symbol first ofdm symbol of PUSCH within slot * start_symbol first ofdm symbol within slot
* L_ptrs the parameter L_ptrs * L_ptrs the parameter L_ptrs
* ul_dmrs_symb_pos bitmap of the time domain positions of the DMRS symbols in the scheduled PUSCH * dmrs_symb_pos bitmap of the time domain positions of the DMRS symbols
* *
* RETURN : sets the bit map of PTRS ofdm symbol indicies * RETURN : sets the bit map of PTRS ofdm symbol indicies
* *
...@@ -102,37 +56,31 @@ void set_ptrs_symb_idx(uint16_t *ptrs_symbols, ...@@ -102,37 +56,31 @@ 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)
{
int i = 0; int i = 0;
int l_ref = start_symbol; int l_ref = start_symbol;
const int last_symbol = start_symbol + duration_in_symbols - 1; const int last_symbol = start_symbol + duration_in_symbols - 1;
if (L_ptrs==0) { if (L_ptrs == 0) {
LOG_E(PHY,"bug: impossible L_ptrs\n"); LOG_E(PHY,"bug: impossible L_ptrs\n");
*ptrs_symbols = 0; *ptrs_symbols = 0;
return; return;
} }
while ( (l_ref + i*L_ptrs) <= last_symbol) { while ((l_ref + i * L_ptrs) <= last_symbol) {
int is_dmrs_symbol = 0, l_counter; int is_dmrs_symbol = 0, l_counter;
for(l_counter = l_ref + i * L_ptrs; l_counter >= max(l_ref + (i - 1) * L_ptrs + 1, l_ref); l_counter--) {
for(l_counter = l_ref + i*L_ptrs; l_counter >= max(l_ref + (i-1)*L_ptrs + 1, l_ref); l_counter--) { if((dmrs_symb_pos >> l_counter) & 0x01) {
if((ul_dmrs_symb_pos >> l_counter) & 0x01) {
is_dmrs_symbol = 1; is_dmrs_symbol = 1;
break; break;
} }
} }
if (is_dmrs_symbol) { if (is_dmrs_symbol) {
l_ref = l_counter; l_ref = l_counter;
i = 1; i = 1;
continue; continue;
} }
*ptrs_symbols = *ptrs_symbols | (1 << (l_ref + i * L_ptrs));
*ptrs_symbols = *ptrs_symbols | (1<<(l_ref + i*L_ptrs));
i++; i++;
} }
} }
...@@ -143,31 +91,26 @@ void set_ptrs_symb_idx(uint16_t *ptrs_symbols, ...@@ -143,31 +91,26 @@ void set_ptrs_symb_idx(uint16_t *ptrs_symbols,
* *
* PARAMETERS : k subcarrier index * PARAMETERS : k subcarrier index
* n_rnti UE CRNTI * n_rnti UE CRNTI
* dmrs_antenna_port DMRS antenna port
* K_ptrs the parameter K_ptrs * K_ptrs the parameter K_ptrs
* pusch_dmrs_type the DMRS configuration type used for PUSCH * N_RB number of RBs scheduled
* N_RB number of RBs scheduled for PUSCH
* k_RE_ref the parameter k_RE_ref * k_RE_ref the parameter k_RE_ref
* start_sc first subcarrier index * start_sc first subcarrier index
* ofdm_symbol_size number of samples in an OFDM symbol * ofdm_symbol_size number of samples in an OFDM symbol
* *
* RETURN : 1 if subcarrier k is PTRS, or 0 otherwise * RETURN : 1 if subcarrier k is PTRS, or 0 otherwise
* *
* DESCRIPTION : 3GPP TS 38.211 6.4.1.2 Phase-tracking reference signal for PUSCH * DESCRIPTION : 3GPP TS 38.211 6.4.1.2 Phase-tracking reference signal
* *
*********************************************************************/ *********************************************************************/
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,
uint16_t start_sc, uint16_t start_sc,
uint16_t ofdm_symbol_size) uint16_t ofdm_symbol_size)
{ {
// int16_t k_RE_ref = get_kRE_ref(dmrs_antenna_port, pusch_dmrs_type, resourceElementOffset);
uint16_t k_RB_ref; uint16_t k_RB_ref;
if (N_RB % K_ptrs == 0) if (N_RB % K_ptrs == 0)
...@@ -178,19 +121,18 @@ uint8_t is_ptrs_subcarrier(uint16_t k, ...@@ -178,19 +121,18 @@ uint8_t is_ptrs_subcarrier(uint16_t k,
if (k < start_sc) if (k < start_sc)
k += ofdm_symbol_size; k += ofdm_symbol_size;
if ((k - k_RE_ref - k_RB_ref*NR_NB_SC_PER_RB - start_sc) % (K_ptrs*NR_NB_SC_PER_RB) == 0) if ((k - k_RE_ref - k_RB_ref * NR_NB_SC_PER_RB - start_sc) % (K_ptrs * NR_NB_SC_PER_RB) == 0)
return 1; return 1;
return 0; return 0;
} }
/* return the total number of ptrs symbol in a slot */ /* return the total number of ptrs symbol in a slot */
uint8_t get_ptrs_symbols_in_slot(uint16_t l_prime_mask, uint16_t start_symb, uint16_t nb_symb) uint8_t get_ptrs_symbols_in_slot(uint16_t l_prime_mask, uint16_t start_symb, uint16_t nb_symb)
{ {
uint8_t tmp = 0; uint8_t tmp = 0;
for (int i = start_symb; i <= nb_symb; i++) for (int i = start_symb; i <= nb_symb; i++)
{ tmp += (l_prime_mask >> i) & 0x01;
tmp += (l_prime_mask >> i) & 0x01;
}
return tmp; return tmp;
} }
...@@ -198,7 +140,7 @@ uint8_t get_ptrs_symbols_in_slot(uint16_t l_prime_mask, uint16_t start_symb, uin ...@@ -198,7 +140,7 @@ uint8_t get_ptrs_symbols_in_slot(uint16_t l_prime_mask, uint16_t start_symb, uin
int8_t get_next_ptrs_symbol_in_slot(uint16_t ptrs_symb_pos, uint8_t counter, uint8_t nb_symb) int8_t get_next_ptrs_symbol_in_slot(uint16_t ptrs_symb_pos, uint8_t counter, uint8_t nb_symb)
{ {
for(int8_t symbol = counter; symbol < nb_symb; symbol++) { for(int8_t symbol = counter; symbol < nb_symb; symbol++) {
if((ptrs_symb_pos >>symbol)&0x01 ) { if((ptrs_symb_pos >> symbol) & 0x01) {
return symbol; return symbol;
} }
} }
...@@ -226,7 +168,6 @@ int8_t get_next_estimate_in_slot(uint16_t ptrsSymbPos,uint16_t dmrsSymbPos, ui ...@@ -226,7 +168,6 @@ int8_t get_next_estimate_in_slot(uint16_t ptrsSymbPos,uint16_t dmrsSymbPos, ui
* *
* PARAMETERS : K_ptrs : K value for PTRS * PARAMETERS : K_ptrs : K value for PTRS
* ptrsReOffset : RE offset for PTRS * ptrsReOffset : RE offset for PTRS
* dmrsConfigType: DMRS configuration type
* nb_rb : No. of resource blocks * nb_rb : No. of resource blocks
* rnti : RNTI * rnti : RNTI
* Ns : * Ns :
...@@ -244,7 +185,6 @@ int8_t get_next_estimate_in_slot(uint16_t ptrsSymbPos,uint16_t dmrsSymbPos, ui ...@@ -244,7 +185,6 @@ int8_t get_next_estimate_in_slot(uint16_t ptrsSymbPos,uint16_t dmrsSymbPos, ui
*********************************************************************/ *********************************************************************/
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,
...@@ -256,38 +196,27 @@ void nr_ptrs_cpe_estimation(uint8_t K_ptrs, ...@@ -256,38 +196,27 @@ void nr_ptrs_cpe_estimation(uint8_t K_ptrs,
int32_t *ptrs_sc) int32_t *ptrs_sc)
{ {
//#define DEBUG_PTRS 1 //#define DEBUG_PTRS 1
uint8_t is_ptrs_re = 0; if (K_ptrs == 0) {
uint16_t re_cnt = 0;
uint16_t cnt = 0;
unsigned short nb_re_pdsch = NR_NB_SC_PER_RB * nb_rb;
if (K_ptrs==0) {
LOG_E(PHY,"K_ptrs == 0\n"); LOG_E(PHY,"K_ptrs == 0\n");
return; return;
} }
uint16_t sc_per_symbol = (nb_rb + K_ptrs - 1)/K_ptrs;
c16_t ptrs_p[(1 + sc_per_symbol/4)*4]; uint16_t sc_per_symbol = (nb_rb + K_ptrs - 1) / K_ptrs;
c16_t ptrs_ch_p[(1 + sc_per_symbol/4)*4]; c16_t ptrs_p[(1 + sc_per_symbol / 4) * 4];
c16_t dmrs_comp_p[(1 + sc_per_symbol/4)*4]; c16_t dmrs_comp_p[(1 + sc_per_symbol / 4) * 4];
double abs = 0.0;
double real = 0.0;
double imag = 0.0;
#ifdef DEBUG_PTRS
double alpha = 0;
#endif
/* generate PTRS RE for the symbol */ /* generate PTRS RE for the symbol */
nr_gen_ref_conj_symbols(gold_seq,sc_per_symbol*2,(int16_t*)ptrs_p, NR_MOD_TABLE_QPSK_OFFSET,2);// 2 for QPSK nr_gen_ref_conj_symbols(gold_seq,sc_per_symbol*2,(int16_t*)ptrs_p, NR_MOD_TABLE_QPSK_OFFSET,2);// 2 for QPSK
uint32_t re_cnt = 0, cnt = 0;
/* loop over all sub carriers to get compensated RE on ptrs symbols*/ /* loop over all sub carriers to get compensated RE on ptrs symbols*/
for (int re = 0; re < nb_re_pdsch; re++) { for (int re = 0; re < NR_NB_SC_PER_RB * nb_rb; re++) {
is_ptrs_re = is_ptrs_subcarrier(re, uint8_t is_ptrs_re = is_ptrs_subcarrier(re,
rnti, rnti,
0, K_ptrs,
dmrsConfigType, nb_rb,
K_ptrs, ptrsReOffset,
nb_rb, 0,// start_re is 0 here
ptrsReOffset, ofdm_symbol_size);
0,// start_re is 0 here
ofdm_symbol_size);
if(is_ptrs_re) { if(is_ptrs_re) {
dmrs_comp_p[re_cnt].r = rxF_comp[re *2]; dmrs_comp_p[re_cnt].r = rxF_comp[re *2];
dmrs_comp_p[re_cnt].i = rxF_comp[(re *2)+1]; dmrs_comp_p[re_cnt].i = rxF_comp[(re *2)+1];
...@@ -303,24 +232,27 @@ void nr_ptrs_cpe_estimation(uint8_t K_ptrs, ...@@ -303,24 +232,27 @@ void nr_ptrs_cpe_estimation(uint8_t K_ptrs,
/* update the total ptrs RE in a symbol */ /* update the total ptrs RE in a symbol */
*ptrs_sc = re_cnt; *ptrs_sc = re_cnt;
c16_t ptrs_ch_p[(1 + sc_per_symbol / 4) * 4];
/*Multiple compensated data with conj of PTRS */ /*Multiple compensated data with conj of PTRS */
mult_cpx_vector((int16_t*)dmrs_comp_p, (int16_t*)ptrs_p, (int16_t*)ptrs_ch_p, (1 + sc_per_symbol/4)*4, 15); // 2^15 shifted mult_cpx_vector((int16_t*)dmrs_comp_p, (int16_t*)ptrs_p, (int16_t*)ptrs_ch_p, (1 + sc_per_symbol/4)*4, 15); // 2^15 shifted
/* loop over all ptrs sub carriers in a symbol */ /* loop over all ptrs sub carriers in a symbol */
/* sum the error vector */ /* sum the error vector */
double real = 0.0;
double imag = 0.0;
for(int i = 0;i < sc_per_symbol; i++) { for(int i = 0;i < sc_per_symbol; i++) {
real += ptrs_ch_p[i].r; real += ptrs_ch_p[i].r;
imag += ptrs_ch_p[i].i; imag += ptrs_ch_p[i].i;
} }
#ifdef DEBUG_PTRS #ifdef DEBUG_PTRS
alpha = atan(imag/real); double alpha = atan(imag/real);
printf("[PHY][PTRS]: Symbol %d atan(Im,real):= %f \n",symbol, alpha ); printf("[PHY][PTRS]: Symbol %d atan(Im,real):= %f \n",symbol, alpha );
#endif #endif
/* mean */ /* mean */
real /= sc_per_symbol; real /= sc_per_symbol;
imag /= sc_per_symbol; imag /= sc_per_symbol;
/* absolute calculation */ /* absolute calculation */
abs = sqrt(((real * real) + (imag * imag))); double abs = sqrt(((real * real) + (imag * imag)));
/* normalized error estimation */ /* normalized error estimation */
error_est[0]= (real / abs)*(1<<15); error_est[0]= (real / abs)*(1<<15);
/* compensation in given by conjugate of estimated phase (e^-j*2*pi*fd*t)*/ /* compensation in given by conjugate of estimated phase (e^-j*2*pi*fd*t)*/
......
...@@ -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,
......
...@@ -117,11 +117,11 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, ...@@ -117,11 +117,11 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
uint8_t is_ptrs_re = 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;
} }
/// CRC, coding, interleaving and rate matching /// CRC, coding, interleaving and rate matching
...@@ -303,13 +303,13 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, ...@@ -303,13 +303,13 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
ptrs_idx = 0; ptrs_idx = 0;
int16_t *mod_ptrs = NULL; int16_t *mod_ptrs = NULL;
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;
...@@ -323,8 +323,6 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, ...@@ -323,8 +323,6 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
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,
......
...@@ -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,
......
...@@ -602,7 +602,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, ...@@ -602,7 +602,7 @@ 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; uint8_t nb_re_dmrs;
...@@ -1156,17 +1156,13 @@ void nr_dlsch_scale_channel(uint32_t rx_size_symbol, ...@@ -1156,17 +1156,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 +1174,14 @@ void nr_dlsch_channel_level(uint32_t rx_size_symbol, ...@@ -1178,14 +1174,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 +1191,10 @@ void nr_dlsch_channel_level(uint32_t rx_size_symbol, ...@@ -1195,10 +1191,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();
} }
......
...@@ -425,8 +425,6 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -425,8 +425,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,
......
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