Commit bb2efbe4 authored by Khalid Ahmed's avatar Khalid Ahmed Committed by Thomas Schlichter

optimizing nr_ue_ulsch_procedures

parent 779e8996
...@@ -120,6 +120,103 @@ void nr_layer_mapping(int16_t **mod_symbs, ...@@ -120,6 +120,103 @@ void nr_layer_mapping(int16_t **mod_symbs,
} }
} }
void nr_ue_layer_mapping(NR_UE_ULSCH_t **ulsch_ue,
uint8_t n_layers,
uint16_t n_symbs,
int16_t **tx_layers) {
int16_t *mod_symbs;
switch (n_layers) {
case 1:
mod_symbs = (int16_t *)ulsch_ue[0]->d_mod;
for (int i=0; i<n_symbs; i++){
tx_layers[0][i<<1] = (mod_symbs[i<<1]*AMP)>>15;
tx_layers[0][(i<<1)+1] = (mod_symbs[(i<<1)+1]*AMP)>>15;
}
break;
case 2:
case 3:
case 4:
mod_symbs = (int16_t *)ulsch_ue[0]->d_mod;
for (int i=0; i<n_symbs/n_layers; i++){
for (int l=0; l<n_layers; l++) {
tx_layers[l][i<<1] = (mod_symbs[(n_layers*i+l)<<1]*AMP)>>15;
tx_layers[l][(i<<1)+1] = (mod_symbs[((n_layers*i+l)<<1)+1]*AMP)>>15;
}
}
break;
case 5:
mod_symbs = (int16_t *)ulsch_ue[0]->d_mod;
for (int i=0; i<n_symbs>>1; i++)
for (int l=0; l<2; l++) {
tx_layers[l][i<<1] = (mod_symbs[((i<<1)+l)<<1]*AMP)>>15;
tx_layers[l][(i<<1)+1] = (mod_symbs[(((i<<1)+l)<<1)+1]*AMP)>>15;
}
mod_symbs = (int16_t *)ulsch_ue[1]->d_mod;
for (int i=0; i<n_symbs/3; i++)
for (int l=2; l<5; l++) {
tx_layers[l][i<<1] = (mod_symbs[(3*i+l)<<1]*AMP)>>15;
tx_layers[l][(i<<1)+1] = (mod_symbs[((3*i+l)<<1)+1]*AMP)>>15;
}
break;
case 6:
for (int q=0; q<2; q++){
mod_symbs = (int16_t *)ulsch_ue[q]->d_mod;
for (int i=0; i<n_symbs/3; i++)
for (int l=0; l<3; l++) {
tx_layers[l][i<<1] = (mod_symbs[(3*i+l)<<1]*AMP)>>15;
tx_layers[l][(i<<1)+1] = (mod_symbs[((3*i+l)<<1)+1]*AMP)>>15;
}
}
break;
case 7:
mod_symbs = (int16_t *)ulsch_ue[1]->d_mod;
for (int i=0; i<n_symbs/3; i++)
for (int l=0; l<3; l++) {
tx_layers[l][i<<1] = (mod_symbs[(3*i+l)<<1]*AMP)>>15;
tx_layers[l][(i<<1)+1] = (mod_symbs[((3*i+l)<<1)+1]*AMP)>>15;
}
mod_symbs = (int16_t *)ulsch_ue[0]->d_mod;
for (int i=0; i<n_symbs/4; i++)
for (int l=3; l<7; l++) {
tx_layers[l][i<<1] = (mod_symbs[((i<<2)+l)<<1]*AMP)>>15;
tx_layers[l][(i<<1)+1] = (mod_symbs[(((i<<2)+l)<<1)+1]*AMP)>>15;
}
break;
case 8:
for (int q=0; q<2; q++){
mod_symbs = (int16_t *)ulsch_ue[q]->d_mod;
for (int i=0; i<n_symbs>>2; i++)
for (int l=0; l<3; l++) {
tx_layers[l][i<<1] = (mod_symbs[((i<<2)+l)<<1]*AMP)>>15;
tx_layers[l][(i<<1)+1] = (mod_symbs[(((i<<2)+l)<<1)+1]*AMP)>>15;
}
}
break;
default:
AssertFatal(0, "Invalid number of layers %d\n", n_layers);
}
}
void nr_dft(int32_t *z, int32_t *d, uint32_t Msc_PUSCH) void nr_dft(int32_t *z, int32_t *d, uint32_t Msc_PUSCH)
{ {
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <stdint.h> #include <stdint.h>
#include "PHY/defs_nr_common.h" #include "PHY/defs_nr_common.h"
#include "PHY/defs_gNB.h" #include "PHY/defs_gNB.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_ue.h"
#define DMRS_MOD_ORDER 2 #define DMRS_MOD_ORDER 2
...@@ -52,6 +53,18 @@ void nr_layer_mapping(int16_t **mod_symbs, ...@@ -52,6 +53,18 @@ void nr_layer_mapping(int16_t **mod_symbs,
uint16_t n_symbs, uint16_t n_symbs,
int16_t **tx_layers); int16_t **tx_layers);
/*! \brief Perform NR layer mapping. TS 38.211 V15.4.0 subclause 7.3.1.3
@param[in] ulsch_ue, double Pointer to NR_UE_ULSCH_t struct
@param[in] n_layers, number of layers
@param[in] n_symbs, number of modulated symbols
@param[out] tx_layers, modulated symbols for each layer
*/
void nr_ue_layer_mapping(NR_UE_ULSCH_t **ulsch_ue,
uint8_t n_layers,
uint16_t n_symbs,
int16_t **tx_layers);
/*! /*!
\brief This function implements the OFDM front end processor on reception (FEP) \brief This function implements the OFDM front end processor on reception (FEP)
......
...@@ -94,7 +94,6 @@ uint8_t nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -94,7 +94,6 @@ uint8_t nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
unsigned int available_bits; unsigned int available_bits;
uint8_t mod_order, cwd_index, num_of_codewords; uint8_t mod_order, cwd_index, num_of_codewords;
uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5]; uint32_t scrambled_output[NR_MAX_NB_CODEWORDS][NR_MAX_PDSCH_ENCODED_LENGTH>>5];
int32_t *mod_symbols[NR_MAX_NB_CODEWORDS];
uint32_t ***pusch_dmrs; uint32_t ***pusch_dmrs;
int16_t **tx_layers; int16_t **tx_layers;
int32_t **txdataF; int32_t **txdataF;
...@@ -180,14 +179,12 @@ uint8_t nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -180,14 +179,12 @@ uint8_t nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
mod_order, mod_order,
(int16_t *)ulsch_ue->d_mod); (int16_t *)ulsch_ue->d_mod);
// pusch_transform_precoding(ulsch_ue, frame_parms, harq_pid); // pusch_transform_precoding(ulsch_ue, frame_parms, harq_pid);
/////////// ///////////
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
mod_symbols[cwd_index] = (int32_t *)malloc16((NR_MAX_PUSCH_ENCODED_LENGTH)*sizeof(int32_t*));
memcpy(mod_symbols[cwd_index],ulsch_ue->d_mod,(available_bits/mod_order)*sizeof(int32_t));
} }
...@@ -212,13 +209,10 @@ uint8_t nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -212,13 +209,10 @@ uint8_t nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
tx_layers = (int16_t **)pusch_ue->txdataF_layers; tx_layers = (int16_t **)pusch_ue->txdataF_layers;
nr_layer_mapping((int16_t **)mod_symbols, nr_ue_layer_mapping(UE->ulsch[thread_id][eNB_id],
harq_process_ul_ue->Nl, harq_process_ul_ue->Nl,
available_bits/mod_order, available_bits/mod_order,
tx_layers); tx_layers);
for (uint32_t i = 0; i < 2*available_bits/mod_order; i++)
tx_layers[0][i] = (tx_layers[0][i] * AMP) >> 15;
/////////// ///////////
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
...@@ -323,15 +317,10 @@ uint8_t nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, ...@@ -323,15 +317,10 @@ uint8_t nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
} }
} }
} }
/////////// ///////////
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
for (cwd_index = 0;cwd_index < num_of_codewords; cwd_index++) {
free(mod_symbols[cwd_index]);
}
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